Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 42b8e67cd59abacb81e11c7ba39524d1 > files > 19

apr-api-docs-1.4.2-1.fc15.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Apache Portable Runtime: apr_buckets.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Apache Portable Runtime</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <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="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</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 id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </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 class="header">
  <div class="headertitle">
<h1>apr_buckets.h</h1>  </div>
</div>
<div class="contents">
<a href="apr__buckets_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* Licensed to the Apache Software Foundation (ASF) under one or more</span>
<a name="l00002"></a>00002 <span class="comment"> * contributor license agreements.  See the NOTICE file distributed with</span>
<a name="l00003"></a>00003 <span class="comment"> * this work for additional information regarding copyright ownership.</span>
<a name="l00004"></a>00004 <span class="comment"> * The ASF licenses this file to You under the Apache License, Version 2.0</span>
<a name="l00005"></a>00005 <span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance with</span>
<a name="l00006"></a>00006 <span class="comment"> * the License.  You may obtain a copy of the License at</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
<a name="l00011"></a>00011 <span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
<a name="l00012"></a>00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="l00013"></a>00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
<a name="l00014"></a>00014 <span class="comment"> * limitations under the License.</span>
<a name="l00015"></a>00015 <span class="comment"> */</span><span class="comment"></span>
<a name="l00016"></a>00016 <span class="comment">/**</span>
<a name="l00017"></a>00017 <span class="comment"> * @file apr_buckets.h</span>
<a name="l00018"></a>00018 <span class="comment"> * @brief APR-UTIL Buckets/Bucket Brigades</span>
<a name="l00019"></a>00019 <span class="comment"> */</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#ifndef APR_BUCKETS_H</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define APR_BUCKETS_H</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a>00024 <span class="preprocessor">#if defined(APR_BUCKET_DEBUG) &amp;&amp; !defined(APR_RING_DEBUG)</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define APR_RING_DEBUG</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;apu.h&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;<a class="code" href="apr__network__io_8h.html" title="APR Network library.">apr_network_io.h</a>&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="apr__file__io_8h.html" title="APR File I/O Handling.">apr_file_io.h</a>&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;<a class="code" href="apr__general_8h.html" title="APR Miscellaneous library routines.">apr_general.h</a>&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;<a class="code" href="apr__mmap_8h.html" title="APR MMAP routines.">apr_mmap.h</a>&quot;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &quot;<a class="code" href="apr__errno_8h.html" title="APR Error Codes.">apr_errno.h</a>&quot;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &quot;<a class="code" href="apr__ring_8h.html" title="APR Rings.">apr_ring.h</a>&quot;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &quot;<a class="code" href="apr_8h.html" title="APR Platform Definitions.">apr.h</a>&quot;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#if APR_HAVE_SYS_UIO_H</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#include &lt;sys/uio.h&gt;</span>    <span class="comment">/* for struct iovec */</span>
<a name="l00038"></a>00038 <span class="preprocessor">#endif</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#if APR_HAVE_STDARG_H</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor">#include &lt;stdarg.h&gt;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#endif</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span>
<a name="l00043"></a>00043 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00045"></a>00045 <span class="preprocessor">#endif</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00047"></a>00047 <span class="comment">/**</span>
<a name="l00048"></a>00048 <span class="comment"> * @defgroup APR_Util_Bucket_Brigades Bucket Brigades</span>
<a name="l00049"></a>00049 <span class="comment"> * @ingroup APR_Util</span>
<a name="l00050"></a>00050 <span class="comment"> * @{ </span>
<a name="l00051"></a>00051 <span class="comment"> */</span>
<a name="l00052"></a>00052 <span class="comment"></span>
<a name="l00053"></a>00053 <span class="comment">/** default bucket buffer size - 8KB minus room for memory allocator headers */</span>
<a name="l00054"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga82bf404af30875135c65e2c13ad035e5">00054</a> <span class="preprocessor">#define APR_BUCKET_BUFF_SIZE 8000</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00056"></a>00056 <span class="comment">/** Determines how a bucket or brigade should be read */</span>
<a name="l00057"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga756973fb6392bd1026c3d96b4519776d">00057</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
<a name="l00058"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gga756973fb6392bd1026c3d96b4519776da2d983f5b7fd996434e0dded171c261d8">00058</a>     <a class="code" href="group___a_p_r___util___bucket___brigades.html#gga756973fb6392bd1026c3d96b4519776da2d983f5b7fd996434e0dded171c261d8">APR_BLOCK_READ</a>,   <span class="comment">/**&lt; block until data becomes available */</span>
<a name="l00059"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gga756973fb6392bd1026c3d96b4519776da42b97663ca71fbbf2e2af7c8192e5dd8">00059</a>     <a class="code" href="group___a_p_r___util___bucket___brigades.html#gga756973fb6392bd1026c3d96b4519776da42b97663ca71fbbf2e2af7c8192e5dd8">APR_NONBLOCK_READ</a> <span class="comment">/**&lt; return immediately if no data is available */</span>
<a name="l00060"></a>00060 } <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga756973fb6392bd1026c3d96b4519776d">apr_read_type_e</a>;
<a name="l00061"></a>00061 <span class="comment"></span>
<a name="l00062"></a>00062 <span class="comment">/**</span>
<a name="l00063"></a>00063 <span class="comment"> * The one-sentence buzzword-laden overview: Bucket brigades represent</span>
<a name="l00064"></a>00064 <span class="comment"> * a complex data stream that can be passed through a layered IO</span>
<a name="l00065"></a>00065 <span class="comment"> * system without unnecessary copying. A longer overview follows...</span>
<a name="l00066"></a>00066 <span class="comment"> *</span>
<a name="l00067"></a>00067 <span class="comment"> * A bucket brigade is a doubly linked list (ring) of buckets, so we</span>
<a name="l00068"></a>00068 <span class="comment"> * aren&#39;t limited to inserting at the front and removing at the end.</span>
<a name="l00069"></a>00069 <span class="comment"> * Buckets are only passed around as members of a brigade, although</span>
<a name="l00070"></a>00070 <span class="comment"> * singleton buckets can occur for short periods of time.</span>
<a name="l00071"></a>00071 <span class="comment"> *</span>
<a name="l00072"></a>00072 <span class="comment"> * Buckets are data stores of various types. They can refer to data in</span>
<a name="l00073"></a>00073 <span class="comment"> * memory, or part of a file or mmap area, or the output of a process,</span>
<a name="l00074"></a>00074 <span class="comment"> * etc. Buckets also have some type-dependent accessor functions:</span>
<a name="l00075"></a>00075 <span class="comment"> * read, split, copy, setaside, and destroy.</span>
<a name="l00076"></a>00076 <span class="comment"> *</span>
<a name="l00077"></a>00077 <span class="comment"> * read returns the address and size of the data in the bucket. If the</span>
<a name="l00078"></a>00078 <span class="comment"> * data isn&#39;t in memory then it is read in and the bucket changes type</span>
<a name="l00079"></a>00079 <span class="comment"> * so that it can refer to the new location of the data. If all the</span>
<a name="l00080"></a>00080 <span class="comment"> * data doesn&#39;t fit in the bucket then a new bucket is inserted into</span>
<a name="l00081"></a>00081 <span class="comment"> * the brigade to hold the rest of it.</span>
<a name="l00082"></a>00082 <span class="comment"> *</span>
<a name="l00083"></a>00083 <span class="comment"> * split divides the data in a bucket into two regions. After a split</span>
<a name="l00084"></a>00084 <span class="comment"> * the original bucket refers to the first part of the data and a new</span>
<a name="l00085"></a>00085 <span class="comment"> * bucket inserted into the brigade after the original bucket refers</span>
<a name="l00086"></a>00086 <span class="comment"> * to the second part of the data. Reference counts are maintained as</span>
<a name="l00087"></a>00087 <span class="comment"> * necessary.</span>
<a name="l00088"></a>00088 <span class="comment"> *</span>
<a name="l00089"></a>00089 <span class="comment"> * setaside ensures that the data in the bucket has a long enough</span>
<a name="l00090"></a>00090 <span class="comment"> * lifetime. Sometimes it is convenient to create a bucket referring</span>
<a name="l00091"></a>00091 <span class="comment"> * to data on the stack in the expectation that it will be consumed</span>
<a name="l00092"></a>00092 <span class="comment"> * (output to the network) before the stack is unwound. If that</span>
<a name="l00093"></a>00093 <span class="comment"> * expectation turns out not to be valid, the setaside function is</span>
<a name="l00094"></a>00094 <span class="comment"> * called to move the data somewhere safer.</span>
<a name="l00095"></a>00095 <span class="comment"> *</span>
<a name="l00096"></a>00096 <span class="comment"> * copy makes a duplicate of the bucket structure as long as it&#39;s</span>
<a name="l00097"></a>00097 <span class="comment"> * possible to have multiple references to a single copy of the</span>
<a name="l00098"></a>00098 <span class="comment"> * data itself.  Not all bucket types can be copied.</span>
<a name="l00099"></a>00099 <span class="comment"> *</span>
<a name="l00100"></a>00100 <span class="comment"> * destroy maintains the reference counts on the resources used by a</span>
<a name="l00101"></a>00101 <span class="comment"> * bucket and frees them if necessary.</span>
<a name="l00102"></a>00102 <span class="comment"> *</span>
<a name="l00103"></a>00103 <span class="comment"> * Note: all of the above functions have wrapper macros (apr_bucket_read(),</span>
<a name="l00104"></a>00104 <span class="comment"> * apr_bucket_destroy(), etc), and those macros should be used rather</span>
<a name="l00105"></a>00105 <span class="comment"> * than using the function pointers directly.</span>
<a name="l00106"></a>00106 <span class="comment"> *</span>
<a name="l00107"></a>00107 <span class="comment"> * To write a bucket brigade, they are first made into an iovec, so that we</span>
<a name="l00108"></a>00108 <span class="comment"> * don&#39;t write too little data at one time.  Currently we ignore compacting the</span>
<a name="l00109"></a>00109 <span class="comment"> * buckets into as few buckets as possible, but if we really want good</span>
<a name="l00110"></a>00110 <span class="comment"> * performance, then we need to compact the buckets before we convert to an</span>
<a name="l00111"></a>00111 <span class="comment"> * iovec, or possibly while we are converting to an iovec.</span>
<a name="l00112"></a>00112 <span class="comment"> */</span>
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 <span class="comment">/*</span>
<a name="l00115"></a>00115 <span class="comment"> * Forward declaration of the main types.</span>
<a name="l00116"></a>00116 <span class="comment"> */</span>
<a name="l00117"></a>00117 <span class="comment"></span>
<a name="l00118"></a>00118 <span class="comment">/** @see apr_bucket_brigade */</span>
<a name="l00119"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9f50254e85c7aad79ca289a0ba069025">00119</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> <a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a>;<span class="comment"></span>
<a name="l00120"></a>00120 <span class="comment">/** @see apr_bucket */</span>
<a name="l00121"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gaa17a456120961b1c5af0525f4900a457">00121</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__bucket.html">apr_bucket</a> <a class="code" href="structapr__bucket.html">apr_bucket</a>;<span class="comment"></span>
<a name="l00122"></a>00122 <span class="comment">/** @see apr_bucket_alloc_t */</span>
<a name="l00123"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">00123</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a>;
<a name="l00124"></a>00124 <span class="comment"></span>
<a name="l00125"></a>00125 <span class="comment">/** @see apr_bucket_type_t */</span>
<a name="l00126"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga4a152aaf7d851c81af73b7e84dc1a8a2">00126</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a>;
<a name="l00127"></a>00127 <span class="comment"></span>
<a name="l00128"></a>00128 <span class="comment">/**</span>
<a name="l00129"></a>00129 <span class="comment"> * Basic bucket type</span>
<a name="l00130"></a>00130 <span class="comment"> */</span>
<a name="l00131"></a><a class="code" href="structapr__bucket__type__t.html">00131</a> <span class="keyword">struct </span><a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> {<span class="comment"></span>
<a name="l00132"></a>00132 <span class="comment">    /**</span>
<a name="l00133"></a>00133 <span class="comment">     * The name of the bucket type</span>
<a name="l00134"></a>00134 <span class="comment">     */</span>
<a name="l00135"></a><a class="code" href="structapr__bucket__type__t.html#ac6d779be45de214c6abd2cc205c48901">00135</a>     <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="structapr__bucket__type__t.html#ac6d779be45de214c6abd2cc205c48901">name</a>;<span class="comment"></span>
<a name="l00136"></a>00136 <span class="comment">    /** </span>
<a name="l00137"></a>00137 <span class="comment">     * The number of functions this bucket understands.  Can not be less than</span>
<a name="l00138"></a>00138 <span class="comment">     * five.</span>
<a name="l00139"></a>00139 <span class="comment">     */</span>
<a name="l00140"></a><a class="code" href="structapr__bucket__type__t.html#ad4bd2ffb03cb2f5f3b3941ce20468038">00140</a>     <span class="keywordtype">int</span> <a class="code" href="structapr__bucket__type__t.html#ad4bd2ffb03cb2f5f3b3941ce20468038">num_func</a>;<span class="comment"></span>
<a name="l00141"></a>00141 <span class="comment">    /**</span>
<a name="l00142"></a>00142 <span class="comment">     * Whether the bucket contains metadata (ie, information that</span>
<a name="l00143"></a>00143 <span class="comment">     * describes the regular contents of the brigade).  The metadata</span>
<a name="l00144"></a>00144 <span class="comment">     * is not returned by apr_bucket_read() and is not indicated by</span>
<a name="l00145"></a>00145 <span class="comment">     * the -&gt;length of the apr_bucket itself.  In other words, an</span>
<a name="l00146"></a>00146 <span class="comment">     * empty bucket is safe to arbitrarily remove if and only if it</span>
<a name="l00147"></a>00147 <span class="comment">     * contains no metadata.  In this sense, &quot;data&quot; is just raw bytes</span>
<a name="l00148"></a>00148 <span class="comment">     * that are the &quot;content&quot; of the brigade and &quot;metadata&quot; describes</span>
<a name="l00149"></a>00149 <span class="comment">     * that data but is not a proper part of it.</span>
<a name="l00150"></a>00150 <span class="comment">     */</span>
<a name="l00151"></a>00151     <span class="keyword">enum</span> {<span class="comment"></span>
<a name="l00152"></a>00152 <span class="comment">        /** This bucket type represents actual data to send to the client. */</span>
<a name="l00153"></a><a class="code" href="structapr__bucket__type__t.html#a117f85e4a58c5e7d7e373705ad138f85a53d3ef9d6a275fe2b72a91acea7017d5">00153</a>         <a class="code" href="structapr__bucket__type__t.html#a117f85e4a58c5e7d7e373705ad138f85a53d3ef9d6a275fe2b72a91acea7017d5">APR_BUCKET_DATA</a> = 0,<span class="comment"></span>
<a name="l00154"></a>00154 <span class="comment">        /** This bucket type represents metadata. */</span>
<a name="l00155"></a><a class="code" href="structapr__bucket__type__t.html#a117f85e4a58c5e7d7e373705ad138f85a9bf38b4eb3ea41c4af230432ac7a5fb1">00155</a>         <a class="code" href="structapr__bucket__type__t.html#a117f85e4a58c5e7d7e373705ad138f85a9bf38b4eb3ea41c4af230432ac7a5fb1">APR_BUCKET_METADATA</a> = 1
<a name="l00156"></a>00156     } is_metadata;<span class="comment"></span>
<a name="l00157"></a>00157 <span class="comment">    /**</span>
<a name="l00158"></a>00158 <span class="comment">     * Free the private data and any resources used by the bucket (if they</span>
<a name="l00159"></a>00159 <span class="comment">     *  aren&#39;t shared with another bucket).  This function is required to be</span>
<a name="l00160"></a>00160 <span class="comment">     *  implemented for all bucket types, though it might be a no-op on some</span>
<a name="l00161"></a>00161 <span class="comment">     *  of them (namely ones that never allocate any private data structures).</span>
<a name="l00162"></a>00162 <span class="comment">     * @param data The private data pointer from the bucket to be destroyed</span>
<a name="l00163"></a>00163 <span class="comment">     */</span>
<a name="l00164"></a><a class="code" href="structapr__bucket__type__t.html#aa5a8ae7611ba3be480e3fd12ff3ac352">00164</a>     void (*<a class="code" href="structapr__bucket__type__t.html#aa5a8ae7611ba3be480e3fd12ff3ac352">destroy</a>)(<span class="keywordtype">void</span> *data);
<a name="l00165"></a>00165 <span class="comment"></span>
<a name="l00166"></a>00166 <span class="comment">    /**</span>
<a name="l00167"></a>00167 <span class="comment">     * Read the data from the bucket. This is required to be implemented</span>
<a name="l00168"></a>00168 <span class="comment">     *  for all bucket types.</span>
<a name="l00169"></a>00169 <span class="comment">     * @param b The bucket to read from</span>
<a name="l00170"></a>00170 <span class="comment">     * @param str A place to store the data read.  Allocation should only be</span>
<a name="l00171"></a>00171 <span class="comment">     *            done if absolutely necessary. </span>
<a name="l00172"></a>00172 <span class="comment">     * @param len The amount of data read.</span>
<a name="l00173"></a>00173 <span class="comment">     * @param block Should this read function block if there is more data that</span>
<a name="l00174"></a>00174 <span class="comment">     *              cannot be read immediately.</span>
<a name="l00175"></a>00175 <span class="comment">     */</span>
<a name="l00176"></a><a class="code" href="structapr__bucket__type__t.html#a8e9f3f5b2a5513691f3cea130a1aa54b">00176</a>     <a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a> (*<a class="code" href="structapr__bucket__type__t.html#a8e9f3f5b2a5513691f3cea130a1aa54b">read</a>)(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b, <span class="keyword">const</span> <span class="keywordtype">char</span> **str, apr_size_t *len, 
<a name="l00177"></a>00177                          <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga756973fb6392bd1026c3d96b4519776d">apr_read_type_e</a> block);
<a name="l00178"></a>00178     <span class="comment"></span>
<a name="l00179"></a>00179 <span class="comment">    /**</span>
<a name="l00180"></a>00180 <span class="comment">     * Make it possible to set aside the data for at least as long as the</span>
<a name="l00181"></a>00181 <span class="comment">     *  given pool. Buckets containing data that could potentially die before</span>
<a name="l00182"></a>00182 <span class="comment">     *  this pool (e.g. the data resides on the stack, in a child pool of</span>
<a name="l00183"></a>00183 <span class="comment">     *  the given pool, or in a disjoint pool) must somehow copy, shift, or</span>
<a name="l00184"></a>00184 <span class="comment">     *  transform the data to have the proper lifetime.</span>
<a name="l00185"></a>00185 <span class="comment">     * @param e The bucket to convert</span>
<a name="l00186"></a>00186 <span class="comment">     * @remark Some bucket types contain data that will always outlive the</span>
<a name="l00187"></a>00187 <span class="comment">     *         bucket itself. For example no data (EOS and FLUSH), or the data</span>
<a name="l00188"></a>00188 <span class="comment">     *         resides in global, constant memory (IMMORTAL), or the data is on</span>
<a name="l00189"></a>00189 <span class="comment">     *      the heap (HEAP). For these buckets, apr_bucket_setaside_noop can</span>
<a name="l00190"></a>00190 <span class="comment">     *      be used.</span>
<a name="l00191"></a>00191 <span class="comment">     */</span>
<a name="l00192"></a><a class="code" href="structapr__bucket__type__t.html#a4e2015fd6e927ed55157a9b003ed5fdb">00192</a>     <a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a> (*<a class="code" href="structapr__bucket__type__t.html#a4e2015fd6e927ed55157a9b003ed5fdb">setaside</a>)(<a class="code" href="structapr__bucket.html">apr_bucket</a> *e, <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *pool);
<a name="l00193"></a>00193 <span class="comment"></span>
<a name="l00194"></a>00194 <span class="comment">    /**</span>
<a name="l00195"></a>00195 <span class="comment">     * Split one bucket in two at the specified position by duplicating</span>
<a name="l00196"></a>00196 <span class="comment">     *  the bucket structure (not the data) and modifying any necessary</span>
<a name="l00197"></a>00197 <span class="comment">     *  start/end/offset information.  If it&#39;s not possible to do this</span>
<a name="l00198"></a>00198 <span class="comment">     *  for the bucket type (perhaps the length of the data is indeterminate,</span>
<a name="l00199"></a>00199 <span class="comment">     *  as with pipe and socket buckets), then APR_ENOTIMPL is returned.</span>
<a name="l00200"></a>00200 <span class="comment">     * @param e The bucket to split</span>
<a name="l00201"></a>00201 <span class="comment">     * @param point The offset of the first byte in the new bucket</span>
<a name="l00202"></a>00202 <span class="comment">     */</span>
<a name="l00203"></a><a class="code" href="structapr__bucket__type__t.html#af30959bc15fc60e21224d5e3c8c0a814">00203</a>     <a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a> (*<a class="code" href="structapr__bucket__type__t.html#af30959bc15fc60e21224d5e3c8c0a814">split</a>)(<a class="code" href="structapr__bucket.html">apr_bucket</a> *e, apr_size_t point);
<a name="l00204"></a>00204 <span class="comment"></span>
<a name="l00205"></a>00205 <span class="comment">    /**</span>
<a name="l00206"></a>00206 <span class="comment">     * Copy the bucket structure (not the data), assuming that this is</span>
<a name="l00207"></a>00207 <span class="comment">     *  possible for the bucket type. If it&#39;s not, APR_ENOTIMPL is returned.</span>
<a name="l00208"></a>00208 <span class="comment">     * @param e The bucket to copy</span>
<a name="l00209"></a>00209 <span class="comment">     * @param c Returns a pointer to the new bucket</span>
<a name="l00210"></a>00210 <span class="comment">     */</span>
<a name="l00211"></a><a class="code" href="structapr__bucket__type__t.html#a300d6b15d55a3a1f13eeec7379100c38">00211</a>     <a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a> (*<a class="code" href="structapr__bucket__type__t.html#a300d6b15d55a3a1f13eeec7379100c38">copy</a>)(<a class="code" href="structapr__bucket.html">apr_bucket</a> *e, <a class="code" href="structapr__bucket.html">apr_bucket</a> **c);
<a name="l00212"></a>00212 
<a name="l00213"></a>00213 };
<a name="l00214"></a>00214 <span class="comment"></span>
<a name="l00215"></a>00215 <span class="comment">/**</span>
<a name="l00216"></a>00216 <span class="comment"> * apr_bucket structures are allocated on the malloc() heap and</span>
<a name="l00217"></a>00217 <span class="comment"> * their lifetime is controlled by the parent apr_bucket_brigade</span>
<a name="l00218"></a>00218 <span class="comment"> * structure. Buckets can move from one brigade to another e.g. by</span>
<a name="l00219"></a>00219 <span class="comment"> * calling APR_BRIGADE_CONCAT(). In general the data in a bucket has</span>
<a name="l00220"></a>00220 <span class="comment"> * the same lifetime as the bucket and is freed when the bucket is</span>
<a name="l00221"></a>00221 <span class="comment"> * destroyed; if the data is shared by more than one bucket (e.g.</span>
<a name="l00222"></a>00222 <span class="comment"> * after a split) the data is freed when the last bucket goes away.</span>
<a name="l00223"></a>00223 <span class="comment"> */</span>
<a name="l00224"></a><a class="code" href="structapr__bucket.html">00224</a> <span class="keyword">struct </span><a class="code" href="structapr__bucket.html">apr_bucket</a> {<span class="comment"></span>
<a name="l00225"></a>00225 <span class="comment">    /** Links to the rest of the brigade */</span>
<a name="l00226"></a>00226     <a class="code" href="structapr__bucket.html#ab1acff965e57e067dfde80321d04dea7">APR_RING_ENTRY</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a>) link;<span class="comment"></span>
<a name="l00227"></a>00227 <span class="comment">    /** The type of bucket.  */</span>
<a name="l00228"></a><a class="code" href="structapr__bucket.html#ac27fa5ce798e688ad243ebe1615937fc">00228</a>     <span class="keyword">const</span> <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> *<a class="code" href="structapr__bucket.html#ac27fa5ce798e688ad243ebe1615937fc">type</a>;<span class="comment"></span>
<a name="l00229"></a>00229 <span class="comment">    /** The length of the data in the bucket.  This could have been implemented</span>
<a name="l00230"></a>00230 <span class="comment">     *  with a function, but this is an optimization, because the most</span>
<a name="l00231"></a>00231 <span class="comment">     *  common thing to do will be to get the length.  If the length is unknown,</span>
<a name="l00232"></a>00232 <span class="comment">     *  the value of this field will be (apr_size_t)(-1).</span>
<a name="l00233"></a>00233 <span class="comment">     */</span>
<a name="l00234"></a><a class="code" href="structapr__bucket.html#a0898dfc78d9275187189b9a745e619bf">00234</a>     apr_size_t <a class="code" href="structapr__bucket.html#a0898dfc78d9275187189b9a745e619bf">length</a>;<span class="comment"></span>
<a name="l00235"></a>00235 <span class="comment">    /** The start of the data in the bucket relative to the private base</span>
<a name="l00236"></a>00236 <span class="comment">     *  pointer.  The vast majority of bucket types allow a fixed block of</span>
<a name="l00237"></a>00237 <span class="comment">     *  data to be referenced by multiple buckets, each bucket pointing to</span>
<a name="l00238"></a>00238 <span class="comment">     *  a different segment of the data.  That segment starts at base+start</span>
<a name="l00239"></a>00239 <span class="comment">     *  and ends at base+start+length.  </span>
<a name="l00240"></a>00240 <span class="comment">     *  If the length == (apr_size_t)(-1), then start == -1.</span>
<a name="l00241"></a>00241 <span class="comment">     */</span>
<a name="l00242"></a><a class="code" href="structapr__bucket.html#a4a8791b606b3ad613b8672ec94145628">00242</a>     apr_off_t <a class="code" href="structapr__bucket.html#a4a8791b606b3ad613b8672ec94145628">start</a>;<span class="comment"></span>
<a name="l00243"></a>00243 <span class="comment">    /** type-dependent data hangs off this pointer */</span>
<a name="l00244"></a><a class="code" href="structapr__bucket.html#a7fc4604750889b3f762bda1a786d276a">00244</a>     <span class="keywordtype">void</span> *<a class="code" href="structapr__bucket.html#a7fc4604750889b3f762bda1a786d276a">data</a>; <span class="comment"></span>
<a name="l00245"></a>00245 <span class="comment">    /**</span>
<a name="l00246"></a>00246 <span class="comment">     * Pointer to function used to free the bucket. This function should</span>
<a name="l00247"></a>00247 <span class="comment">     * always be defined and it should be consistent with the memory</span>
<a name="l00248"></a>00248 <span class="comment">     * function used to allocate the bucket. For example, if malloc() is </span>
<a name="l00249"></a>00249 <span class="comment">     * used to allocate the bucket, this pointer should point to free().</span>
<a name="l00250"></a>00250 <span class="comment">     * @param e Pointer to the bucket being freed</span>
<a name="l00251"></a>00251 <span class="comment">     */</span>
<a name="l00252"></a><a class="code" href="structapr__bucket.html#ac50b1c1de2b171938c33bf3ac478f359">00252</a>     void (*<a class="code" href="structapr__bucket.html#ac50b1c1de2b171938c33bf3ac478f359">free</a>)(<span class="keywordtype">void</span> *e);<span class="comment"></span>
<a name="l00253"></a>00253 <span class="comment">    /** The freelist from which this bucket was allocated */</span>
<a name="l00254"></a><a class="code" href="structapr__bucket.html#a5a500b80105834621514d6c0814d0966">00254</a>     <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *<a class="code" href="structapr__bucket.html#a5a500b80105834621514d6c0814d0966">list</a>;
<a name="l00255"></a>00255 };
<a name="l00256"></a>00256 <span class="comment"></span>
<a name="l00257"></a>00257 <span class="comment">/** A list of buckets */</span>
<a name="l00258"></a><a class="code" href="structapr__bucket__brigade.html">00258</a> <span class="keyword">struct </span><a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> {<span class="comment"></span>
<a name="l00259"></a>00259 <span class="comment">    /** The pool to associate the brigade with.  The data is not allocated out</span>
<a name="l00260"></a>00260 <span class="comment">     *  of the pool, but a cleanup is registered with this pool.  If the </span>
<a name="l00261"></a>00261 <span class="comment">     *  brigade is destroyed by some mechanism other than pool destruction,</span>
<a name="l00262"></a>00262 <span class="comment">     *  the destroying function is responsible for killing the cleanup.</span>
<a name="l00263"></a>00263 <span class="comment">     */</span>
<a name="l00264"></a><a class="code" href="structapr__bucket__brigade.html#a8e03b4dd531903709ae3ae8ebe9e46ee">00264</a>     <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *<a class="code" href="structapr__bucket__brigade.html#a8e03b4dd531903709ae3ae8ebe9e46ee">p</a>;<span class="comment"></span>
<a name="l00265"></a>00265 <span class="comment">    /** The buckets in the brigade are on this list. */</span>
<a name="l00266"></a>00266     <span class="comment">/*</span>
<a name="l00267"></a>00267 <span class="comment">     * The apr_bucket_list structure doesn&#39;t actually need a name tag</span>
<a name="l00268"></a>00268 <span class="comment">     * because it has no existence independent of struct apr_bucket_brigade;</span>
<a name="l00269"></a>00269 <span class="comment">     * the ring macros are designed so that you can leave the name tag</span>
<a name="l00270"></a>00270 <span class="comment">     * argument empty in this situation but apparently the Windows compiler</span>
<a name="l00271"></a>00271 <span class="comment">     * doesn&#39;t like that.</span>
<a name="l00272"></a>00272 <span class="comment">     */</span>
<a name="l00273"></a>00273     <a class="code" href="structapr__bucket__brigade.html#a76a313afc83dd161916f3f9b83eea734">APR_RING_HEAD</a>(apr_bucket_list, <a class="code" href="structapr__bucket.html">apr_bucket</a>) list;<span class="comment"></span>
<a name="l00274"></a>00274 <span class="comment">    /** The freelist from which this bucket was allocated */</span>
<a name="l00275"></a><a class="code" href="structapr__bucket__brigade.html#a9f58f90a088f02ebb6f935f004092aaa">00275</a>     <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *<a class="code" href="structapr__bucket__brigade.html#a9f58f90a088f02ebb6f935f004092aaa">bucket_alloc</a>;
<a name="l00276"></a>00276 };
<a name="l00277"></a>00277 
<a name="l00278"></a>00278 <span class="comment"></span>
<a name="l00279"></a>00279 <span class="comment">/**</span>
<a name="l00280"></a>00280 <span class="comment"> * Function called when a brigade should be flushed</span>
<a name="l00281"></a>00281 <span class="comment"> */</span>
<a name="l00282"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gacdf6dc9d4c81c64834e5e509281f7f16">00282</a> typedef <a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a> (*<a class="code" href="group___a_p_r___util___bucket___brigades.html#gacdf6dc9d4c81c64834e5e509281f7f16">apr_brigade_flush</a>)(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *bb, <span class="keywordtype">void</span> *ctx);
<a name="l00283"></a>00283 
<a name="l00284"></a>00284 <span class="comment">/*</span>
<a name="l00285"></a>00285 <span class="comment"> * define APR_BUCKET_DEBUG if you want your brigades to be checked for</span>
<a name="l00286"></a>00286 <span class="comment"> * validity at every possible instant.  this will slow your code down</span>
<a name="l00287"></a>00287 <span class="comment"> * substantially but is a very useful debugging tool.</span>
<a name="l00288"></a>00288 <span class="comment"> */</span>
<a name="l00289"></a>00289 <span class="preprocessor">#ifdef APR_BUCKET_DEBUG</span>
<a name="l00290"></a>00290 <span class="preprocessor"></span>
<a name="l00291"></a>00291 <span class="preprocessor">#define APR_BRIGADE_CHECK_CONSISTENCY(b)                                \</span>
<a name="l00292"></a>00292 <span class="preprocessor">        APR_RING_CHECK_CONSISTENCY(&amp;(b)-&gt;list, apr_bucket, link)</span>
<a name="l00293"></a>00293 <span class="preprocessor"></span>
<a name="l00294"></a>00294 <span class="preprocessor">#define APR_BUCKET_CHECK_CONSISTENCY(e)                                 \</span>
<a name="l00295"></a>00295 <span class="preprocessor">        APR_RING_CHECK_ELEM_CONSISTENCY((e), apr_bucket, link)</span>
<a name="l00296"></a>00296 <span class="preprocessor"></span>
<a name="l00297"></a>00297 <span class="preprocessor">#else</span>
<a name="l00298"></a>00298 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00299"></a>00299 <span class="comment"> * checks the ring pointers in a bucket brigade for consistency.  an</span>
<a name="l00300"></a>00300 <span class="comment"> * abort() will be triggered if any inconsistencies are found.</span>
<a name="l00301"></a>00301 <span class="comment"> *   note: this is a no-op unless APR_BUCKET_DEBUG is defined.</span>
<a name="l00302"></a>00302 <span class="comment"> * @param b The brigade</span>
<a name="l00303"></a>00303 <span class="comment"> */</span>
<a name="l00304"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gae1dfe8bf117d10e7dc5b8e0c08f0ebb2">00304</a> <span class="preprocessor">#define APR_BRIGADE_CHECK_CONSISTENCY(b)</span>
<a name="l00305"></a>00305 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00306"></a>00306 <span class="comment"> * checks the brigade a bucket is in for ring consistency.  an</span>
<a name="l00307"></a>00307 <span class="comment"> * abort() will be triggered if any inconsistencies are found.</span>
<a name="l00308"></a>00308 <span class="comment"> *   note: this is a no-op unless APR_BUCKET_DEBUG is defined.</span>
<a name="l00309"></a>00309 <span class="comment"> * @param e The bucket</span>
<a name="l00310"></a>00310 <span class="comment"> */</span>
<a name="l00311"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gaedaeb3fbe71aac408377471b8a54dc08">00311</a> <span class="preprocessor">#define APR_BUCKET_CHECK_CONSISTENCY(e)</span>
<a name="l00312"></a>00312 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00313"></a>00313 <span class="preprocessor"></span>
<a name="l00314"></a>00314 <span class="comment"></span>
<a name="l00315"></a>00315 <span class="comment">/**</span>
<a name="l00316"></a>00316 <span class="comment"> * Wrappers around the RING macros to reduce the verbosity of the code</span>
<a name="l00317"></a>00317 <span class="comment"> * that handles bucket brigades.</span>
<a name="l00318"></a>00318 <span class="comment"> */</span><span class="comment"></span>
<a name="l00319"></a>00319 <span class="comment">/**</span>
<a name="l00320"></a>00320 <span class="comment"> * The magic pointer value that indicates the head of the brigade</span>
<a name="l00321"></a>00321 <span class="comment"> * @remark This is used to find the beginning and end of the brigade, eg:</span>
<a name="l00322"></a>00322 <span class="comment"> * &lt;pre&gt;</span>
<a name="l00323"></a>00323 <span class="comment"> *      while (e != APR_BRIGADE_SENTINEL(b)) {</span>
<a name="l00324"></a>00324 <span class="comment"> *          ...</span>
<a name="l00325"></a>00325 <span class="comment"> *          e = APR_BUCKET_NEXT(e);</span>
<a name="l00326"></a>00326 <span class="comment"> *      }</span>
<a name="l00327"></a>00327 <span class="comment"> * &lt;/pre&gt;</span>
<a name="l00328"></a>00328 <span class="comment"> * @param  b The brigade</span>
<a name="l00329"></a>00329 <span class="comment"> * @return The magic pointer value</span>
<a name="l00330"></a>00330 <span class="comment"> */</span>
<a name="l00331"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga858da66dccab1e063415678bb115788a">00331</a> <span class="preprocessor">#define APR_BRIGADE_SENTINEL(b) APR_RING_SENTINEL(&amp;(b)-&gt;list, apr_bucket, link)</span>
<a name="l00332"></a>00332 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00333"></a>00333 <span class="comment">/**</span>
<a name="l00334"></a>00334 <span class="comment"> * Determine if the bucket brigade is empty</span>
<a name="l00335"></a>00335 <span class="comment"> * @param b The brigade to check</span>
<a name="l00336"></a>00336 <span class="comment"> * @return true or false</span>
<a name="l00337"></a>00337 <span class="comment"> */</span>
<a name="l00338"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga836f61da6cce15074eff257ce4b6fc0f">00338</a> <span class="preprocessor">#define APR_BRIGADE_EMPTY(b)    APR_RING_EMPTY(&amp;(b)-&gt;list, apr_bucket, link)</span>
<a name="l00339"></a>00339 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00340"></a>00340 <span class="comment">/**</span>
<a name="l00341"></a>00341 <span class="comment"> * Return the first bucket in a brigade</span>
<a name="l00342"></a>00342 <span class="comment"> * @param b The brigade to query</span>
<a name="l00343"></a>00343 <span class="comment"> * @return The first bucket in the brigade</span>
<a name="l00344"></a>00344 <span class="comment"> */</span>
<a name="l00345"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gab5826a11eb6ba90786a94282f806c230">00345</a> <span class="preprocessor">#define APR_BRIGADE_FIRST(b)    APR_RING_FIRST(&amp;(b)-&gt;list)</span>
<a name="l00346"></a>00346 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00347"></a>00347 <span class="comment"> * Return the last bucket in a brigade</span>
<a name="l00348"></a>00348 <span class="comment"> * @param b The brigade to query</span>
<a name="l00349"></a>00349 <span class="comment"> * @return The last bucket in the brigade</span>
<a name="l00350"></a>00350 <span class="comment"> */</span>
<a name="l00351"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga40e0ef2a904aa519ca9d63288dee0b4d">00351</a> <span class="preprocessor">#define APR_BRIGADE_LAST(b)     APR_RING_LAST(&amp;(b)-&gt;list)</span>
<a name="l00352"></a>00352 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00353"></a>00353 <span class="comment">/**</span>
<a name="l00354"></a>00354 <span class="comment"> * Insert a list of buckets at the front of a brigade</span>
<a name="l00355"></a>00355 <span class="comment"> * @param b The brigade to add to</span>
<a name="l00356"></a>00356 <span class="comment"> * @param e The first bucket in a list of buckets to insert</span>
<a name="l00357"></a>00357 <span class="comment"> */</span>
<a name="l00358"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga6dc39d8757e18941a6fb069b0c18fbd3">00358</a> <span class="preprocessor">#define APR_BRIGADE_INSERT_HEAD(b, e) do {                              \</span>
<a name="l00359"></a>00359 <span class="preprocessor">        apr_bucket *ap__b = (e);                                        \</span>
<a name="l00360"></a>00360 <span class="preprocessor">        APR_RING_INSERT_HEAD(&amp;(b)-&gt;list, ap__b, apr_bucket, link);      \</span>
<a name="l00361"></a>00361 <span class="preprocessor">        APR_BRIGADE_CHECK_CONSISTENCY((b));                             \</span>
<a name="l00362"></a>00362 <span class="preprocessor">    } while (0)</span>
<a name="l00363"></a>00363 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00364"></a>00364 <span class="comment">/**</span>
<a name="l00365"></a>00365 <span class="comment"> * Insert a list of buckets at the end of a brigade</span>
<a name="l00366"></a>00366 <span class="comment"> * @param b The brigade to add to</span>
<a name="l00367"></a>00367 <span class="comment"> * @param e The first bucket in a list of buckets to insert</span>
<a name="l00368"></a>00368 <span class="comment"> */</span>
<a name="l00369"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga5447595f8374296c5ffe208db39b2f5d">00369</a> <span class="preprocessor">#define APR_BRIGADE_INSERT_TAIL(b, e) do {                              \</span>
<a name="l00370"></a>00370 <span class="preprocessor">        apr_bucket *ap__b = (e);                                        \</span>
<a name="l00371"></a>00371 <span class="preprocessor">        APR_RING_INSERT_TAIL(&amp;(b)-&gt;list, ap__b, apr_bucket, link);      \</span>
<a name="l00372"></a>00372 <span class="preprocessor">        APR_BRIGADE_CHECK_CONSISTENCY((b));                             \</span>
<a name="l00373"></a>00373 <span class="preprocessor">    } while (0)</span>
<a name="l00374"></a>00374 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00375"></a>00375 <span class="comment">/**</span>
<a name="l00376"></a>00376 <span class="comment"> * Concatenate brigade b onto the end of brigade a, leaving brigade b empty</span>
<a name="l00377"></a>00377 <span class="comment"> * @param a The first brigade</span>
<a name="l00378"></a>00378 <span class="comment"> * @param b The second brigade</span>
<a name="l00379"></a>00379 <span class="comment"> */</span>
<a name="l00380"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga7cecbc89be912ce9ab24c889eb8f955b">00380</a> <span class="preprocessor">#define APR_BRIGADE_CONCAT(a, b) do {                                   \</span>
<a name="l00381"></a>00381 <span class="preprocessor">        APR_RING_CONCAT(&amp;(a)-&gt;list, &amp;(b)-&gt;list, apr_bucket, link);      \</span>
<a name="l00382"></a>00382 <span class="preprocessor">        APR_BRIGADE_CHECK_CONSISTENCY((a));                             \</span>
<a name="l00383"></a>00383 <span class="preprocessor">    } while (0)</span>
<a name="l00384"></a>00384 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00385"></a>00385 <span class="comment">/**</span>
<a name="l00386"></a>00386 <span class="comment"> * Prepend brigade b onto the beginning of brigade a, leaving brigade b empty</span>
<a name="l00387"></a>00387 <span class="comment"> * @param a The first brigade</span>
<a name="l00388"></a>00388 <span class="comment"> * @param b The second brigade</span>
<a name="l00389"></a>00389 <span class="comment"> */</span>
<a name="l00390"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga52ba212f76507a79ccae213875150ad1">00390</a> <span class="preprocessor">#define APR_BRIGADE_PREPEND(a, b) do {                                  \</span>
<a name="l00391"></a>00391 <span class="preprocessor">        APR_RING_PREPEND(&amp;(a)-&gt;list, &amp;(b)-&gt;list, apr_bucket, link);     \</span>
<a name="l00392"></a>00392 <span class="preprocessor">        APR_BRIGADE_CHECK_CONSISTENCY((a));                             \</span>
<a name="l00393"></a>00393 <span class="preprocessor">    } while (0)</span>
<a name="l00394"></a>00394 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00395"></a>00395 <span class="comment">/**</span>
<a name="l00396"></a>00396 <span class="comment"> * Insert a list of buckets before a specified bucket</span>
<a name="l00397"></a>00397 <span class="comment"> * @param a The bucket to insert before</span>
<a name="l00398"></a>00398 <span class="comment"> * @param b The buckets to insert</span>
<a name="l00399"></a>00399 <span class="comment"> */</span>
<a name="l00400"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gae012adeccda754eabc42b7855bec081e">00400</a> <span class="preprocessor">#define APR_BUCKET_INSERT_BEFORE(a, b) do {                             \</span>
<a name="l00401"></a>00401 <span class="preprocessor">        apr_bucket *ap__a = (a), *ap__b = (b);                          \</span>
<a name="l00402"></a>00402 <span class="preprocessor">        APR_RING_INSERT_BEFORE(ap__a, ap__b, link);                     \</span>
<a name="l00403"></a>00403 <span class="preprocessor">        APR_BUCKET_CHECK_CONSISTENCY(ap__a);                            \</span>
<a name="l00404"></a>00404 <span class="preprocessor">    } while (0)</span>
<a name="l00405"></a>00405 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00406"></a>00406 <span class="comment">/**</span>
<a name="l00407"></a>00407 <span class="comment"> * Insert a list of buckets after a specified bucket</span>
<a name="l00408"></a>00408 <span class="comment"> * @param a The bucket to insert after</span>
<a name="l00409"></a>00409 <span class="comment"> * @param b The buckets to insert</span>
<a name="l00410"></a>00410 <span class="comment"> */</span>
<a name="l00411"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga1f8114b7316d1fef1deb95abc8f02341">00411</a> <span class="preprocessor">#define APR_BUCKET_INSERT_AFTER(a, b) do {                              \</span>
<a name="l00412"></a>00412 <span class="preprocessor">        apr_bucket *ap__a = (a), *ap__b = (b);                          \</span>
<a name="l00413"></a>00413 <span class="preprocessor">        APR_RING_INSERT_AFTER(ap__a, ap__b, link);                      \</span>
<a name="l00414"></a>00414 <span class="preprocessor">        APR_BUCKET_CHECK_CONSISTENCY(ap__a);                            \</span>
<a name="l00415"></a>00415 <span class="preprocessor">    } while (0)</span>
<a name="l00416"></a>00416 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00417"></a>00417 <span class="comment">/**</span>
<a name="l00418"></a>00418 <span class="comment"> * Get the next bucket in the list</span>
<a name="l00419"></a>00419 <span class="comment"> * @param e The current bucket</span>
<a name="l00420"></a>00420 <span class="comment"> * @return The next bucket</span>
<a name="l00421"></a>00421 <span class="comment"> */</span>
<a name="l00422"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga7171f690b203d548a5b6ae0b079068d8">00422</a> <span class="preprocessor">#define APR_BUCKET_NEXT(e)      APR_RING_NEXT((e), link)</span>
<a name="l00423"></a>00423 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00424"></a>00424 <span class="comment"> * Get the previous bucket in the list</span>
<a name="l00425"></a>00425 <span class="comment"> * @param e The current bucket</span>
<a name="l00426"></a>00426 <span class="comment"> * @return The previous bucket</span>
<a name="l00427"></a>00427 <span class="comment"> */</span>
<a name="l00428"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gaf229fecd4174efd4d6a9774e3048ae28">00428</a> <span class="preprocessor">#define APR_BUCKET_PREV(e)      APR_RING_PREV((e), link)</span>
<a name="l00429"></a>00429 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00430"></a>00430 <span class="comment">/**</span>
<a name="l00431"></a>00431 <span class="comment"> * Remove a bucket from its bucket brigade</span>
<a name="l00432"></a>00432 <span class="comment"> * @param e The bucket to remove</span>
<a name="l00433"></a>00433 <span class="comment"> */</span>
<a name="l00434"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga2c46a1b717a87b68bd98b425e0c64977">00434</a> <span class="preprocessor">#define APR_BUCKET_REMOVE(e)    APR_RING_REMOVE((e), link)</span>
<a name="l00435"></a>00435 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00436"></a>00436 <span class="comment">/**</span>
<a name="l00437"></a>00437 <span class="comment"> * Initialize a new bucket&#39;s prev/next pointers</span>
<a name="l00438"></a>00438 <span class="comment"> * @param e The bucket to initialize</span>
<a name="l00439"></a>00439 <span class="comment"> */</span>
<a name="l00440"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga00c2e104125f124c3a52627863432de9">00440</a> <span class="preprocessor">#define APR_BUCKET_INIT(e)      APR_RING_ELEM_INIT((e), link)</span>
<a name="l00441"></a>00441 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00442"></a>00442 <span class="comment">/**</span>
<a name="l00443"></a>00443 <span class="comment"> * Determine if a bucket contains metadata.  An empty bucket is</span>
<a name="l00444"></a>00444 <span class="comment"> * safe to arbitrarily remove if and only if this is false.</span>
<a name="l00445"></a>00445 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00446"></a>00446 <span class="comment"> * @return true or false</span>
<a name="l00447"></a>00447 <span class="comment"> */</span>
<a name="l00448"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga506cb29cc1ec1abeb487e01b122bd4d9">00448</a> <span class="preprocessor">#define APR_BUCKET_IS_METADATA(e)    ((e)-&gt;type-&gt;is_metadata)</span>
<a name="l00449"></a>00449 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00450"></a>00450 <span class="comment">/**</span>
<a name="l00451"></a>00451 <span class="comment"> * Determine if a bucket is a FLUSH bucket</span>
<a name="l00452"></a>00452 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00453"></a>00453 <span class="comment"> * @return true or false</span>
<a name="l00454"></a>00454 <span class="comment"> */</span>
<a name="l00455"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga24105da0bb755a775c4b2a519d7c25f9">00455</a> <span class="preprocessor">#define APR_BUCKET_IS_FLUSH(e)       ((e)-&gt;type == &amp;apr_bucket_type_flush)</span>
<a name="l00456"></a>00456 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00457"></a>00457 <span class="comment"> * Determine if a bucket is an EOS bucket</span>
<a name="l00458"></a>00458 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00459"></a>00459 <span class="comment"> * @return true or false</span>
<a name="l00460"></a>00460 <span class="comment"> */</span>
<a name="l00461"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga89b225e1c08473766eec719b985ca0d6">00461</a> <span class="preprocessor">#define APR_BUCKET_IS_EOS(e)         ((e)-&gt;type == &amp;apr_bucket_type_eos)</span>
<a name="l00462"></a>00462 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00463"></a>00463 <span class="comment"> * Determine if a bucket is a FILE bucket</span>
<a name="l00464"></a>00464 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00465"></a>00465 <span class="comment"> * @return true or false</span>
<a name="l00466"></a>00466 <span class="comment"> */</span>
<a name="l00467"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga1d54037bb6953c73d5c61f64c311d470">00467</a> <span class="preprocessor">#define APR_BUCKET_IS_FILE(e)        ((e)-&gt;type == &amp;apr_bucket_type_file)</span>
<a name="l00468"></a>00468 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00469"></a>00469 <span class="comment"> * Determine if a bucket is a PIPE bucket</span>
<a name="l00470"></a>00470 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00471"></a>00471 <span class="comment"> * @return true or false</span>
<a name="l00472"></a>00472 <span class="comment"> */</span>
<a name="l00473"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga03e62d86c994d1d1cc9be3eb8b8f6ac6">00473</a> <span class="preprocessor">#define APR_BUCKET_IS_PIPE(e)        ((e)-&gt;type == &amp;apr_bucket_type_pipe)</span>
<a name="l00474"></a>00474 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00475"></a>00475 <span class="comment"> * Determine if a bucket is a SOCKET bucket</span>
<a name="l00476"></a>00476 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00477"></a>00477 <span class="comment"> * @return true or false</span>
<a name="l00478"></a>00478 <span class="comment"> */</span>
<a name="l00479"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga4b8315b498e4eb67efde1c83bdbe8b87">00479</a> <span class="preprocessor">#define APR_BUCKET_IS_SOCKET(e)      ((e)-&gt;type == &amp;apr_bucket_type_socket)</span>
<a name="l00480"></a>00480 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00481"></a>00481 <span class="comment"> * Determine if a bucket is a HEAP bucket</span>
<a name="l00482"></a>00482 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00483"></a>00483 <span class="comment"> * @return true or false</span>
<a name="l00484"></a>00484 <span class="comment"> */</span>
<a name="l00485"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga3dee4fbd5b4e16e5188a6cfec40b6961">00485</a> <span class="preprocessor">#define APR_BUCKET_IS_HEAP(e)        ((e)-&gt;type == &amp;apr_bucket_type_heap)</span>
<a name="l00486"></a>00486 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00487"></a>00487 <span class="comment"> * Determine if a bucket is a TRANSIENT bucket</span>
<a name="l00488"></a>00488 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00489"></a>00489 <span class="comment"> * @return true or false</span>
<a name="l00490"></a>00490 <span class="comment"> */</span>
<a name="l00491"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga1a7e7ac5fddbab4ce189e8d3007446ff">00491</a> <span class="preprocessor">#define APR_BUCKET_IS_TRANSIENT(e)   ((e)-&gt;type == &amp;apr_bucket_type_transient)</span>
<a name="l00492"></a>00492 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00493"></a>00493 <span class="comment"> * Determine if a bucket is a IMMORTAL bucket</span>
<a name="l00494"></a>00494 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00495"></a>00495 <span class="comment"> * @return true or false</span>
<a name="l00496"></a>00496 <span class="comment"> */</span>
<a name="l00497"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga53f1188c168acf7dcfabfa1ac5a08655">00497</a> <span class="preprocessor">#define APR_BUCKET_IS_IMMORTAL(e)    ((e)-&gt;type == &amp;apr_bucket_type_immortal)</span>
<a name="l00498"></a>00498 <span class="preprocessor"></span><span class="preprocessor">#if APR_HAS_MMAP</span>
<a name="l00499"></a>00499 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00500"></a>00500 <span class="comment"> * Determine if a bucket is a MMAP bucket</span>
<a name="l00501"></a>00501 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00502"></a>00502 <span class="comment"> * @return true or false</span>
<a name="l00503"></a>00503 <span class="comment"> */</span>
<a name="l00504"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga1693d49aeb0287e3b171c922c6b633d2">00504</a> <span class="preprocessor">#define APR_BUCKET_IS_MMAP(e)        ((e)-&gt;type == &amp;apr_bucket_type_mmap)</span>
<a name="l00505"></a>00505 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00506"></a>00506 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l00507"></a>00507 <span class="comment"> * Determine if a bucket is a POOL bucket</span>
<a name="l00508"></a>00508 <span class="comment"> * @param e The bucket to inspect</span>
<a name="l00509"></a>00509 <span class="comment"> * @return true or false</span>
<a name="l00510"></a>00510 <span class="comment"> */</span>
<a name="l00511"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gadbe80a9016da6a06ab414ba61d6625d0">00511</a> <span class="preprocessor">#define APR_BUCKET_IS_POOL(e)        ((e)-&gt;type == &amp;apr_bucket_type_pool)</span>
<a name="l00512"></a>00512 <span class="preprocessor"></span>
<a name="l00513"></a>00513 <span class="comment">/*</span>
<a name="l00514"></a>00514 <span class="comment"> * General-purpose reference counting for the various bucket types.</span>
<a name="l00515"></a>00515 <span class="comment"> *</span>
<a name="l00516"></a>00516 <span class="comment"> * Any bucket type that keeps track of the resources it uses (i.e.</span>
<a name="l00517"></a>00517 <span class="comment"> * most of them except for IMMORTAL, TRANSIENT, and EOS) needs to</span>
<a name="l00518"></a>00518 <span class="comment"> * attach a reference count to the resource so that it can be freed</span>
<a name="l00519"></a>00519 <span class="comment"> * when the last bucket that uses it goes away. Resource-sharing may</span>
<a name="l00520"></a>00520 <span class="comment"> * occur because of bucket splits or buckets that refer to globally</span>
<a name="l00521"></a>00521 <span class="comment"> * cached data. */</span>
<a name="l00522"></a>00522 <span class="comment"></span>
<a name="l00523"></a>00523 <span class="comment">/** @see apr_bucket_refcount */</span>
<a name="l00524"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga785fd3402961b30315975b0c87c87706">00524</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__bucket__refcount.html">apr_bucket_refcount</a> <a class="code" href="structapr__bucket__refcount.html">apr_bucket_refcount</a>;<span class="comment"></span>
<a name="l00525"></a>00525 <span class="comment">/**</span>
<a name="l00526"></a>00526 <span class="comment"> * The structure used to manage the shared resource must start with an</span>
<a name="l00527"></a>00527 <span class="comment"> * apr_bucket_refcount which is updated by the general-purpose refcount</span>
<a name="l00528"></a>00528 <span class="comment"> * code. A pointer to the bucket-type-dependent private data structure</span>
<a name="l00529"></a>00529 <span class="comment"> * can be cast to a pointer to an apr_bucket_refcount and vice versa.</span>
<a name="l00530"></a>00530 <span class="comment"> */</span>
<a name="l00531"></a><a class="code" href="structapr__bucket__refcount.html">00531</a> <span class="keyword">struct </span><a class="code" href="structapr__bucket__refcount.html">apr_bucket_refcount</a> {<span class="comment"></span>
<a name="l00532"></a>00532 <span class="comment">    /** The number of references to this bucket */</span>
<a name="l00533"></a><a class="code" href="structapr__bucket__refcount.html#a75040af03e3ad3c722bccea1048e3dae">00533</a>     <span class="keywordtype">int</span>          <a class="code" href="structapr__bucket__refcount.html#a75040af03e3ad3c722bccea1048e3dae">refcount</a>;
<a name="l00534"></a>00534 };
<a name="l00535"></a>00535 
<a name="l00536"></a>00536 <span class="comment">/*  *****  Reference-counted bucket types  *****  */</span>
<a name="l00537"></a>00537 <span class="comment"></span>
<a name="l00538"></a>00538 <span class="comment">/** @see apr_bucket_heap */</span>
<a name="l00539"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gaede6e77d621d0f3f7d2685d489d01283">00539</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__bucket__heap.html">apr_bucket_heap</a> <a class="code" href="structapr__bucket__heap.html">apr_bucket_heap</a>;<span class="comment"></span>
<a name="l00540"></a>00540 <span class="comment">/**</span>
<a name="l00541"></a>00541 <span class="comment"> * A bucket referring to data allocated off the heap.</span>
<a name="l00542"></a>00542 <span class="comment"> */</span>
<a name="l00543"></a><a class="code" href="structapr__bucket__heap.html">00543</a> <span class="keyword">struct </span><a class="code" href="structapr__bucket__heap.html">apr_bucket_heap</a> {<span class="comment"></span>
<a name="l00544"></a>00544 <span class="comment">    /** Number of buckets using this memory */</span>
<a name="l00545"></a><a class="code" href="structapr__bucket__heap.html#ab87003dea25caef69aa3b30a1948024e">00545</a>     <a class="code" href="structapr__bucket__refcount.html">apr_bucket_refcount</a>  <a class="code" href="structapr__bucket__heap.html#ab87003dea25caef69aa3b30a1948024e">refcount</a>;<span class="comment"></span>
<a name="l00546"></a>00546 <span class="comment">    /** The start of the data actually allocated.  This should never be</span>
<a name="l00547"></a>00547 <span class="comment">     * modified, it is only used to free the bucket.</span>
<a name="l00548"></a>00548 <span class="comment">     */</span>
<a name="l00549"></a><a class="code" href="structapr__bucket__heap.html#ac6386e2f635c6af19075123749e1fa71">00549</a>     <span class="keywordtype">char</span>    *<a class="code" href="structapr__bucket__heap.html#ac6386e2f635c6af19075123749e1fa71">base</a>;<span class="comment"></span>
<a name="l00550"></a>00550 <span class="comment">    /** how much memory was allocated */</span>
<a name="l00551"></a><a class="code" href="structapr__bucket__heap.html#ae373dada96f2e005a6aaf80e41c4cf6d">00551</a>     apr_size_t  <a class="code" href="structapr__bucket__heap.html#ae373dada96f2e005a6aaf80e41c4cf6d">alloc_len</a>;<span class="comment"></span>
<a name="l00552"></a>00552 <span class="comment">    /** function to use to delete the data */</span>
<a name="l00553"></a><a class="code" href="structapr__bucket__heap.html#aac6fce0089a10b2b139c28edf9ad6fea">00553</a>     void (*free_func)(<span class="keywordtype">void</span> *data);
<a name="l00554"></a>00554 };
<a name="l00555"></a>00555 <span class="comment"></span>
<a name="l00556"></a>00556 <span class="comment">/** @see apr_bucket_pool */</span>
<a name="l00557"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga211e00d871029de148116cd24b070aed">00557</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__bucket__pool.html">apr_bucket_pool</a> <a class="code" href="structapr__bucket__pool.html">apr_bucket_pool</a>;<span class="comment"></span>
<a name="l00558"></a>00558 <span class="comment">/**</span>
<a name="l00559"></a>00559 <span class="comment"> * A bucket referring to data allocated from a pool</span>
<a name="l00560"></a>00560 <span class="comment"> */</span>
<a name="l00561"></a><a class="code" href="structapr__bucket__pool.html">00561</a> <span class="keyword">struct </span><a class="code" href="structapr__bucket__pool.html">apr_bucket_pool</a> {<span class="comment"></span>
<a name="l00562"></a>00562 <span class="comment">    /** The pool bucket must be able to be easily morphed to a heap</span>
<a name="l00563"></a>00563 <span class="comment">     * bucket if the pool gets cleaned up before all references are</span>
<a name="l00564"></a>00564 <span class="comment">     * destroyed.  This apr_bucket_heap structure is populated automatically</span>
<a name="l00565"></a>00565 <span class="comment">     * when the pool gets cleaned up, and subsequent calls to pool_read()</span>
<a name="l00566"></a>00566 <span class="comment">     * will result in the apr_bucket in question being morphed into a</span>
<a name="l00567"></a>00567 <span class="comment">     * regular heap bucket.  (To avoid having to do many extra refcount</span>
<a name="l00568"></a>00568 <span class="comment">     * manipulations and b-&gt;data manipulations, the apr_bucket_pool</span>
<a name="l00569"></a>00569 <span class="comment">     * struct actually *contains* the apr_bucket_heap struct that it</span>
<a name="l00570"></a>00570 <span class="comment">     * will become as its first element; the two share their</span>
<a name="l00571"></a>00571 <span class="comment">     * apr_bucket_refcount members.)</span>
<a name="l00572"></a>00572 <span class="comment">     */</span>
<a name="l00573"></a><a class="code" href="structapr__bucket__pool.html#a0fe0b0dedea28fb1ed0a1a0f42338225">00573</a>     <a class="code" href="structapr__bucket__heap.html">apr_bucket_heap</a>  <a class="code" href="structapr__bucket__pool.html#a0fe0b0dedea28fb1ed0a1a0f42338225">heap</a>;<span class="comment"></span>
<a name="l00574"></a>00574 <span class="comment">    /** The block of data actually allocated from the pool.</span>
<a name="l00575"></a>00575 <span class="comment">     * Segments of this block are referenced by adjusting</span>
<a name="l00576"></a>00576 <span class="comment">     * the start and length of the apr_bucket accordingly.</span>
<a name="l00577"></a>00577 <span class="comment">     * This will be NULL after the pool gets cleaned up.</span>
<a name="l00578"></a>00578 <span class="comment">     */</span>
<a name="l00579"></a><a class="code" href="structapr__bucket__pool.html#a9ee5297361ba548a20c3aa626a37c068">00579</a>     <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="structapr__bucket__pool.html#a9ee5297361ba548a20c3aa626a37c068">base</a>;<span class="comment"></span>
<a name="l00580"></a>00580 <span class="comment">    /** The pool the data was allocated from.  When the pool</span>
<a name="l00581"></a>00581 <span class="comment">     * is cleaned up, this gets set to NULL as an indicator</span>
<a name="l00582"></a>00582 <span class="comment">     * to pool_read() that the data is now on the heap and</span>
<a name="l00583"></a>00583 <span class="comment">     * so it should morph the bucket into a regular heap</span>
<a name="l00584"></a>00584 <span class="comment">     * bucket before continuing.</span>
<a name="l00585"></a>00585 <span class="comment">     */</span>
<a name="l00586"></a><a class="code" href="structapr__bucket__pool.html#af55591a1e7f3b097e7c271683bc80968">00586</a>     <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *<a class="code" href="structapr__bucket__pool.html#af55591a1e7f3b097e7c271683bc80968">pool</a>;<span class="comment"></span>
<a name="l00587"></a>00587 <span class="comment">    /** The freelist this structure was allocated from, which is</span>
<a name="l00588"></a>00588 <span class="comment">     * needed in the cleanup phase in order to allocate space on the heap</span>
<a name="l00589"></a>00589 <span class="comment">     */</span>
<a name="l00590"></a><a class="code" href="structapr__bucket__pool.html#a651aa0c18658342daf72ff86680bfaca">00590</a>     <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *<a class="code" href="structapr__bucket__pool.html#a651aa0c18658342daf72ff86680bfaca">list</a>;
<a name="l00591"></a>00591 };
<a name="l00592"></a>00592 
<a name="l00593"></a>00593 <span class="preprocessor">#if APR_HAS_MMAP</span>
<a name="l00594"></a>00594 <span class="preprocessor"></span><span class="comment">/** @see apr_bucket_mmap */</span>
<a name="l00595"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga27ede7c3a29627c7d184dc7cfbc4f767">00595</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__bucket__mmap.html">apr_bucket_mmap</a> <a class="code" href="structapr__bucket__mmap.html">apr_bucket_mmap</a>;<span class="comment"></span>
<a name="l00596"></a>00596 <span class="comment">/**</span>
<a name="l00597"></a>00597 <span class="comment"> * A bucket referring to an mmap()ed file</span>
<a name="l00598"></a>00598 <span class="comment"> */</span>
<a name="l00599"></a><a class="code" href="structapr__bucket__mmap.html">00599</a> <span class="keyword">struct </span><a class="code" href="structapr__bucket__mmap.html">apr_bucket_mmap</a> {<span class="comment"></span>
<a name="l00600"></a>00600 <span class="comment">    /** Number of buckets using this memory */</span>
<a name="l00601"></a><a class="code" href="structapr__bucket__mmap.html#a99f201622002479f4f84ea10598a013c">00601</a>     <a class="code" href="structapr__bucket__refcount.html">apr_bucket_refcount</a>  <a class="code" href="structapr__bucket__mmap.html#a99f201622002479f4f84ea10598a013c">refcount</a>;<span class="comment"></span>
<a name="l00602"></a>00602 <span class="comment">    /** The mmap this sub_bucket refers to */</span>
<a name="l00603"></a><a class="code" href="structapr__bucket__mmap.html#a66e9385752aaacb7fef7e96db62f1920">00603</a>     <a class="code" href="structapr__mmap__t.html">apr_mmap_t</a> *<a class="code" href="structapr__bucket__mmap.html#a66e9385752aaacb7fef7e96db62f1920">mmap</a>;
<a name="l00604"></a>00604 };
<a name="l00605"></a>00605 <span class="preprocessor">#endif</span>
<a name="l00606"></a>00606 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00607"></a>00607 <span class="comment">/** @see apr_bucket_file */</span>
<a name="l00608"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga1a786f7edac4d7a2c212f0fe74457b3d">00608</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__bucket__file.html">apr_bucket_file</a> <a class="code" href="structapr__bucket__file.html">apr_bucket_file</a>;<span class="comment"></span>
<a name="l00609"></a>00609 <span class="comment">/**</span>
<a name="l00610"></a>00610 <span class="comment"> * A bucket referring to an file</span>
<a name="l00611"></a>00611 <span class="comment"> */</span>
<a name="l00612"></a><a class="code" href="structapr__bucket__file.html">00612</a> <span class="keyword">struct </span><a class="code" href="structapr__bucket__file.html">apr_bucket_file</a> {<span class="comment"></span>
<a name="l00613"></a>00613 <span class="comment">    /** Number of buckets using this memory */</span>
<a name="l00614"></a><a class="code" href="structapr__bucket__file.html#ab0c123f34b85a07b601dc9794f8eed09">00614</a>     <a class="code" href="structapr__bucket__refcount.html">apr_bucket_refcount</a>  <a class="code" href="structapr__bucket__file.html#ab0c123f34b85a07b601dc9794f8eed09">refcount</a>;<span class="comment"></span>
<a name="l00615"></a>00615 <span class="comment">    /** The file this bucket refers to */</span>
<a name="l00616"></a><a class="code" href="structapr__bucket__file.html#aa43154c0bc9d41ba4b0762c906de432f">00616</a>     <a class="code" href="group__apr__file__io.html#gaa46e4763ac375ea3c7a43ba6f6099e22">apr_file_t</a> *<a class="code" href="structapr__bucket__file.html#aa43154c0bc9d41ba4b0762c906de432f">fd</a>;<span class="comment"></span>
<a name="l00617"></a>00617 <span class="comment">    /** The pool into which any needed structures should</span>
<a name="l00618"></a>00618 <span class="comment">     *  be created while reading from this file bucket */</span>
<a name="l00619"></a><a class="code" href="structapr__bucket__file.html#a61b5603482215f6c9ace7b26fa12b884">00619</a>     <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *<a class="code" href="structapr__bucket__file.html#a61b5603482215f6c9ace7b26fa12b884">readpool</a>;
<a name="l00620"></a>00620 <span class="preprocessor">#if APR_HAS_MMAP</span>
<a name="l00621"></a>00621 <span class="preprocessor"></span><span class="comment">    /** Whether this bucket should be memory-mapped if</span>
<a name="l00622"></a>00622 <span class="comment">     *  a caller tries to read from it */</span>
<a name="l00623"></a><a class="code" href="structapr__bucket__file.html#a7812a8d6e6f10d0095569f04d3423e83">00623</a>     <span class="keywordtype">int</span> <a class="code" href="structapr__bucket__file.html#a7812a8d6e6f10d0095569f04d3423e83">can_mmap</a>;
<a name="l00624"></a>00624 <span class="preprocessor">#endif </span><span class="comment">/* APR_HAS_MMAP */</span>
<a name="l00625"></a>00625 };
<a name="l00626"></a>00626 <span class="comment"></span>
<a name="l00627"></a>00627 <span class="comment">/** @see apr_bucket_structs */</span>
<a name="l00628"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga3c0929c971f94de4521fb0fea6fd3209">00628</a> <span class="keyword">typedef</span> <span class="keyword">union </span><a class="code" href="unionapr__bucket__structs.html">apr_bucket_structs</a> <a class="code" href="unionapr__bucket__structs.html">apr_bucket_structs</a>;<span class="comment"></span>
<a name="l00629"></a>00629 <span class="comment">/**</span>
<a name="l00630"></a>00630 <span class="comment"> * A union of all bucket structures so we know what</span>
<a name="l00631"></a>00631 <span class="comment"> * the max size is.</span>
<a name="l00632"></a>00632 <span class="comment"> */</span>
<a name="l00633"></a><a class="code" href="unionapr__bucket__structs.html">00633</a> <span class="keyword">union </span><a class="code" href="unionapr__bucket__structs.html">apr_bucket_structs</a> {
<a name="l00634"></a><a class="code" href="unionapr__bucket__structs.html#a840c42a20727de2e4534ca05f1f6c990">00634</a>     <a class="code" href="structapr__bucket.html">apr_bucket</a>      <a class="code" href="unionapr__bucket__structs.html#a840c42a20727de2e4534ca05f1f6c990">b</a>;      <span class="comment">/**&lt; Bucket */</span>
<a name="l00635"></a><a class="code" href="unionapr__bucket__structs.html#a5335dc82d8250e511a9c55e5fea97141">00635</a>     <a class="code" href="structapr__bucket__heap.html">apr_bucket_heap</a> <a class="code" href="unionapr__bucket__structs.html#a5335dc82d8250e511a9c55e5fea97141">heap</a>;   <span class="comment">/**&lt; Heap */</span>
<a name="l00636"></a><a class="code" href="unionapr__bucket__structs.html#ab926fe2af7c1780c03bf1669766db4a1">00636</a>     <a class="code" href="structapr__bucket__pool.html">apr_bucket_pool</a> <a class="code" href="unionapr__bucket__structs.html#ab926fe2af7c1780c03bf1669766db4a1">pool</a>;   <span class="comment">/**&lt; Pool */</span>
<a name="l00637"></a>00637 <span class="preprocessor">#if APR_HAS_MMAP</span>
<a name="l00638"></a><a class="code" href="unionapr__bucket__structs.html#a627c4ca697f06bbf4226c8c2acd93cbc">00638</a> <span class="preprocessor"></span>    <a class="code" href="structapr__bucket__mmap.html">apr_bucket_mmap</a> <a class="code" href="unionapr__bucket__structs.html#a627c4ca697f06bbf4226c8c2acd93cbc">mmap</a>;   <span class="comment">/**&lt; MMap */</span>
<a name="l00639"></a>00639 <span class="preprocessor">#endif</span>
<a name="l00640"></a><a class="code" href="unionapr__bucket__structs.html#ab339255acdf750133759a0d67b3f2e30">00640</a> <span class="preprocessor"></span>    <a class="code" href="structapr__bucket__file.html">apr_bucket_file</a> <a class="code" href="unionapr__bucket__structs.html#ab339255acdf750133759a0d67b3f2e30">file</a>;   <span class="comment">/**&lt; File */</span>
<a name="l00641"></a>00641 };
<a name="l00642"></a>00642 <span class="comment"></span>
<a name="l00643"></a>00643 <span class="comment">/**</span>
<a name="l00644"></a>00644 <span class="comment"> * The amount that apr_bucket_alloc() should allocate in the common case.</span>
<a name="l00645"></a>00645 <span class="comment"> * Note: this is twice as big as apr_bucket_structs to allow breathing</span>
<a name="l00646"></a>00646 <span class="comment"> * room for third-party bucket types.</span>
<a name="l00647"></a>00647 <span class="comment"> */</span>
<a name="l00648"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gae3ccf4c383c9e7fea28354cc8e029626">00648</a> <span class="preprocessor">#define APR_BUCKET_ALLOC_SIZE  APR_ALIGN_DEFAULT(2*sizeof(apr_bucket_structs))</span>
<a name="l00649"></a>00649 <span class="preprocessor"></span>
<a name="l00650"></a>00650 <span class="comment">/*  *****  Bucket Brigade Functions  *****  */</span><span class="comment"></span>
<a name="l00651"></a>00651 <span class="comment">/**</span>
<a name="l00652"></a>00652 <span class="comment"> * Create a new bucket brigade.  The bucket brigade is originally empty.</span>
<a name="l00653"></a>00653 <span class="comment"> * @param p The pool to associate with the brigade.  Data is not allocated out</span>
<a name="l00654"></a>00654 <span class="comment"> *          of the pool, but a cleanup is registered.</span>
<a name="l00655"></a>00655 <span class="comment"> * @param list The bucket allocator to use</span>
<a name="l00656"></a>00656 <span class="comment"> * @return The empty bucket brigade</span>
<a name="l00657"></a>00657 <span class="comment"> */</span>
<a name="l00658"></a>00658 APU_DECLARE(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gaeb422371006699c68f0ed3b496cc12a2">apr_brigade_create</a>(<a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *<a class="code" href="structapr__bucket__brigade.html#a8e03b4dd531903709ae3ae8ebe9e46ee">p</a>,
<a name="l00659"></a>00659                                                      <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l00660"></a>00660 <span class="comment"></span>
<a name="l00661"></a>00661 <span class="comment">/**</span>
<a name="l00662"></a>00662 <span class="comment"> * destroy an entire bucket brigade.  This includes destroying all of the</span>
<a name="l00663"></a>00663 <span class="comment"> * buckets within the bucket brigade&#39;s bucket list. </span>
<a name="l00664"></a>00664 <span class="comment"> * @param b The bucket brigade to destroy</span>
<a name="l00665"></a>00665 <span class="comment"> */</span>
<a name="l00666"></a>00666 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga2eba1e262dece0d4444ddd25ae7b250a">apr_brigade_destroy</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b);
<a name="l00667"></a>00667 <span class="comment"></span>
<a name="l00668"></a>00668 <span class="comment">/**</span>
<a name="l00669"></a>00669 <span class="comment"> * empty out an entire bucket brigade.  This includes destroying all of the</span>
<a name="l00670"></a>00670 <span class="comment"> * buckets within the bucket brigade&#39;s bucket list.  This is similar to</span>
<a name="l00671"></a>00671 <span class="comment"> * apr_brigade_destroy(), except that it does not deregister the brigade&#39;s</span>
<a name="l00672"></a>00672 <span class="comment"> * pool cleanup function.</span>
<a name="l00673"></a>00673 <span class="comment"> * @param data The bucket brigade to clean up</span>
<a name="l00674"></a>00674 <span class="comment"> * @remark Generally, you should use apr_brigade_destroy().  This function</span>
<a name="l00675"></a>00675 <span class="comment"> *         can be useful in situations where you have a single brigade that</span>
<a name="l00676"></a>00676 <span class="comment"> *         you wish to reuse many times by destroying all of the buckets in</span>
<a name="l00677"></a>00677 <span class="comment"> *         the brigade and putting new buckets into it later.</span>
<a name="l00678"></a>00678 <span class="comment"> */</span>
<a name="l00679"></a>00679 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gafd6a8378a15e8b42a57a5923a03de7f2">apr_brigade_cleanup</a>(<span class="keywordtype">void</span> *data);
<a name="l00680"></a>00680 <span class="comment"></span>
<a name="l00681"></a>00681 <span class="comment">/**</span>
<a name="l00682"></a>00682 <span class="comment"> * Move the buckets from the tail end of the existing brigade @a b into</span>
<a name="l00683"></a>00683 <span class="comment"> * the brigade @a a. If @a a is NULL a new brigade is created. Buckets</span>
<a name="l00684"></a>00684 <span class="comment"> * from @a e to the last bucket (inclusively) of brigade @a b are moved</span>
<a name="l00685"></a>00685 <span class="comment"> * from @a b to the returned brigade @a a.</span>
<a name="l00686"></a>00686 <span class="comment"> *</span>
<a name="l00687"></a>00687 <span class="comment"> * @param b The brigade to split</span>
<a name="l00688"></a>00688 <span class="comment"> * @param e The first bucket to move</span>
<a name="l00689"></a>00689 <span class="comment"> * @param a The brigade which should be used for the result or NULL if</span>
<a name="l00690"></a>00690 <span class="comment"> *          a new brigade should be created.</span>
<a name="l00691"></a>00691 <span class="comment"> * @return The brigade supplied in @param a or a new one if @param a was NULL.</span>
<a name="l00692"></a>00692 <span class="comment"> * @warning Note that this function allocates a new brigade if @param a is</span>
<a name="l00693"></a>00693 <span class="comment"> * NULL so memory consumption should be carefully considered.</span>
<a name="l00694"></a>00694 <span class="comment"> */</span>
<a name="l00695"></a>00695 APU_DECLARE(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga36448fa89ab3239fd46591fbc82624e6">apr_brigade_split_ex</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b,
<a name="l00696"></a>00696                                                        <a class="code" href="structapr__bucket.html">apr_bucket</a> *e,
<a name="l00697"></a>00697                                                        <a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *a);
<a name="l00698"></a>00698 <span class="comment"></span>
<a name="l00699"></a>00699 <span class="comment">/**</span>
<a name="l00700"></a>00700 <span class="comment"> * Create a new bucket brigade and move the buckets from the tail end</span>
<a name="l00701"></a>00701 <span class="comment"> * of an existing brigade into the new brigade.  Buckets from </span>
<a name="l00702"></a>00702 <span class="comment"> * @param e to the last bucket (inclusively) of brigade @param b</span>
<a name="l00703"></a>00703 <span class="comment"> * are moved from @param b to the returned brigade.</span>
<a name="l00704"></a>00704 <span class="comment"> * @param b The brigade to split </span>
<a name="l00705"></a>00705 <span class="comment"> * @param e The first bucket to move</span>
<a name="l00706"></a>00706 <span class="comment"> * @return The new brigade</span>
<a name="l00707"></a>00707 <span class="comment"> * @warning Note that this function always allocates a new brigade</span>
<a name="l00708"></a>00708 <span class="comment"> * so memory consumption should be carefully considered.</span>
<a name="l00709"></a>00709 <span class="comment"> */</span>
<a name="l00710"></a>00710 APU_DECLARE(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacaf2929f951920a464e170baf2b4c345">apr_brigade_split</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b,
<a name="l00711"></a>00711                                                     <a class="code" href="structapr__bucket.html">apr_bucket</a> *e);
<a name="l00712"></a>00712 <span class="comment"></span>
<a name="l00713"></a>00713 <span class="comment">/**</span>
<a name="l00714"></a>00714 <span class="comment"> * Partition a bucket brigade at a given offset (in bytes from the start of</span>
<a name="l00715"></a>00715 <span class="comment"> * the brigade).  This is useful whenever a filter wants to use known ranges</span>
<a name="l00716"></a>00716 <span class="comment"> * of bytes from the brigade; the ranges can even overlap.</span>
<a name="l00717"></a>00717 <span class="comment"> * @param b The brigade to partition</span>
<a name="l00718"></a>00718 <span class="comment"> * @param point The offset at which to partition the brigade</span>
<a name="l00719"></a>00719 <span class="comment"> * @param after_point Returns a pointer to the first bucket after the partition</span>
<a name="l00720"></a>00720 <span class="comment"> * @return APR_SUCCESS on success, APR_INCOMPLETE if the contents of the</span>
<a name="l00721"></a>00721 <span class="comment"> * brigade were shorter than @a point, or an error code.</span>
<a name="l00722"></a>00722 <span class="comment"> * @remark if APR_INCOMPLETE is returned, @a after_point will be set to</span>
<a name="l00723"></a>00723 <span class="comment"> * the brigade sentinel.</span>
<a name="l00724"></a>00724 <span class="comment"> */</span>
<a name="l00725"></a>00725 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga4b2f22ba70ac9f65788014c61d4f5b76">apr_brigade_partition</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b,
<a name="l00726"></a>00726                                                 apr_off_t point,
<a name="l00727"></a>00727                                                 <a class="code" href="structapr__bucket.html">apr_bucket</a> **after_point);
<a name="l00728"></a>00728 <span class="comment"></span>
<a name="l00729"></a>00729 <span class="comment">/**</span>
<a name="l00730"></a>00730 <span class="comment"> * Return the total length of the brigade.</span>
<a name="l00731"></a>00731 <span class="comment"> * @param bb The brigade to compute the length of</span>
<a name="l00732"></a>00732 <span class="comment"> * @param read_all Read unknown-length buckets to force a size</span>
<a name="l00733"></a>00733 <span class="comment"> * @param length Returns the length of the brigade (up to the end, or up</span>
<a name="l00734"></a>00734 <span class="comment"> *               to a bucket read error), or -1 if the brigade has buckets</span>
<a name="l00735"></a>00735 <span class="comment"> *               of indeterminate length and read_all is 0.</span>
<a name="l00736"></a>00736 <span class="comment"> */</span>
<a name="l00737"></a>00737 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga65075839e31fd85e2c80717f4e9e0461">apr_brigade_length</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *bb,
<a name="l00738"></a>00738                                              <span class="keywordtype">int</span> read_all,
<a name="l00739"></a>00739                                              apr_off_t *length);
<a name="l00740"></a>00740 <span class="comment"></span>
<a name="l00741"></a>00741 <span class="comment">/**</span>
<a name="l00742"></a>00742 <span class="comment"> * Take a bucket brigade and store the data in a flat char*</span>
<a name="l00743"></a>00743 <span class="comment"> * @param bb The bucket brigade to create the char* from</span>
<a name="l00744"></a>00744 <span class="comment"> * @param c The char* to write into</span>
<a name="l00745"></a>00745 <span class="comment"> * @param len The maximum length of the char array. On return, it is the</span>
<a name="l00746"></a>00746 <span class="comment"> *            actual length of the char array.</span>
<a name="l00747"></a>00747 <span class="comment"> */</span>
<a name="l00748"></a>00748 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga301aeb943e68ef4b99c1ae6a18dcf78e">apr_brigade_flatten</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *bb,
<a name="l00749"></a>00749                                               <span class="keywordtype">char</span> *c,
<a name="l00750"></a>00750                                               apr_size_t *len);
<a name="l00751"></a>00751 <span class="comment"></span>
<a name="l00752"></a>00752 <span class="comment">/**</span>
<a name="l00753"></a>00753 <span class="comment"> * Creates a pool-allocated string representing a flat bucket brigade</span>
<a name="l00754"></a>00754 <span class="comment"> * @param bb The bucket brigade to create the char array from</span>
<a name="l00755"></a>00755 <span class="comment"> * @param c On return, the allocated char array</span>
<a name="l00756"></a>00756 <span class="comment"> * @param len On return, the length of the char array.</span>
<a name="l00757"></a>00757 <span class="comment"> * @param pool The pool to allocate the string from.</span>
<a name="l00758"></a>00758 <span class="comment"> */</span>
<a name="l00759"></a>00759 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gaa5da970af09d1a87e020db054f2d1c94">apr_brigade_pflatten</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *bb, 
<a name="l00760"></a>00760                                                <span class="keywordtype">char</span> **c,
<a name="l00761"></a>00761                                                apr_size_t *len,
<a name="l00762"></a>00762                                                <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *pool);
<a name="l00763"></a>00763 <span class="comment"></span>
<a name="l00764"></a>00764 <span class="comment">/**</span>
<a name="l00765"></a>00765 <span class="comment"> * Split a brigade to represent one LF line.</span>
<a name="l00766"></a>00766 <span class="comment"> * @param bbOut The bucket brigade that will have the LF line appended to.</span>
<a name="l00767"></a>00767 <span class="comment"> * @param bbIn The input bucket brigade to search for a LF-line.</span>
<a name="l00768"></a>00768 <span class="comment"> * @param block The blocking mode to be used to split the line.</span>
<a name="l00769"></a>00769 <span class="comment"> * @param maxbytes The maximum bytes to read.  If this many bytes are seen</span>
<a name="l00770"></a>00770 <span class="comment"> *                 without a LF, the brigade will contain a partial line.</span>
<a name="l00771"></a>00771 <span class="comment"> */</span>
<a name="l00772"></a>00772 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga257dece60dbdc910bc09e1fc0d7db622">apr_brigade_split_line</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *bbOut,
<a name="l00773"></a>00773                                                  <a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *bbIn,
<a name="l00774"></a>00774                                                  <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga756973fb6392bd1026c3d96b4519776d">apr_read_type_e</a> block,
<a name="l00775"></a>00775                                                  apr_off_t maxbytes);
<a name="l00776"></a>00776 <span class="comment"></span>
<a name="l00777"></a>00777 <span class="comment">/**</span>
<a name="l00778"></a>00778 <span class="comment"> * Create an iovec of the elements in a bucket_brigade... return number </span>
<a name="l00779"></a>00779 <span class="comment"> * of elements used.  This is useful for writing to a file or to the</span>
<a name="l00780"></a>00780 <span class="comment"> * network efficiently.</span>
<a name="l00781"></a>00781 <span class="comment"> * @param b The bucket brigade to create the iovec from</span>
<a name="l00782"></a>00782 <span class="comment"> * @param vec The iovec to create</span>
<a name="l00783"></a>00783 <span class="comment"> * @param nvec The number of elements in the iovec. On return, it is the</span>
<a name="l00784"></a>00784 <span class="comment"> *             number of iovec elements actually filled out.</span>
<a name="l00785"></a>00785 <span class="comment"> */</span>
<a name="l00786"></a>00786 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga904bdc4a9a9c800d2d2b20b4ddefa6f7">apr_brigade_to_iovec</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b, 
<a name="l00787"></a>00787                                                struct iovec *vec, <span class="keywordtype">int</span> *nvec);
<a name="l00788"></a>00788 <span class="comment"></span>
<a name="l00789"></a>00789 <span class="comment">/**</span>
<a name="l00790"></a>00790 <span class="comment"> * This function writes a list of strings into a bucket brigade. </span>
<a name="l00791"></a>00791 <span class="comment"> * @param b The bucket brigade to add to</span>
<a name="l00792"></a>00792 <span class="comment"> * @param flush The flush function to use if the brigade is full</span>
<a name="l00793"></a>00793 <span class="comment"> * @param ctx The structure to pass to the flush function</span>
<a name="l00794"></a>00794 <span class="comment"> * @param va A list of strings to add</span>
<a name="l00795"></a>00795 <span class="comment"> * @return APR_SUCCESS or error code.</span>
<a name="l00796"></a>00796 <span class="comment"> */</span>
<a name="l00797"></a>00797 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga382871c1aec5cf9fbbcf19d67cff6b43">apr_brigade_vputstrs</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b,
<a name="l00798"></a>00798                                                <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacdf6dc9d4c81c64834e5e509281f7f16">apr_brigade_flush</a> flush,
<a name="l00799"></a>00799                                                <span class="keywordtype">void</span> *ctx,
<a name="l00800"></a>00800                                                va_list va);
<a name="l00801"></a>00801 <span class="comment"></span>
<a name="l00802"></a>00802 <span class="comment">/**</span>
<a name="l00803"></a>00803 <span class="comment"> * This function writes a string into a bucket brigade.</span>
<a name="l00804"></a>00804 <span class="comment"> * @param b The bucket brigade to add to</span>
<a name="l00805"></a>00805 <span class="comment"> * @param flush The flush function to use if the brigade is full</span>
<a name="l00806"></a>00806 <span class="comment"> * @param ctx The structure to pass to the flush function</span>
<a name="l00807"></a>00807 <span class="comment"> * @param str The string to add</span>
<a name="l00808"></a>00808 <span class="comment"> * @param nbyte The number of bytes to write</span>
<a name="l00809"></a>00809 <span class="comment"> * @return APR_SUCCESS or error code</span>
<a name="l00810"></a>00810 <span class="comment"> */</span>
<a name="l00811"></a>00811 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga7242dae50995fc1a9174476ca3053d99">apr_brigade_write</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b,
<a name="l00812"></a>00812                                             <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacdf6dc9d4c81c64834e5e509281f7f16">apr_brigade_flush</a> flush, <span class="keywordtype">void</span> *ctx,
<a name="l00813"></a>00813                                             const <span class="keywordtype">char</span> *str, apr_size_t nbyte);
<a name="l00814"></a>00814 <span class="comment"></span>
<a name="l00815"></a>00815 <span class="comment">/**</span>
<a name="l00816"></a>00816 <span class="comment"> * This function writes multiple strings into a bucket brigade.</span>
<a name="l00817"></a>00817 <span class="comment"> * @param b The bucket brigade to add to</span>
<a name="l00818"></a>00818 <span class="comment"> * @param flush The flush function to use if the brigade is full</span>
<a name="l00819"></a>00819 <span class="comment"> * @param ctx The structure to pass to the flush function</span>
<a name="l00820"></a>00820 <span class="comment"> * @param vec The strings to add (address plus length for each)</span>
<a name="l00821"></a>00821 <span class="comment"> * @param nvec The number of entries in iovec</span>
<a name="l00822"></a>00822 <span class="comment"> * @return APR_SUCCESS or error code</span>
<a name="l00823"></a>00823 <span class="comment"> */</span>
<a name="l00824"></a>00824 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gafc116a4359b717cd3a78a19ddf169486">apr_brigade_writev</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b,
<a name="l00825"></a>00825                                              <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacdf6dc9d4c81c64834e5e509281f7f16">apr_brigade_flush</a> flush,
<a name="l00826"></a>00826                                              <span class="keywordtype">void</span> *ctx,
<a name="l00827"></a>00827                                              const struct iovec *vec,
<a name="l00828"></a>00828                                              apr_size_t nvec);
<a name="l00829"></a>00829 <span class="comment"></span>
<a name="l00830"></a>00830 <span class="comment">/**</span>
<a name="l00831"></a>00831 <span class="comment"> * This function writes a string into a bucket brigade.</span>
<a name="l00832"></a>00832 <span class="comment"> * @param bb The bucket brigade to add to</span>
<a name="l00833"></a>00833 <span class="comment"> * @param flush The flush function to use if the brigade is full</span>
<a name="l00834"></a>00834 <span class="comment"> * @param ctx The structure to pass to the flush function</span>
<a name="l00835"></a>00835 <span class="comment"> * @param str The string to add</span>
<a name="l00836"></a>00836 <span class="comment"> * @return APR_SUCCESS or error code</span>
<a name="l00837"></a>00837 <span class="comment"> */</span>
<a name="l00838"></a>00838 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga2d1fed26db94e3006223098737a06f5a">apr_brigade_puts</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *bb,
<a name="l00839"></a>00839                                            <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacdf6dc9d4c81c64834e5e509281f7f16">apr_brigade_flush</a> flush, <span class="keywordtype">void</span> *ctx,
<a name="l00840"></a>00840                                            const <span class="keywordtype">char</span> *str);
<a name="l00841"></a>00841 <span class="comment"></span>
<a name="l00842"></a>00842 <span class="comment">/**</span>
<a name="l00843"></a>00843 <span class="comment"> * This function writes a character into a bucket brigade.</span>
<a name="l00844"></a>00844 <span class="comment"> * @param b The bucket brigade to add to</span>
<a name="l00845"></a>00845 <span class="comment"> * @param flush The flush function to use if the brigade is full</span>
<a name="l00846"></a>00846 <span class="comment"> * @param ctx The structure to pass to the flush function</span>
<a name="l00847"></a>00847 <span class="comment"> * @param c The character to add</span>
<a name="l00848"></a>00848 <span class="comment"> * @return APR_SUCCESS or error code</span>
<a name="l00849"></a>00849 <span class="comment"> */</span>
<a name="l00850"></a>00850 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga362999cb255297fd0fd433f03236302d">apr_brigade_putc</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b,
<a name="l00851"></a>00851                                            <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacdf6dc9d4c81c64834e5e509281f7f16">apr_brigade_flush</a> flush, <span class="keywordtype">void</span> *ctx,
<a name="l00852"></a>00852                                            const <span class="keywordtype">char</span> c);
<a name="l00853"></a>00853 <span class="comment"></span>
<a name="l00854"></a>00854 <span class="comment">/**</span>
<a name="l00855"></a>00855 <span class="comment"> * This function writes an unspecified number of strings into a bucket brigade.</span>
<a name="l00856"></a>00856 <span class="comment"> * @param b The bucket brigade to add to</span>
<a name="l00857"></a>00857 <span class="comment"> * @param flush The flush function to use if the brigade is full</span>
<a name="l00858"></a>00858 <span class="comment"> * @param ctx The structure to pass to the flush function</span>
<a name="l00859"></a>00859 <span class="comment"> * @param ... The strings to add</span>
<a name="l00860"></a>00860 <span class="comment"> * @return APR_SUCCESS or error code</span>
<a name="l00861"></a>00861 <span class="comment"> */</span>
<a name="l00862"></a>00862 APU_DECLARE_NONSTD(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga1f27949d92196cbf150b7d6256cbf4b7">apr_brigade_putstrs</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b,
<a name="l00863"></a>00863                                                      <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacdf6dc9d4c81c64834e5e509281f7f16">apr_brigade_flush</a> flush,
<a name="l00864"></a>00864                                                      <span class="keywordtype">void</span> *ctx, ...);
<a name="l00865"></a>00865 <span class="comment"></span>
<a name="l00866"></a>00866 <span class="comment">/**</span>
<a name="l00867"></a>00867 <span class="comment"> * Evaluate a printf and put the resulting string at the end </span>
<a name="l00868"></a>00868 <span class="comment"> * of the bucket brigade.</span>
<a name="l00869"></a>00869 <span class="comment"> * @param b The brigade to write to</span>
<a name="l00870"></a>00870 <span class="comment"> * @param flush The flush function to use if the brigade is full</span>
<a name="l00871"></a>00871 <span class="comment"> * @param ctx The structure to pass to the flush function</span>
<a name="l00872"></a>00872 <span class="comment"> * @param fmt The format of the string to write</span>
<a name="l00873"></a>00873 <span class="comment"> * @param ... The arguments to fill out the format</span>
<a name="l00874"></a>00874 <span class="comment"> * @return APR_SUCCESS or error code</span>
<a name="l00875"></a>00875 <span class="comment"> */</span>
<a name="l00876"></a>00876 APU_DECLARE_NONSTD(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga4120ba3834c545db3b9229d858e33b47">apr_brigade_printf</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b, 
<a name="l00877"></a>00877                                                     <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacdf6dc9d4c81c64834e5e509281f7f16">apr_brigade_flush</a> flush,
<a name="l00878"></a>00878                                                     <span class="keywordtype">void</span> *ctx,
<a name="l00879"></a>00879                                                     const <span class="keywordtype">char</span> *fmt, ...)
<a name="l00880"></a>00880         __attribute__((format(printf,4,5)));
<a name="l00881"></a>00881 <span class="comment"></span>
<a name="l00882"></a>00882 <span class="comment">/**</span>
<a name="l00883"></a>00883 <span class="comment"> * Evaluate a printf and put the resulting string at the end </span>
<a name="l00884"></a>00884 <span class="comment"> * of the bucket brigade.</span>
<a name="l00885"></a>00885 <span class="comment"> * @param b The brigade to write to</span>
<a name="l00886"></a>00886 <span class="comment"> * @param flush The flush function to use if the brigade is full</span>
<a name="l00887"></a>00887 <span class="comment"> * @param ctx The structure to pass to the flush function</span>
<a name="l00888"></a>00888 <span class="comment"> * @param fmt The format of the string to write</span>
<a name="l00889"></a>00889 <span class="comment"> * @param va The arguments to fill out the format</span>
<a name="l00890"></a>00890 <span class="comment"> * @return APR_SUCCESS or error code</span>
<a name="l00891"></a>00891 <span class="comment"> */</span>
<a name="l00892"></a>00892 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9e1af8c10946264e1bb37a3f56e4bfd8">apr_brigade_vprintf</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *b, 
<a name="l00893"></a>00893                                               <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacdf6dc9d4c81c64834e5e509281f7f16">apr_brigade_flush</a> flush,
<a name="l00894"></a>00894                                               <span class="keywordtype">void</span> *ctx,
<a name="l00895"></a>00895                                               const <span class="keywordtype">char</span> *fmt, va_list va);
<a name="l00896"></a>00896 <span class="comment"></span>
<a name="l00897"></a>00897 <span class="comment">/**</span>
<a name="l00898"></a>00898 <span class="comment"> * Utility function to insert a file (or a segment of a file) onto the</span>
<a name="l00899"></a>00899 <span class="comment"> * end of the brigade.  The file is split into multiple buckets if it</span>
<a name="l00900"></a>00900 <span class="comment"> * is larger than the maximum size which can be represented by a</span>
<a name="l00901"></a>00901 <span class="comment"> * single bucket.</span>
<a name="l00902"></a>00902 <span class="comment"> * @param bb the brigade to insert into</span>
<a name="l00903"></a>00903 <span class="comment"> * @param f the file to insert</span>
<a name="l00904"></a>00904 <span class="comment"> * @param start the offset of the start of the segment</span>
<a name="l00905"></a>00905 <span class="comment"> * @param len the length of the segment of the file to insert</span>
<a name="l00906"></a>00906 <span class="comment"> * @param p pool from which file buckets are allocated</span>
<a name="l00907"></a>00907 <span class="comment"> * @return the last bucket inserted</span>
<a name="l00908"></a>00908 <span class="comment"> */</span>
<a name="l00909"></a>00909 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga7c4981f7050333a181e440e753c20555">apr_brigade_insert_file</a>(<a class="code" href="structapr__bucket__brigade.html">apr_bucket_brigade</a> *bb,
<a name="l00910"></a>00910                                                   <a class="code" href="group__apr__file__io.html#gaa46e4763ac375ea3c7a43ba6f6099e22">apr_file_t</a> *f,
<a name="l00911"></a>00911                                                   apr_off_t start,
<a name="l00912"></a>00912                                                   apr_off_t len,
<a name="l00913"></a>00913                                                   <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *p);
<a name="l00914"></a>00914 
<a name="l00915"></a>00915 
<a name="l00916"></a>00916 
<a name="l00917"></a>00917 <span class="comment">/*  *****  Bucket freelist functions *****  */</span><span class="comment"></span>
<a name="l00918"></a>00918 <span class="comment">/**</span>
<a name="l00919"></a>00919 <span class="comment"> * Create a bucket allocator.</span>
<a name="l00920"></a>00920 <span class="comment"> * @param p This pool&#39;s underlying apr_allocator_t is used to allocate memory</span>
<a name="l00921"></a>00921 <span class="comment"> *          for the bucket allocator.  When the pool is destroyed, the bucket</span>
<a name="l00922"></a>00922 <span class="comment"> *          allocator&#39;s cleanup routine will free all memory that has been</span>
<a name="l00923"></a>00923 <span class="comment"> *          allocated from it.</span>
<a name="l00924"></a>00924 <span class="comment"> * @remark  The reason the allocator gets its memory from the pool&#39;s</span>
<a name="l00925"></a>00925 <span class="comment"> *          apr_allocator_t rather than from the pool itself is because</span>
<a name="l00926"></a>00926 <span class="comment"> *          the bucket allocator will free large memory blocks back to the</span>
<a name="l00927"></a>00927 <span class="comment"> *          allocator when it&#39;s done with them, thereby preventing memory</span>
<a name="l00928"></a>00928 <span class="comment"> *          footprint growth that would occur if we allocated from the pool.</span>
<a name="l00929"></a>00929 <span class="comment"> * @warning The allocator must never be used by more than one thread at a time.</span>
<a name="l00930"></a>00930 <span class="comment"> */</span>
<a name="l00931"></a>00931 APU_DECLARE_NONSTD(<a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga2d96fa729a17a86dc5221958e8c13c96">apr_bucket_alloc_create</a>(<a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *p);
<a name="l00932"></a>00932 <span class="comment"></span>
<a name="l00933"></a>00933 <span class="comment">/**</span>
<a name="l00934"></a>00934 <span class="comment"> * Create a bucket allocator.</span>
<a name="l00935"></a>00935 <span class="comment"> * @param allocator This apr_allocator_t is used to allocate both the bucket</span>
<a name="l00936"></a>00936 <span class="comment"> *          allocator and all memory handed out by the bucket allocator.  The</span>
<a name="l00937"></a>00937 <span class="comment"> *          caller is responsible for destroying the bucket allocator and the</span>
<a name="l00938"></a>00938 <span class="comment"> *          apr_allocator_t -- no automatic cleanups will happen.</span>
<a name="l00939"></a>00939 <span class="comment"> * @warning The allocator must never be used by more than one thread at a time.</span>
<a name="l00940"></a>00940 <span class="comment"> */</span>
<a name="l00941"></a>00941 APU_DECLARE_NONSTD(<a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga252642139099350d0b987889d5c0868c">apr_bucket_alloc_create_ex</a>(<a class="code" href="group__apr__allocator.html#ga1ceabfd30fcfc455e47d052d2a24244b">apr_allocator_t</a> *allocator);
<a name="l00942"></a>00942 <span class="comment"></span>
<a name="l00943"></a>00943 <span class="comment">/**</span>
<a name="l00944"></a>00944 <span class="comment"> * Destroy a bucket allocator.</span>
<a name="l00945"></a>00945 <span class="comment"> * @param list The allocator to be destroyed</span>
<a name="l00946"></a>00946 <span class="comment"> */</span>
<a name="l00947"></a>00947 APU_DECLARE_NONSTD(<span class="keywordtype">void</span>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gaf5eb58cc232851c8449ba1d98d049a0a">apr_bucket_alloc_destroy</a>(<a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l00948"></a>00948 <span class="comment"></span>
<a name="l00949"></a>00949 <span class="comment">/**</span>
<a name="l00950"></a>00950 <span class="comment"> * Allocate memory for use by the buckets.</span>
<a name="l00951"></a>00951 <span class="comment"> * @param size The amount to allocate.</span>
<a name="l00952"></a>00952 <span class="comment"> * @param list The allocator from which to allocate the memory.</span>
<a name="l00953"></a>00953 <span class="comment"> */</span>
<a name="l00954"></a>00954 APU_DECLARE_NONSTD(<span class="keywordtype">void</span> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gae47c2235a3740432f4a0990fccfe4102">apr_bucket_alloc</a>(apr_size_t size, <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l00955"></a>00955 <span class="comment"></span>
<a name="l00956"></a>00956 <span class="comment">/**</span>
<a name="l00957"></a>00957 <span class="comment"> * Free memory previously allocated with apr_bucket_alloc().</span>
<a name="l00958"></a>00958 <span class="comment"> * @param block The block of memory to be freed.</span>
<a name="l00959"></a>00959 <span class="comment"> */</span>
<a name="l00960"></a>00960 APU_DECLARE_NONSTD(<span class="keywordtype">void</span>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga951beb3a8249648214e130ab06275a3a">apr_bucket_free</a>(<span class="keywordtype">void</span> *block);
<a name="l00961"></a>00961 
<a name="l00962"></a>00962 
<a name="l00963"></a>00963 <span class="comment">/*  *****  Bucket Functions  *****  */</span><span class="comment"></span>
<a name="l00964"></a>00964 <span class="comment">/**</span>
<a name="l00965"></a>00965 <span class="comment"> * Free the resources used by a bucket. If multiple buckets refer to</span>
<a name="l00966"></a>00966 <span class="comment"> * the same resource it is freed when the last one goes away.</span>
<a name="l00967"></a>00967 <span class="comment"> * @see apr_bucket_delete()</span>
<a name="l00968"></a>00968 <span class="comment"> * @param e The bucket to destroy</span>
<a name="l00969"></a>00969 <span class="comment"> */</span>
<a name="l00970"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gafc0dae1e90a798284ed777a0c9e90ec6">00970</a> <span class="preprocessor">#define apr_bucket_destroy(e) do {                                      \</span>
<a name="l00971"></a>00971 <span class="preprocessor">        (e)-&gt;type-&gt;destroy((e)-&gt;data);                                  \</span>
<a name="l00972"></a>00972 <span class="preprocessor">        (e)-&gt;free(e);                                                   \</span>
<a name="l00973"></a>00973 <span class="preprocessor">    } while (0)</span>
<a name="l00974"></a>00974 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00975"></a>00975 <span class="comment">/**</span>
<a name="l00976"></a>00976 <span class="comment"> * Delete a bucket by removing it from its brigade (if any) and then</span>
<a name="l00977"></a>00977 <span class="comment"> * destroying it.</span>
<a name="l00978"></a>00978 <span class="comment"> * @remark This mainly acts as an aid in avoiding code verbosity.  It is</span>
<a name="l00979"></a>00979 <span class="comment"> * the preferred exact equivalent to:</span>
<a name="l00980"></a>00980 <span class="comment"> * &lt;pre&gt;</span>
<a name="l00981"></a>00981 <span class="comment"> *      APR_BUCKET_REMOVE(e);</span>
<a name="l00982"></a>00982 <span class="comment"> *      apr_bucket_destroy(e);</span>
<a name="l00983"></a>00983 <span class="comment"> * &lt;/pre&gt;</span>
<a name="l00984"></a>00984 <span class="comment"> * @param e The bucket to delete</span>
<a name="l00985"></a>00985 <span class="comment"> */</span>
<a name="l00986"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga8925c02a7f95e8c1c3986294d4678797">00986</a> <span class="preprocessor">#define apr_bucket_delete(e) do {                                       \</span>
<a name="l00987"></a>00987 <span class="preprocessor">        APR_BUCKET_REMOVE(e);                                           \</span>
<a name="l00988"></a>00988 <span class="preprocessor">        apr_bucket_destroy(e);                                          \</span>
<a name="l00989"></a>00989 <span class="preprocessor">    } while (0)</span>
<a name="l00990"></a>00990 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00991"></a>00991 <span class="comment">/**</span>
<a name="l00992"></a>00992 <span class="comment"> * Read the data from the bucket.</span>
<a name="l00993"></a>00993 <span class="comment"> * </span>
<a name="l00994"></a>00994 <span class="comment"> * If it is not practical to return all</span>
<a name="l00995"></a>00995 <span class="comment"> * the data in the bucket, the current bucket is split and replaced by</span>
<a name="l00996"></a>00996 <span class="comment"> * two buckets, the first representing the data returned in this call,</span>
<a name="l00997"></a>00997 <span class="comment"> * and the second representing the rest of the data as yet unread. The</span>
<a name="l00998"></a>00998 <span class="comment"> * original bucket will become the first bucket after this call.</span>
<a name="l00999"></a>00999 <span class="comment"> * </span>
<a name="l01000"></a>01000 <span class="comment"> * (It is assumed that the bucket is a member of a brigade when this</span>
<a name="l01001"></a>01001 <span class="comment"> * function is called).</span>
<a name="l01002"></a>01002 <span class="comment"> * @param e The bucket to read from</span>
<a name="l01003"></a>01003 <span class="comment"> * @param str The location to store the data in</span>
<a name="l01004"></a>01004 <span class="comment"> * @param len The amount of data read</span>
<a name="l01005"></a>01005 <span class="comment"> * @param block Whether the read function blocks</span>
<a name="l01006"></a>01006 <span class="comment"> */</span>
<a name="l01007"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gae44ae938c6c60e148430fdb098dcf28f">01007</a> <span class="preprocessor">#define apr_bucket_read(e,str,len,block) (e)-&gt;type-&gt;read(e, str, len, block)</span>
<a name="l01008"></a>01008 <span class="preprocessor"></span><span class="comment"></span>
<a name="l01009"></a>01009 <span class="comment">/**</span>
<a name="l01010"></a>01010 <span class="comment"> * Setaside data so that stack data is not destroyed on returning from</span>
<a name="l01011"></a>01011 <span class="comment"> * the function</span>
<a name="l01012"></a>01012 <span class="comment"> * @param e The bucket to setaside</span>
<a name="l01013"></a>01013 <span class="comment"> * @param p The pool to setaside into</span>
<a name="l01014"></a>01014 <span class="comment"> */</span>
<a name="l01015"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gab00941ffd472982693eb415a964de7af">01015</a> <span class="preprocessor">#define apr_bucket_setaside(e,p) (e)-&gt;type-&gt;setaside(e,p)</span>
<a name="l01016"></a>01016 <span class="preprocessor"></span><span class="comment"></span>
<a name="l01017"></a>01017 <span class="comment">/**</span>
<a name="l01018"></a>01018 <span class="comment"> * Split one bucket in two at the point provided.</span>
<a name="l01019"></a>01019 <span class="comment"> * </span>
<a name="l01020"></a>01020 <span class="comment"> * Once split, the original bucket becomes the first of the two new buckets.</span>
<a name="l01021"></a>01021 <span class="comment"> * </span>
<a name="l01022"></a>01022 <span class="comment"> * (It is assumed that the bucket is a member of a brigade when this</span>
<a name="l01023"></a>01023 <span class="comment"> * function is called).</span>
<a name="l01024"></a>01024 <span class="comment"> * @param e The bucket to split</span>
<a name="l01025"></a>01025 <span class="comment"> * @param point The offset to split the bucket at</span>
<a name="l01026"></a>01026 <span class="comment"> */</span>
<a name="l01027"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#ga5bb8827a8dd1baa6ac32682e13e9d8c2">01027</a> <span class="preprocessor">#define apr_bucket_split(e,point) (e)-&gt;type-&gt;split(e, point)</span>
<a name="l01028"></a>01028 <span class="preprocessor"></span><span class="comment"></span>
<a name="l01029"></a>01029 <span class="comment">/**</span>
<a name="l01030"></a>01030 <span class="comment"> * Copy a bucket.</span>
<a name="l01031"></a>01031 <span class="comment"> * @param e The bucket to copy</span>
<a name="l01032"></a>01032 <span class="comment"> * @param c Returns a pointer to the new bucket</span>
<a name="l01033"></a>01033 <span class="comment"> */</span>
<a name="l01034"></a><a class="code" href="group___a_p_r___util___bucket___brigades.html#gab33cc08b7f064d06397f312e427279c3">01034</a> <span class="preprocessor">#define apr_bucket_copy(e,c) (e)-&gt;type-&gt;copy(e, c)</span>
<a name="l01035"></a>01035 <span class="preprocessor"></span>
<a name="l01036"></a>01036 <span class="comment">/* Bucket type handling */</span>
<a name="l01037"></a>01037 <span class="comment"></span>
<a name="l01038"></a>01038 <span class="comment">/**</span>
<a name="l01039"></a>01039 <span class="comment"> * This function simply returns APR_SUCCESS to denote that the bucket does</span>
<a name="l01040"></a>01040 <span class="comment"> * not require anything to happen for its setaside() function. This is</span>
<a name="l01041"></a>01041 <span class="comment"> * appropriate for buckets that have &quot;immortal&quot; data -- the data will live</span>
<a name="l01042"></a>01042 <span class="comment"> * at least as long as the bucket.</span>
<a name="l01043"></a>01043 <span class="comment"> * @param data The bucket to setaside</span>
<a name="l01044"></a>01044 <span class="comment"> * @param pool The pool defining the desired lifetime of the bucket data</span>
<a name="l01045"></a>01045 <span class="comment"> * @return APR_SUCCESS</span>
<a name="l01046"></a>01046 <span class="comment"> */</span> 
<a name="l01047"></a>01047 APU_DECLARE_NONSTD(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gae6135b83d9f7bd7e1b60dbc761a3ca5f">apr_bucket_setaside_noop</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *data,
<a name="l01048"></a>01048                                                           <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *pool);
<a name="l01049"></a>01049 <span class="comment"></span>
<a name="l01050"></a>01050 <span class="comment">/**</span>
<a name="l01051"></a>01051 <span class="comment"> * A place holder function that signifies that the setaside function was not</span>
<a name="l01052"></a>01052 <span class="comment"> * implemented for this bucket</span>
<a name="l01053"></a>01053 <span class="comment"> * @param data The bucket to setaside</span>
<a name="l01054"></a>01054 <span class="comment"> * @param pool The pool defining the desired lifetime of the bucket data</span>
<a name="l01055"></a>01055 <span class="comment"> * @return APR_ENOTIMPL</span>
<a name="l01056"></a>01056 <span class="comment"> */</span> 
<a name="l01057"></a>01057 APU_DECLARE_NONSTD(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gade52b057161f657a6b298d9c6a78b339">apr_bucket_setaside_notimpl</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *data,
<a name="l01058"></a>01058                                                              <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *pool);
<a name="l01059"></a>01059 <span class="comment"></span>
<a name="l01060"></a>01060 <span class="comment">/**</span>
<a name="l01061"></a>01061 <span class="comment"> * A place holder function that signifies that the split function was not</span>
<a name="l01062"></a>01062 <span class="comment"> * implemented for this bucket</span>
<a name="l01063"></a>01063 <span class="comment"> * @param data The bucket to split</span>
<a name="l01064"></a>01064 <span class="comment"> * @param point The location to split the bucket</span>
<a name="l01065"></a>01065 <span class="comment"> * @return APR_ENOTIMPL</span>
<a name="l01066"></a>01066 <span class="comment"> */</span> 
<a name="l01067"></a>01067 APU_DECLARE_NONSTD(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga305766ff39440711da93e72f5b348a3a">apr_bucket_split_notimpl</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *data,
<a name="l01068"></a>01068                                                           apr_size_t point);
<a name="l01069"></a>01069 <span class="comment"></span>
<a name="l01070"></a>01070 <span class="comment">/**</span>
<a name="l01071"></a>01071 <span class="comment"> * A place holder function that signifies that the copy function was not</span>
<a name="l01072"></a>01072 <span class="comment"> * implemented for this bucket</span>
<a name="l01073"></a>01073 <span class="comment"> * @param e The bucket to copy</span>
<a name="l01074"></a>01074 <span class="comment"> * @param c Returns a pointer to the new bucket</span>
<a name="l01075"></a>01075 <span class="comment"> * @return APR_ENOTIMPL</span>
<a name="l01076"></a>01076 <span class="comment"> */</span>
<a name="l01077"></a>01077 APU_DECLARE_NONSTD(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga5fc17c10cee2abf02557669f6f507e89">apr_bucket_copy_notimpl</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *e,
<a name="l01078"></a>01078                                                          <a class="code" href="structapr__bucket.html">apr_bucket</a> **c);
<a name="l01079"></a>01079 <span class="comment"></span>
<a name="l01080"></a>01080 <span class="comment">/**</span>
<a name="l01081"></a>01081 <span class="comment"> * A place holder function that signifies that this bucket does not need</span>
<a name="l01082"></a>01082 <span class="comment"> * to do anything special to be destroyed.  That&#39;s only the case for buckets</span>
<a name="l01083"></a>01083 <span class="comment"> * that either have no data (metadata buckets) or buckets whose data pointer</span>
<a name="l01084"></a>01084 <span class="comment"> * points to something that&#39;s not a bucket-type-specific structure, as with</span>
<a name="l01085"></a>01085 <span class="comment"> * simple buckets where data points to a string and pipe buckets where data</span>
<a name="l01086"></a>01086 <span class="comment"> * points directly to the apr_file_t.</span>
<a name="l01087"></a>01087 <span class="comment"> * @param data The bucket data to destroy</span>
<a name="l01088"></a>01088 <span class="comment"> */</span> 
<a name="l01089"></a>01089 APU_DECLARE_NONSTD(<span class="keywordtype">void</span>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga09221bea9541ca2340a4e8b5e1e7ac56">apr_bucket_destroy_noop</a>(<span class="keywordtype">void</span> *data);
<a name="l01090"></a>01090 <span class="comment"></span>
<a name="l01091"></a>01091 <span class="comment">/**</span>
<a name="l01092"></a>01092 <span class="comment"> * There is no apr_bucket_destroy_notimpl, because destruction is required</span>
<a name="l01093"></a>01093 <span class="comment"> * to be implemented (it could be a noop, but only if that makes sense for</span>
<a name="l01094"></a>01094 <span class="comment"> * the bucket type)</span>
<a name="l01095"></a>01095 <span class="comment"> */</span>
<a name="l01096"></a>01096 
<a name="l01097"></a>01097 <span class="comment">/* There is no apr_bucket_read_notimpl, because it is a required function</span>
<a name="l01098"></a>01098 <span class="comment"> */</span>
<a name="l01099"></a>01099 
<a name="l01100"></a>01100 
<a name="l01101"></a>01101 <span class="comment">/* All of the bucket types implemented by the core */</span><span class="comment"></span>
<a name="l01102"></a>01102 <span class="comment">/**</span>
<a name="l01103"></a>01103 <span class="comment"> * The flush bucket type.  This signifies that all data should be flushed to</span>
<a name="l01104"></a>01104 <span class="comment"> * the next filter.  The flush bucket should be sent with the other buckets.</span>
<a name="l01105"></a>01105 <span class="comment"> */</span>
<a name="l01106"></a>01106 APU_DECLARE_DATA extern const <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#gaecc113cfcc7751dfe70876437a2f51d7">apr_bucket_type_flush</a>;<span class="comment"></span>
<a name="l01107"></a>01107 <span class="comment">/**</span>
<a name="l01108"></a>01108 <span class="comment"> * The EOS bucket type.  This signifies that there will be no more data, ever.</span>
<a name="l01109"></a>01109 <span class="comment"> * All filters MUST send all data to the next filter when they receive a</span>
<a name="l01110"></a>01110 <span class="comment"> * bucket of this type</span>
<a name="l01111"></a>01111 <span class="comment"> */</span>
<a name="l01112"></a>01112 APU_DECLARE_DATA extern const <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga829cac9b4843b85a902ddd64dffbfb12">apr_bucket_type_eos</a>;<span class="comment"></span>
<a name="l01113"></a>01113 <span class="comment">/**</span>
<a name="l01114"></a>01114 <span class="comment"> * The FILE bucket type.  This bucket represents a file on disk</span>
<a name="l01115"></a>01115 <span class="comment"> */</span>
<a name="l01116"></a>01116 APU_DECLARE_DATA extern const <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga5f17aa7e616179411a06475ec09626e9">apr_bucket_type_file</a>;<span class="comment"></span>
<a name="l01117"></a>01117 <span class="comment">/**</span>
<a name="l01118"></a>01118 <span class="comment"> * The HEAP bucket type.  This bucket represents a data allocated from the</span>
<a name="l01119"></a>01119 <span class="comment"> * heap.</span>
<a name="l01120"></a>01120 <span class="comment"> */</span>
<a name="l01121"></a>01121 APU_DECLARE_DATA extern const <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga2c5608267ed7b860657f5a1c89c2f40d">apr_bucket_type_heap</a>;
<a name="l01122"></a>01122 <span class="preprocessor">#if APR_HAS_MMAP</span>
<a name="l01123"></a>01123 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l01124"></a>01124 <span class="comment"> * The MMAP bucket type.  This bucket represents an MMAP&#39;ed file</span>
<a name="l01125"></a>01125 <span class="comment"> */</span>
<a name="l01126"></a>01126 APU_DECLARE_DATA <span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga63f9ce8e4d6e796921aad14a218a3b23">apr_bucket_type_mmap</a>;
<a name="l01127"></a>01127 <span class="preprocessor">#endif</span>
<a name="l01128"></a>01128 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l01129"></a>01129 <span class="comment"> * The POOL bucket type.  This bucket represents a data that was allocated</span>
<a name="l01130"></a>01130 <span class="comment"> * from a pool.  IF this bucket is still available when the pool is cleared,</span>
<a name="l01131"></a>01131 <span class="comment"> * the data is copied on to the heap.</span>
<a name="l01132"></a>01132 <span class="comment"> */</span>
<a name="l01133"></a>01133 APU_DECLARE_DATA <span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga87bace819fdbf07c12497a8289b3567b">apr_bucket_type_pool</a>;<span class="comment"></span>
<a name="l01134"></a>01134 <span class="comment">/**</span>
<a name="l01135"></a>01135 <span class="comment"> * The PIPE bucket type.  This bucket represents a pipe to another program.</span>
<a name="l01136"></a>01136 <span class="comment"> */</span>
<a name="l01137"></a>01137 APU_DECLARE_DATA <span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga334a875abb2908364a40abbfa80c401f">apr_bucket_type_pipe</a>;<span class="comment"></span>
<a name="l01138"></a>01138 <span class="comment">/**</span>
<a name="l01139"></a>01139 <span class="comment"> * The IMMORTAL bucket type.  This bucket represents a segment of data that</span>
<a name="l01140"></a>01140 <span class="comment"> * the creator is willing to take responsibility for.  The core will do</span>
<a name="l01141"></a>01141 <span class="comment"> * nothing with the data in an immortal bucket</span>
<a name="l01142"></a>01142 <span class="comment"> */</span>
<a name="l01143"></a>01143 APU_DECLARE_DATA <span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga391ac24b2c85969e8efa504588b364bb">apr_bucket_type_immortal</a>;<span class="comment"></span>
<a name="l01144"></a>01144 <span class="comment">/**</span>
<a name="l01145"></a>01145 <span class="comment"> * The TRANSIENT bucket type.  This bucket represents a data allocated off</span>
<a name="l01146"></a>01146 <span class="comment"> * the stack.  When the setaside function is called, this data is copied on</span>
<a name="l01147"></a>01147 <span class="comment"> * to the heap</span>
<a name="l01148"></a>01148 <span class="comment"> */</span>
<a name="l01149"></a>01149 APU_DECLARE_DATA <span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga1692ced61c1966e67adc05ec2a69ce9b">apr_bucket_type_transient</a>;<span class="comment"></span>
<a name="l01150"></a>01150 <span class="comment">/**</span>
<a name="l01151"></a>01151 <span class="comment"> * The SOCKET bucket type.  This bucket represents a socket to another machine</span>
<a name="l01152"></a>01152 <span class="comment"> */</span>
<a name="l01153"></a>01153 APU_DECLARE_DATA <span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="structapr__bucket__type__t.html">apr_bucket_type_t</a> <a class="code" href="group___a_p_r___util___bucket___brigades.html#gaa6d9978cc10895bdf0a4686728822a84">apr_bucket_type_socket</a>;
<a name="l01154"></a>01154 
<a name="l01155"></a>01155 
<a name="l01156"></a>01156 <span class="comment">/*  *****  Simple buckets  *****  */</span>
<a name="l01157"></a>01157 <span class="comment"></span>
<a name="l01158"></a>01158 <span class="comment">/**</span>
<a name="l01159"></a>01159 <span class="comment"> * Split a simple bucket into two at the given point.  Most non-reference</span>
<a name="l01160"></a>01160 <span class="comment"> * counting buckets that allow multiple references to the same block of</span>
<a name="l01161"></a>01161 <span class="comment"> * data (eg transient and immortal) will use this as their split function</span>
<a name="l01162"></a>01162 <span class="comment"> * without any additional type-specific handling.</span>
<a name="l01163"></a>01163 <span class="comment"> * @param b The bucket to be split</span>
<a name="l01164"></a>01164 <span class="comment"> * @param point The offset of the first byte in the new bucket</span>
<a name="l01165"></a>01165 <span class="comment"> * @return APR_EINVAL if the point is not within the bucket;</span>
<a name="l01166"></a>01166 <span class="comment"> *         APR_ENOMEM if allocation failed;</span>
<a name="l01167"></a>01167 <span class="comment"> *         or APR_SUCCESS</span>
<a name="l01168"></a>01168 <span class="comment"> */</span>
<a name="l01169"></a>01169 APU_DECLARE_NONSTD(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9fd8c7d9e42dd04b8f153072655e875c">apr_bucket_simple_split</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b,
<a name="l01170"></a>01170                                                          apr_size_t point);
<a name="l01171"></a>01171 <span class="comment"></span>
<a name="l01172"></a>01172 <span class="comment">/**</span>
<a name="l01173"></a>01173 <span class="comment"> * Copy a simple bucket.  Most non-reference-counting buckets that allow</span>
<a name="l01174"></a>01174 <span class="comment"> * multiple references to the same block of data (eg transient and immortal)</span>
<a name="l01175"></a>01175 <span class="comment"> * will use this as their copy function without any additional type-specific</span>
<a name="l01176"></a>01176 <span class="comment"> * handling.</span>
<a name="l01177"></a>01177 <span class="comment"> * @param a The bucket to copy</span>
<a name="l01178"></a>01178 <span class="comment"> * @param b Returns a pointer to the new bucket</span>
<a name="l01179"></a>01179 <span class="comment"> * @return APR_ENOMEM if allocation failed;</span>
<a name="l01180"></a>01180 <span class="comment"> *         or APR_SUCCESS</span>
<a name="l01181"></a>01181 <span class="comment"> */</span>
<a name="l01182"></a>01182 APU_DECLARE_NONSTD(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga123c95e832734f92e6f1139b6a68cfa6">apr_bucket_simple_copy</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *a,
<a name="l01183"></a>01183                                                         <a class="code" href="structapr__bucket.html">apr_bucket</a> **b);
<a name="l01184"></a>01184 
<a name="l01185"></a>01185 
<a name="l01186"></a>01186 <span class="comment">/*  *****  Shared, reference-counted buckets  *****  */</span>
<a name="l01187"></a>01187 <span class="comment"></span>
<a name="l01188"></a>01188 <span class="comment">/**</span>
<a name="l01189"></a>01189 <span class="comment"> * Initialize a bucket containing reference-counted data that may be</span>
<a name="l01190"></a>01190 <span class="comment"> * shared. The caller must allocate the bucket if necessary and</span>
<a name="l01191"></a>01191 <span class="comment"> * initialize its type-dependent fields, and allocate and initialize</span>
<a name="l01192"></a>01192 <span class="comment"> * its own private data structure. This function should only be called</span>
<a name="l01193"></a>01193 <span class="comment"> * by type-specific bucket creation functions.</span>
<a name="l01194"></a>01194 <span class="comment"> * @param b The bucket to initialize</span>
<a name="l01195"></a>01195 <span class="comment"> * @param data A pointer to the private data structure</span>
<a name="l01196"></a>01196 <span class="comment"> *             with the reference count at the start</span>
<a name="l01197"></a>01197 <span class="comment"> * @param start The start of the data in the bucket</span>
<a name="l01198"></a>01198 <span class="comment"> *              relative to the private base pointer</span>
<a name="l01199"></a>01199 <span class="comment"> * @param length The length of the data in the bucket</span>
<a name="l01200"></a>01200 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01201"></a>01201 <span class="comment"> */</span>
<a name="l01202"></a>01202 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga562251ac5776e88f7384158b85e74be8">apr_bucket_shared_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b, <span class="keywordtype">void</span> *data,
<a name="l01203"></a>01203                                                  apr_off_t start, 
<a name="l01204"></a>01204                                                  apr_size_t length);
<a name="l01205"></a>01205 <span class="comment"></span>
<a name="l01206"></a>01206 <span class="comment">/**</span>
<a name="l01207"></a>01207 <span class="comment"> * Decrement the refcount of the data in the bucket. This function</span>
<a name="l01208"></a>01208 <span class="comment"> * should only be called by type-specific bucket destruction functions.</span>
<a name="l01209"></a>01209 <span class="comment"> * @param data The private data pointer from the bucket to be destroyed</span>
<a name="l01210"></a>01210 <span class="comment"> * @return TRUE or FALSE; TRUE if the reference count is now</span>
<a name="l01211"></a>01211 <span class="comment"> *         zero, indicating that the shared resource itself can</span>
<a name="l01212"></a>01212 <span class="comment"> *         be destroyed by the caller.</span>
<a name="l01213"></a>01213 <span class="comment"> */</span>
<a name="l01214"></a>01214 APU_DECLARE(<span class="keywordtype">int</span>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga43c7dc7e3eb961a91bbc0b69a47e503c">apr_bucket_shared_destroy</a>(<span class="keywordtype">void</span> *data);
<a name="l01215"></a>01215 <span class="comment"></span>
<a name="l01216"></a>01216 <span class="comment">/**</span>
<a name="l01217"></a>01217 <span class="comment"> * Split a bucket into two at the given point, and adjust the refcount</span>
<a name="l01218"></a>01218 <span class="comment"> * to the underlying data. Most reference-counting bucket types will</span>
<a name="l01219"></a>01219 <span class="comment"> * be able to use this function as their split function without any</span>
<a name="l01220"></a>01220 <span class="comment"> * additional type-specific handling.</span>
<a name="l01221"></a>01221 <span class="comment"> * @param b The bucket to be split</span>
<a name="l01222"></a>01222 <span class="comment"> * @param point The offset of the first byte in the new bucket</span>
<a name="l01223"></a>01223 <span class="comment"> * @return APR_EINVAL if the point is not within the bucket;</span>
<a name="l01224"></a>01224 <span class="comment"> *         APR_ENOMEM if allocation failed;</span>
<a name="l01225"></a>01225 <span class="comment"> *         or APR_SUCCESS</span>
<a name="l01226"></a>01226 <span class="comment"> */</span>
<a name="l01227"></a>01227 APU_DECLARE_NONSTD(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga871e54ba20487a2085a73a673ffa4110">apr_bucket_shared_split</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b,
<a name="l01228"></a>01228                                                          apr_size_t point);
<a name="l01229"></a>01229 <span class="comment"></span>
<a name="l01230"></a>01230 <span class="comment">/**</span>
<a name="l01231"></a>01231 <span class="comment"> * Copy a refcounted bucket, incrementing the reference count. Most</span>
<a name="l01232"></a>01232 <span class="comment"> * reference-counting bucket types will be able to use this function</span>
<a name="l01233"></a>01233 <span class="comment"> * as their copy function without any additional type-specific handling.</span>
<a name="l01234"></a>01234 <span class="comment"> * @param a The bucket to copy</span>
<a name="l01235"></a>01235 <span class="comment"> * @param b Returns a pointer to the new bucket</span>
<a name="l01236"></a>01236 <span class="comment"> * @return APR_ENOMEM if allocation failed;</span>
<a name="l01237"></a>01237 <span class="comment">           or APR_SUCCESS</span>
<a name="l01238"></a>01238 <span class="comment"> */</span>
<a name="l01239"></a>01239 APU_DECLARE_NONSTD(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga2e9a035d340ef6b4279b178eff614670">apr_bucket_shared_copy</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *a,
<a name="l01240"></a>01240                                                         <a class="code" href="structapr__bucket.html">apr_bucket</a> **b);
<a name="l01241"></a>01241 
<a name="l01242"></a>01242 
<a name="l01243"></a>01243 <span class="comment">/*  *****  Functions to Create Buckets of varying types  *****  */</span>
<a name="l01244"></a>01244 <span class="comment">/*</span>
<a name="l01245"></a>01245 <span class="comment"> * Each bucket type foo has two initialization functions:</span>
<a name="l01246"></a>01246 <span class="comment"> * apr_bucket_foo_make which sets up some already-allocated memory as a</span>
<a name="l01247"></a>01247 <span class="comment"> * bucket of type foo; and apr_bucket_foo_create which allocates memory</span>
<a name="l01248"></a>01248 <span class="comment"> * for the bucket, calls apr_bucket_make_foo, and initializes the</span>
<a name="l01249"></a>01249 <span class="comment"> * bucket&#39;s list pointers. The apr_bucket_foo_make functions are used</span>
<a name="l01250"></a>01250 <span class="comment"> * inside the bucket code to change the type of buckets in place;</span>
<a name="l01251"></a>01251 <span class="comment"> * other code should call apr_bucket_foo_create. All the initialization</span>
<a name="l01252"></a>01252 <span class="comment"> * functions change nothing if they fail.</span>
<a name="l01253"></a>01253 <span class="comment"> */</span>
<a name="l01254"></a>01254 <span class="comment"></span>
<a name="l01255"></a>01255 <span class="comment">/**</span>
<a name="l01256"></a>01256 <span class="comment"> * Create an End of Stream bucket.  This indicates that there is no more data</span>
<a name="l01257"></a>01257 <span class="comment"> * coming from down the filter stack.  All filters should flush at this point.</span>
<a name="l01258"></a>01258 <span class="comment"> * @param list The freelist from which this bucket should be allocated</span>
<a name="l01259"></a>01259 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01260"></a>01260 <span class="comment"> */</span>
<a name="l01261"></a>01261 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gaac308b459ecdab87e94b12adad1b8760">apr_bucket_eos_create</a>(<a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l01262"></a>01262 <span class="comment"></span>
<a name="l01263"></a>01263 <span class="comment">/**</span>
<a name="l01264"></a>01264 <span class="comment"> * Make the bucket passed in an EOS bucket.  This indicates that there is no </span>
<a name="l01265"></a>01265 <span class="comment"> * more data coming from down the filter stack.  All filters should flush at </span>
<a name="l01266"></a>01266 <span class="comment"> * this point.</span>
<a name="l01267"></a>01267 <span class="comment"> * @param b The bucket to make into an EOS bucket</span>
<a name="l01268"></a>01268 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01269"></a>01269 <span class="comment"> */</span>
<a name="l01270"></a>01270 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga06312ba339cb0ec1844b698d30e754c4">apr_bucket_eos_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b);
<a name="l01271"></a>01271 <span class="comment"></span>
<a name="l01272"></a>01272 <span class="comment">/**</span>
<a name="l01273"></a>01273 <span class="comment"> * Create a flush  bucket.  This indicates that filters should flush their</span>
<a name="l01274"></a>01274 <span class="comment"> * data.  There is no guarantee that they will flush it, but this is the</span>
<a name="l01275"></a>01275 <span class="comment"> * best we can do.</span>
<a name="l01276"></a>01276 <span class="comment"> * @param list The freelist from which this bucket should be allocated</span>
<a name="l01277"></a>01277 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01278"></a>01278 <span class="comment"> */</span>
<a name="l01279"></a>01279 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga48347f3f7d5738cdb61fe35c25c09666">apr_bucket_flush_create</a>(<a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l01280"></a>01280 <span class="comment"></span>
<a name="l01281"></a>01281 <span class="comment">/**</span>
<a name="l01282"></a>01282 <span class="comment"> * Make the bucket passed in a FLUSH  bucket.  This indicates that filters </span>
<a name="l01283"></a>01283 <span class="comment"> * should flush their data.  There is no guarantee that they will flush it, </span>
<a name="l01284"></a>01284 <span class="comment"> * but this is the best we can do.</span>
<a name="l01285"></a>01285 <span class="comment"> * @param b The bucket to make into a FLUSH bucket</span>
<a name="l01286"></a>01286 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01287"></a>01287 <span class="comment"> */</span>
<a name="l01288"></a>01288 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gaee543b95249a320a27ae9bb03e2c4f23">apr_bucket_flush_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b);
<a name="l01289"></a>01289 <span class="comment"></span>
<a name="l01290"></a>01290 <span class="comment">/**</span>
<a name="l01291"></a>01291 <span class="comment"> * Create a bucket referring to long-lived data.</span>
<a name="l01292"></a>01292 <span class="comment"> * @param buf The data to insert into the bucket</span>
<a name="l01293"></a>01293 <span class="comment"> * @param nbyte The size of the data to insert.</span>
<a name="l01294"></a>01294 <span class="comment"> * @param list The freelist from which this bucket should be allocated</span>
<a name="l01295"></a>01295 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01296"></a>01296 <span class="comment"> */</span>
<a name="l01297"></a>01297 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gad81543da24b144c0e100dd1e6d843adb">apr_bucket_immortal_create</a>(const <span class="keywordtype">char</span> *buf, 
<a name="l01298"></a>01298                                                      apr_size_t nbyte,
<a name="l01299"></a>01299                                                      <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l01300"></a>01300 <span class="comment"></span>
<a name="l01301"></a>01301 <span class="comment">/**</span>
<a name="l01302"></a>01302 <span class="comment"> * Make the bucket passed in a bucket refer to long-lived data</span>
<a name="l01303"></a>01303 <span class="comment"> * @param b The bucket to make into a IMMORTAL bucket</span>
<a name="l01304"></a>01304 <span class="comment"> * @param buf The data to insert into the bucket</span>
<a name="l01305"></a>01305 <span class="comment"> * @param nbyte The size of the data to insert.</span>
<a name="l01306"></a>01306 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01307"></a>01307 <span class="comment"> */</span>
<a name="l01308"></a>01308 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga33b21eb55cad9d28b5cdd40ad4181774">apr_bucket_immortal_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b, 
<a name="l01309"></a>01309                                                    const <span class="keywordtype">char</span> *buf, 
<a name="l01310"></a>01310                                                    apr_size_t nbyte);
<a name="l01311"></a>01311 <span class="comment"></span>
<a name="l01312"></a>01312 <span class="comment">/**</span>
<a name="l01313"></a>01313 <span class="comment"> * Create a bucket referring to data on the stack.</span>
<a name="l01314"></a>01314 <span class="comment"> * @param buf The data to insert into the bucket</span>
<a name="l01315"></a>01315 <span class="comment"> * @param nbyte The size of the data to insert.</span>
<a name="l01316"></a>01316 <span class="comment"> * @param list The freelist from which this bucket should be allocated</span>
<a name="l01317"></a>01317 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01318"></a>01318 <span class="comment"> */</span>
<a name="l01319"></a>01319 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga554f2d87c718f30a9259d52c6f81a405">apr_bucket_transient_create</a>(const <span class="keywordtype">char</span> *buf, 
<a name="l01320"></a>01320                                                       apr_size_t nbyte,
<a name="l01321"></a>01321                                                       <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l01322"></a>01322 <span class="comment"></span>
<a name="l01323"></a>01323 <span class="comment">/**</span>
<a name="l01324"></a>01324 <span class="comment"> * Make the bucket passed in a bucket refer to stack data</span>
<a name="l01325"></a>01325 <span class="comment"> * @param b The bucket to make into a TRANSIENT bucket</span>
<a name="l01326"></a>01326 <span class="comment"> * @param buf The data to insert into the bucket</span>
<a name="l01327"></a>01327 <span class="comment"> * @param nbyte The size of the data to insert.</span>
<a name="l01328"></a>01328 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01329"></a>01329 <span class="comment"> */</span>
<a name="l01330"></a>01330 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga7e1f9a0ae64781ff4430d08c25e6e831">apr_bucket_transient_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b, 
<a name="l01331"></a>01331                                                     const <span class="keywordtype">char</span> *buf,
<a name="l01332"></a>01332                                                     apr_size_t nbyte);
<a name="l01333"></a>01333 <span class="comment"></span>
<a name="l01334"></a>01334 <span class="comment">/**</span>
<a name="l01335"></a>01335 <span class="comment"> * Create a bucket referring to memory on the heap. If the caller asks</span>
<a name="l01336"></a>01336 <span class="comment"> * for the data to be copied, this function always allocates 4K of</span>
<a name="l01337"></a>01337 <span class="comment"> * memory so that more data can be added to the bucket without</span>
<a name="l01338"></a>01338 <span class="comment"> * requiring another allocation. Therefore not all the data may be put</span>
<a name="l01339"></a>01339 <span class="comment"> * into the bucket. If copying is not requested then the bucket takes</span>
<a name="l01340"></a>01340 <span class="comment"> * over responsibility for free()ing the memory.</span>
<a name="l01341"></a>01341 <span class="comment"> * @param buf The buffer to insert into the bucket</span>
<a name="l01342"></a>01342 <span class="comment"> * @param nbyte The size of the buffer to insert.</span>
<a name="l01343"></a>01343 <span class="comment"> * @param free_func Function to use to free the data; NULL indicates that the</span>
<a name="l01344"></a>01344 <span class="comment"> *                  bucket should make a copy of the data</span>
<a name="l01345"></a>01345 <span class="comment"> * @param list The freelist from which this bucket should be allocated</span>
<a name="l01346"></a>01346 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01347"></a>01347 <span class="comment"> */</span>
<a name="l01348"></a>01348 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gadde6843cfe311a60d290adc1d6635cac">apr_bucket_heap_create</a>(const <span class="keywordtype">char</span> *buf, 
<a name="l01349"></a>01349                                                  apr_size_t nbyte,
<a name="l01350"></a>01350                                                  <span class="keywordtype">void</span> (*free_func)(<span class="keywordtype">void</span> *data),
<a name="l01351"></a>01351                                                  <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);<span class="comment"></span>
<a name="l01352"></a>01352 <span class="comment">/**</span>
<a name="l01353"></a>01353 <span class="comment"> * Make the bucket passed in a bucket refer to heap data</span>
<a name="l01354"></a>01354 <span class="comment"> * @param b The bucket to make into a HEAP bucket</span>
<a name="l01355"></a>01355 <span class="comment"> * @param buf The buffer to insert into the bucket</span>
<a name="l01356"></a>01356 <span class="comment"> * @param nbyte The size of the buffer to insert.</span>
<a name="l01357"></a>01357 <span class="comment"> * @param free_func Function to use to free the data; NULL indicates that the</span>
<a name="l01358"></a>01358 <span class="comment"> *                  bucket should make a copy of the data</span>
<a name="l01359"></a>01359 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01360"></a>01360 <span class="comment"> */</span>
<a name="l01361"></a>01361 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga71de285204d21507420068f05b12a541">apr_bucket_heap_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b, const <span class="keywordtype">char</span> *buf,
<a name="l01362"></a>01362                                                apr_size_t nbyte,
<a name="l01363"></a>01363                                                <span class="keywordtype">void</span> (*free_func)(<span class="keywordtype">void</span> *data));
<a name="l01364"></a>01364 <span class="comment"></span>
<a name="l01365"></a>01365 <span class="comment">/**</span>
<a name="l01366"></a>01366 <span class="comment"> * Create a bucket referring to memory allocated from a pool.</span>
<a name="l01367"></a>01367 <span class="comment"> *</span>
<a name="l01368"></a>01368 <span class="comment"> * @param buf The buffer to insert into the bucket</span>
<a name="l01369"></a>01369 <span class="comment"> * @param length The number of bytes referred to by this bucket</span>
<a name="l01370"></a>01370 <span class="comment"> * @param pool The pool the memory was allocated from</span>
<a name="l01371"></a>01371 <span class="comment"> * @param list The freelist from which this bucket should be allocated</span>
<a name="l01372"></a>01372 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01373"></a>01373 <span class="comment"> */</span>
<a name="l01374"></a>01374 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga154ea763ee9de4ccb8692b9e3b60ebb2">apr_bucket_pool_create</a>(const <span class="keywordtype">char</span> *buf, 
<a name="l01375"></a>01375                                                  apr_size_t length,
<a name="l01376"></a>01376                                                  <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *pool,
<a name="l01377"></a>01377                                                  <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l01378"></a>01378 <span class="comment"></span>
<a name="l01379"></a>01379 <span class="comment">/**</span>
<a name="l01380"></a>01380 <span class="comment"> * Make the bucket passed in a bucket refer to pool data</span>
<a name="l01381"></a>01381 <span class="comment"> * @param b The bucket to make into a pool bucket</span>
<a name="l01382"></a>01382 <span class="comment"> * @param buf The buffer to insert into the bucket</span>
<a name="l01383"></a>01383 <span class="comment"> * @param length The number of bytes referred to by this bucket</span>
<a name="l01384"></a>01384 <span class="comment"> * @param pool The pool the memory was allocated from</span>
<a name="l01385"></a>01385 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01386"></a>01386 <span class="comment"> */</span>
<a name="l01387"></a>01387 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga01197c5b2cda6382354628cecdeae145">apr_bucket_pool_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b, const <span class="keywordtype">char</span> *buf,
<a name="l01388"></a>01388                                                apr_size_t length, 
<a name="l01389"></a>01389                                                <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *pool);
<a name="l01390"></a>01390 
<a name="l01391"></a>01391 <span class="preprocessor">#if APR_HAS_MMAP</span>
<a name="l01392"></a>01392 <span class="preprocessor"></span><span class="comment">/**</span>
<a name="l01393"></a>01393 <span class="comment"> * Create a bucket referring to mmap()ed memory.</span>
<a name="l01394"></a>01394 <span class="comment"> * @param mm The mmap to insert into the bucket</span>
<a name="l01395"></a>01395 <span class="comment"> * @param start The offset of the first byte in the mmap</span>
<a name="l01396"></a>01396 <span class="comment"> *              that this bucket refers to</span>
<a name="l01397"></a>01397 <span class="comment"> * @param length The number of bytes referred to by this bucket</span>
<a name="l01398"></a>01398 <span class="comment"> * @param list The freelist from which this bucket should be allocated</span>
<a name="l01399"></a>01399 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01400"></a>01400 <span class="comment"> */</span>
<a name="l01401"></a>01401 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gaee338c7d218ce1fbbf8c1aefedcc0632">apr_bucket_mmap_create</a>(<a class="code" href="structapr__mmap__t.html">apr_mmap_t</a> *mm, 
<a name="l01402"></a>01402                                                  apr_off_t start,
<a name="l01403"></a>01403                                                  apr_size_t length,
<a name="l01404"></a>01404                                                  <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l01405"></a>01405 <span class="comment"></span>
<a name="l01406"></a>01406 <span class="comment">/**</span>
<a name="l01407"></a>01407 <span class="comment"> * Make the bucket passed in a bucket refer to an MMAP&#39;ed file</span>
<a name="l01408"></a>01408 <span class="comment"> * @param b The bucket to make into a MMAP bucket</span>
<a name="l01409"></a>01409 <span class="comment"> * @param mm The mmap to insert into the bucket</span>
<a name="l01410"></a>01410 <span class="comment"> * @param start The offset of the first byte in the mmap</span>
<a name="l01411"></a>01411 <span class="comment"> *              that this bucket refers to</span>
<a name="l01412"></a>01412 <span class="comment"> * @param length The number of bytes referred to by this bucket</span>
<a name="l01413"></a>01413 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01414"></a>01414 <span class="comment"> */</span>
<a name="l01415"></a>01415 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gab561ac92d1811e5a2589783536e64a1a">apr_bucket_mmap_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b, <a class="code" href="structapr__mmap__t.html">apr_mmap_t</a> *mm,
<a name="l01416"></a>01416                                                apr_off_t start, 
<a name="l01417"></a>01417                                                apr_size_t length);
<a name="l01418"></a>01418 <span class="preprocessor">#endif</span>
<a name="l01419"></a>01419 <span class="preprocessor"></span><span class="comment"></span>
<a name="l01420"></a>01420 <span class="comment">/**</span>
<a name="l01421"></a>01421 <span class="comment"> * Create a bucket referring to a socket.</span>
<a name="l01422"></a>01422 <span class="comment"> * @param thissock The socket to put in the bucket</span>
<a name="l01423"></a>01423 <span class="comment"> * @param list The freelist from which this bucket should be allocated</span>
<a name="l01424"></a>01424 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01425"></a>01425 <span class="comment"> */</span>
<a name="l01426"></a>01426 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacd9f08b40eb2204cd93b42e58338aeb2">apr_bucket_socket_create</a>(<a class="code" href="group__apr__network__io.html#ga49262b223e7434746e1f1737659aa2c3">apr_socket_t</a> *thissock,
<a name="l01427"></a>01427                                                    <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);<span class="comment"></span>
<a name="l01428"></a>01428 <span class="comment">/**</span>
<a name="l01429"></a>01429 <span class="comment"> * Make the bucket passed in a bucket refer to a socket</span>
<a name="l01430"></a>01430 <span class="comment"> * @param b The bucket to make into a SOCKET bucket</span>
<a name="l01431"></a>01431 <span class="comment"> * @param thissock The socket to put in the bucket</span>
<a name="l01432"></a>01432 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01433"></a>01433 <span class="comment"> */</span>
<a name="l01434"></a>01434 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga2fffd4c4701ad55c6df27cdee0c47200">apr_bucket_socket_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b, 
<a name="l01435"></a>01435                                                  <a class="code" href="group__apr__network__io.html#ga49262b223e7434746e1f1737659aa2c3">apr_socket_t</a> *thissock);
<a name="l01436"></a>01436 <span class="comment"></span>
<a name="l01437"></a>01437 <span class="comment">/**</span>
<a name="l01438"></a>01438 <span class="comment"> * Create a bucket referring to a pipe.</span>
<a name="l01439"></a>01439 <span class="comment"> * @param thispipe The pipe to put in the bucket</span>
<a name="l01440"></a>01440 <span class="comment"> * @param list The freelist from which this bucket should be allocated</span>
<a name="l01441"></a>01441 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01442"></a>01442 <span class="comment"> */</span>
<a name="l01443"></a>01443 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gab9ea07d5f9246e06c1bb3e76ee90cd71">apr_bucket_pipe_create</a>(<a class="code" href="group__apr__file__io.html#gaa46e4763ac375ea3c7a43ba6f6099e22">apr_file_t</a> *thispipe,
<a name="l01444"></a>01444                                                  <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l01445"></a>01445 <span class="comment"></span>
<a name="l01446"></a>01446 <span class="comment">/**</span>
<a name="l01447"></a>01447 <span class="comment"> * Make the bucket passed in a bucket refer to a pipe</span>
<a name="l01448"></a>01448 <span class="comment"> * @param b The bucket to make into a PIPE bucket</span>
<a name="l01449"></a>01449 <span class="comment"> * @param thispipe The pipe to put in the bucket</span>
<a name="l01450"></a>01450 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01451"></a>01451 <span class="comment"> */</span>
<a name="l01452"></a>01452 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gae7b4daa1318226beda4bf0eead2f5582">apr_bucket_pipe_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b, 
<a name="l01453"></a>01453                                                <a class="code" href="group__apr__file__io.html#gaa46e4763ac375ea3c7a43ba6f6099e22">apr_file_t</a> *thispipe);
<a name="l01454"></a>01454 <span class="comment"></span>
<a name="l01455"></a>01455 <span class="comment">/**</span>
<a name="l01456"></a>01456 <span class="comment"> * Create a bucket referring to a file.</span>
<a name="l01457"></a>01457 <span class="comment"> * @param fd The file to put in the bucket</span>
<a name="l01458"></a>01458 <span class="comment"> * @param offset The offset where the data of interest begins in the file</span>
<a name="l01459"></a>01459 <span class="comment"> * @param len The amount of data in the file we are interested in</span>
<a name="l01460"></a>01460 <span class="comment"> * @param p The pool into which any needed structures should be created</span>
<a name="l01461"></a>01461 <span class="comment"> *          while reading from this file bucket</span>
<a name="l01462"></a>01462 <span class="comment"> * @param list The freelist from which this bucket should be allocated</span>
<a name="l01463"></a>01463 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01464"></a>01464 <span class="comment"> * @remark If the file is truncated such that the segment of the file</span>
<a name="l01465"></a>01465 <span class="comment"> * referenced by the bucket no longer exists, an attempt to read</span>
<a name="l01466"></a>01466 <span class="comment"> * from the bucket will fail with APR_EOF. </span>
<a name="l01467"></a>01467 <span class="comment"> * @remark apr_brigade_insert_file() should generally be used to</span>
<a name="l01468"></a>01468 <span class="comment"> * insert files into brigades, since that function can correctly</span>
<a name="l01469"></a>01469 <span class="comment"> * handle large file issues.</span>
<a name="l01470"></a>01470 <span class="comment"> */</span>
<a name="l01471"></a>01471 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga421f96e8e9387a9c27fe010ebdee0202">apr_bucket_file_create</a>(<a class="code" href="group__apr__file__io.html#gaa46e4763ac375ea3c7a43ba6f6099e22">apr_file_t</a> *fd,
<a name="l01472"></a>01472                                                  apr_off_t offset,
<a name="l01473"></a>01473                                                  apr_size_t len, 
<a name="l01474"></a>01474                                                  <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *p,
<a name="l01475"></a>01475                                                  <a class="code" href="group___a_p_r___util___bucket___brigades.html#ga9a30babfeb6e290db124d8f9b69e49e4">apr_bucket_alloc_t</a> *list);
<a name="l01476"></a>01476 <span class="comment"></span>
<a name="l01477"></a>01477 <span class="comment">/**</span>
<a name="l01478"></a>01478 <span class="comment"> * Make the bucket passed in a bucket refer to a file</span>
<a name="l01479"></a>01479 <span class="comment"> * @param b The bucket to make into a FILE bucket</span>
<a name="l01480"></a>01480 <span class="comment"> * @param fd The file to put in the bucket</span>
<a name="l01481"></a>01481 <span class="comment"> * @param offset The offset where the data of interest begins in the file</span>
<a name="l01482"></a>01482 <span class="comment"> * @param len The amount of data in the file we are interested in</span>
<a name="l01483"></a>01483 <span class="comment"> * @param p The pool into which any needed structures should be created</span>
<a name="l01484"></a>01484 <span class="comment"> *          while reading from this file bucket</span>
<a name="l01485"></a>01485 <span class="comment"> * @return The new bucket, or NULL if allocation failed</span>
<a name="l01486"></a>01486 <span class="comment"> */</span>
<a name="l01487"></a>01487 APU_DECLARE(<a class="code" href="structapr__bucket.html">apr_bucket</a> *) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gacb716dea400092f2f8c84a3f0f6d3a10">apr_bucket_file_make</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b, <a class="code" href="group__apr__file__io.html#gaa46e4763ac375ea3c7a43ba6f6099e22">apr_file_t</a> *fd,
<a name="l01488"></a>01488                                                apr_off_t offset,
<a name="l01489"></a>01489                                                apr_size_t len, <a class="code" href="group__apr__pools.html#gaf137f28edcf9a086cd6bc36c20d7cdfb">apr_pool_t</a> *p);
<a name="l01490"></a>01490 <span class="comment"></span>
<a name="l01491"></a>01491 <span class="comment">/**</span>
<a name="l01492"></a>01492 <span class="comment"> * Enable or disable memory-mapping for a FILE bucket (default is enabled)</span>
<a name="l01493"></a>01493 <span class="comment"> * @param b The bucket</span>
<a name="l01494"></a>01494 <span class="comment"> * @param enabled Whether memory-mapping should be enabled</span>
<a name="l01495"></a>01495 <span class="comment"> * @return APR_SUCCESS normally, or an error code if the operation fails</span>
<a name="l01496"></a>01496 <span class="comment"> */</span>
<a name="l01497"></a>01497 APU_DECLARE(<a class="code" href="group__apr__errno.html#gaf76ee4543247e9fb3f3546203e590a6c">apr_status_t</a>) <a class="code" href="group___a_p_r___util___bucket___brigades.html#gab18ee46f66634c35ad79b6a74559cbb8">apr_bucket_file_enable_mmap</a>(<a class="code" href="structapr__bucket.html">apr_bucket</a> *b,
<a name="l01498"></a>01498                                                       <span class="keywordtype">int</span> enabled);
<a name="l01499"></a>01499 <span class="comment"></span>
<a name="l01500"></a>01500 <span class="comment">/** @} */</span>
<a name="l01501"></a>01501 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l01502"></a>01502 <span class="preprocessor"></span>}
<a name="l01503"></a>01503 <span class="preprocessor">#endif</span>
<a name="l01504"></a>01504 <span class="preprocessor"></span>
<a name="l01505"></a>01505 <span class="preprocessor">#endif </span><span class="comment">/* !APR_BUCKETS_H */</span>
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated on Tue Feb 8 2011 for Apache Portable Runtime by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>