Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > dc51c7d3f8a5588a609f484ef81504ee > files > 147

libfastcgipp-devel-1.1-2mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>fastcgi++: request.hpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
<h1>request.hpp</h1><a href="request_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="comment">/***************************************************************************</span>
<a name="l00003"></a>00003 <span class="comment">* Copyright (C) 2007 Eddie                                                 *</span>
<a name="l00004"></a>00004 <span class="comment">*                                                                          *</span>
<a name="l00005"></a>00005 <span class="comment">* This file is part of fastcgi++.                                          *</span>
<a name="l00006"></a>00006 <span class="comment">*                                                                          *</span>
<a name="l00007"></a>00007 <span class="comment">* fastcgi++ is free software: you can redistribute it and/or modify it     *</span>
<a name="l00008"></a>00008 <span class="comment">* under the terms of the GNU Lesser General Public License as  published   *</span>
<a name="l00009"></a>00009 <span class="comment">* by the Free Software Foundation, either version 3 of the License, or (at *</span>
<a name="l00010"></a>00010 <span class="comment">* your option) any later version.                                          *</span>
<a name="l00011"></a>00011 <span class="comment">*                                                                          *</span>
<a name="l00012"></a>00012 <span class="comment">* fastcgi++ is distributed in the hope that it will be useful, but WITHOUT *</span>
<a name="l00013"></a>00013 <span class="comment">* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    *</span>
<a name="l00014"></a>00014 <span class="comment">* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public     *</span>
<a name="l00015"></a>00015 <span class="comment">* License for more details.                                                *</span>
<a name="l00016"></a>00016 <span class="comment">*                                                                          *</span>
<a name="l00017"></a>00017 <span class="comment">* You should have received a copy of the GNU Lesser General Public License *</span>
<a name="l00018"></a>00018 <span class="comment">* along with fastcgi++.  If not, see &lt;http://www.gnu.org/licenses/&gt;.       *</span>
<a name="l00019"></a>00019 <span class="comment">****************************************************************************/</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef REQUEST_HPP</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define REQUEST_HPP</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;queue&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;map&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;locale&gt;</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;boost/shared_array.hpp&gt;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;boost/thread.hpp&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;boost/function.hpp&gt;</span>
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;<a class="code" href="protocol_8hpp.html" title="Defines FastCGI protocol.">fastcgi++/protocol.hpp</a>&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;<a class="code" href="exceptions_8hpp.html" title="Defines fastcgi++ exceptions.">fastcgi++/exceptions.hpp</a>&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;<a class="code" href="transceiver_8hpp.html" title="Defines the Fastcgipp::Transceiver class.">fastcgi++/transceiver.hpp</a>&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;<a class="code" href="fcgistream_8hpp.html" title="Defines the Fastcgipp::Fcgistream stream and stream buffer classes.">fastcgi++/fcgistream.hpp</a>&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;<a class="code" href="http_8hpp.html" title="Defines elements of the HTTP protocol.">fastcgi++/http.hpp</a>&gt;</span>
<a name="l00039"></a>00039 
<a name="l00041"></a>00041 <span class="keyword">namespace </span>Fastcgipp
<a name="l00042"></a>00042 {
<a name="l00044"></a>00044 
<a name="l00059"></a><a class="code" href="classFastcgipp_1_1Request.html">00059</a>    <span class="keyword">template</span>&lt;<span class="keyword">class</span> <span class="keywordtype">char</span>T&gt; <span class="keyword">class </span><a class="code" href="classFastcgipp_1_1Request.html" title="Request handling class">Request</a>
<a name="l00060"></a>00060    {
<a name="l00061"></a>00061    <span class="keyword">public</span>:
<a name="l00063"></a><a class="code" href="classFastcgipp_1_1Request.html#5498a2b8d01857354d002ffc9d7ed38f">00063</a>       <a class="code" href="classFastcgipp_1_1Request.html#5498a2b8d01857354d002ffc9d7ed38f" title="Initializes what it can. set() must be called by Manager before the data is usable...">Request</a>(): <a class="code" href="classFastcgipp_1_1Request.html#b9cdf24ba8ecb0bbdea2961309fc9c1e" title="What the request is current doing.">state</a>(Protocol::<a class="code" href="namespaceFastcgipp_1_1Protocol.html#79e41b489a9b2c0374eee108d375b6468c3fd24a63460c177a32875d5bbb53df">PARAMS</a>)  { <a class="code" href="classFastcgipp_1_1Request.html#10bf656234f3434bbc8f8702fa1a9af4" title="Set the requests locale.">setloc</a>(std::locale::classic()); <a class="code" href="classFastcgipp_1_1Request.html#a38c06ef67b75fed9c619e6195663d76" title="Standard output stream to the client.">out</a>.exceptions(std::ios_base::badbit | std::ios_base::failbit | std::ios_base::eofbit); <a class="code" href="classFastcgipp_1_1Request.html#d3a761c37a4ac0cf9154014c859431d0" title="Structure containing all HTTP session data.">session</a>.clearPostBuffer(); }
<a name="l00064"></a>00064 
<a name="l00065"></a>00065    <span class="keyword">protected</span>:
<a name="l00067"></a><a class="code" href="classFastcgipp_1_1Request.html#d3a761c37a4ac0cf9154014c859431d0">00067</a>       <a class="code" href="structFastcgipp_1_1Http_1_1Session.html" title="Data structure of HTTP session data.">Http::Session&lt;charT&gt;</a> <a class="code" href="classFastcgipp_1_1Request.html#d3a761c37a4ac0cf9154014c859431d0" title="Structure containing all HTTP session data.">session</a>;
<a name="l00068"></a>00068 
<a name="l00069"></a>00069       <span class="comment">// To dump data into the stream without it being code converted and bypassing the stream buffer call Fcgistream::dump(char* data, size_t size)</span>
<a name="l00070"></a>00070       <span class="comment">// or Fcgistream::dump(std::basic_istream&lt;char&gt;&amp; stream)</span>
<a name="l00071"></a>00071       
<a name="l00073"></a>00073 
<a name="l00076"></a><a class="code" href="classFastcgipp_1_1Request.html#a38c06ef67b75fed9c619e6195663d76">00076</a>       <a class="code" href="classFastcgipp_1_1Fcgistream.html" title="Stream class for output of client data through FastCGI.">Fcgistream&lt;charT, std::char_traits&lt;charT&gt;</a> &gt; <a class="code" href="classFastcgipp_1_1Request.html#a38c06ef67b75fed9c619e6195663d76" title="Standard output stream to the client.">out</a>;
<a name="l00077"></a>00077 
<a name="l00079"></a>00079 
<a name="l00082"></a><a class="code" href="classFastcgipp_1_1Request.html#315c69db15907f935e29cbf849d2413e">00082</a>       <a class="code" href="classFastcgipp_1_1Fcgistream.html" title="Stream class for output of client data through FastCGI.">Fcgistream&lt;charT, std::char_traits&lt;charT&gt;</a> &gt; <a class="code" href="classFastcgipp_1_1Request.html#315c69db15907f935e29cbf849d2413e" title="Output stream to the HTTP server error log.">err</a>;
<a name="l00083"></a>00083 
<a name="l00085"></a>00085 
<a name="l00093"></a>00093       <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classFastcgipp_1_1Request.html#b20544d056d5f288bca354b8c996e451" title="Response generator.">response</a>() =0;
<a name="l00094"></a>00094 
<a name="l00096"></a>00096 
<a name="l00106"></a><a class="code" href="classFastcgipp_1_1Request.html#681d9bfa18e340111a5cba0b9b7d2175">00106</a>       <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classFastcgipp_1_1Request.html#3b79d3899656b0161bb2f91dd27b2223" title="Generate a data input response.">inHandler</a>(<span class="keywordtype">int</span> bytesReceived) { };
<a name="l00107"></a>00107 
<a name="l00109"></a>00109       std::locale <a class="code" href="classFastcgipp_1_1Request.html#681d9bfa18e340111a5cba0b9b7d2175" title="The locale associated with the request. Should be set with setloc(), not directly...">loc</a>;
<a name="l00110"></a>00110 
<a name="l00112"></a>00112 
<a name="l00118"></a><a class="code" href="classFastcgipp_1_1Request.html#0fde0dd3d64f61a6662635f8481ee04a">00118</a>       <a class="code" href="structFastcgipp_1_1Message.html" title="Data structure used to pass messages within the fastcgi++ task management system...">Message</a> <a class="code" href="classFastcgipp_1_1Request.html#0fde0dd3d64f61a6662635f8481ee04a" title="The message associated with the current handler() call.">message</a>;
<a name="l00119"></a>00119 
<a name="l00121"></a>00121 
<a name="l00130"></a>00130       <span class="keywordtype">void</span> <a class="code" href="classFastcgipp_1_1Request.html#10bf656234f3434bbc8f8702fa1a9af4" title="Set the requests locale.">setloc</a>(std::locale loc_);
<a name="l00131"></a>00131 
<a name="l00133"></a>00133 
<a name="l00144"></a><a class="code" href="classFastcgipp_1_1Request.html#e3624e083a77cb21401d3c5ac97205b6">00144</a>       boost::function&lt;void(Message)&gt; <a class="code" href="classFastcgipp_1_1Request.html#e3624e083a77cb21401d3c5ac97205b6" title="Callback function for dealings outside the fastcgi++ library.">callback</a>;
<a name="l00145"></a>00145    <span class="keyword">private</span>:
<a name="l00147"></a>00147 
<a name="l00151"></a><a class="code" href="classFastcgipp_1_1Request_1_1Messages.html">00151</a>       <span class="keyword">class </span><a class="code" href="classFastcgipp_1_1Request_1_1Messages.html" title="Queue type for pending messages.">Messages</a>: <span class="keyword">public</span> std::queue&lt;Message&gt;, <span class="keyword">public</span> boost::mutex {};
<a name="l00153"></a><a class="code" href="classFastcgipp_1_1Request.html#c5b39366ff1a3291f711a6d63f52baab">00153</a>       <a class="code" href="classFastcgipp_1_1Request_1_1Messages.html" title="Queue type for pending messages.">Messages</a> <a class="code" href="classFastcgipp_1_1Request.html#c5b39366ff1a3291f711a6d63f52baab" title="A queue of messages to be handler by the request.">messages</a>;
<a name="l00154"></a>00154 
<a name="l00156"></a>00156 
<a name="l00163"></a>00163       <span class="keywordtype">bool</span> <a class="code" href="classFastcgipp_1_1Request.html#fb01e31a30e69ab7a2720172c3aab619" title="Request Handler.">handler</a>();
<a name="l00164"></a><a class="code" href="classFastcgipp_1_1Request.html#dddd5c43ff870a047aa66db4edf82a7e">00164</a>       <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classFastcgipp_1_1Manager.html" title="General task and protocol management class.">Manager</a>;
<a name="l00166"></a><a class="code" href="classFastcgipp_1_1Request.html#9ecf82dd494a233e4210e81e15cf9d78">00166</a>       <a class="code" href="classFastcgipp_1_1Transceiver.html" title="Handles low level communication with &amp;quot;the other side&amp;quot;.">Transceiver</a>* <a class="code" href="classFastcgipp_1_1Request.html#9ecf82dd494a233e4210e81e15cf9d78" title="Pointer to the transceiver object that will send data to the other side.">transceiver</a>;
<a name="l00168"></a><a class="code" href="classFastcgipp_1_1Request.html#112afffc10da7cf88dea1c5a636aa9ec">00168</a>       <a class="code" href="namespaceFastcgipp_1_1Protocol.html#f7523f6ab2986dfdbe73583b7d471569" title="Defines the possible roles a FastCGI application may play.">Protocol::Role</a> <a class="code" href="classFastcgipp_1_1Request.html#112afffc10da7cf88dea1c5a636aa9ec" title="The role that the other side expects this request to play.">role</a>;
<a name="l00170"></a><a class="code" href="classFastcgipp_1_1Request.html#a8e414b8cc963f73768b0930d2647926">00170</a>       <a class="code" href="structFastcgipp_1_1Protocol_1_1FullId.html" title="A full ID value for a FastCGI request.">Protocol::FullId</a> <a class="code" href="classFastcgipp_1_1Request.html#a8e414b8cc963f73768b0930d2647926" title="The complete ID (request id &amp;amp; file descriptor) associated with the request.">id</a>;
<a name="l00172"></a><a class="code" href="classFastcgipp_1_1Request.html#6a2178f465265f9d8913e8661283a885">00172</a>       <span class="keywordtype">bool</span> <a class="code" href="classFastcgipp_1_1Request.html#6a2178f465265f9d8913e8661283a885" title="Boolean value indicating whether or not the file descriptor should be closed upon...">killCon</a>;
<a name="l00174"></a><a class="code" href="classFastcgipp_1_1Request.html#b9cdf24ba8ecb0bbdea2961309fc9c1e">00174</a>       <a class="code" href="namespaceFastcgipp_1_1Protocol.html#79e41b489a9b2c0374eee108d375b646" title="Defines the types of records within the FastCGI protocol.">Protocol::RecordType</a> <a class="code" href="classFastcgipp_1_1Request.html#b9cdf24ba8ecb0bbdea2961309fc9c1e" title="What the request is current doing.">state</a>;
<a name="l00176"></a>00176       <span class="keywordtype">void</span> <a class="code" href="classFastcgipp_1_1Request.html#c74d29ec18ccdf7dbb538660c462c712" title="Generates an END_REQUEST FastCGI record.">complete</a>();
<a name="l00178"></a>00178 
<a name="l00187"></a><a class="code" href="classFastcgipp_1_1Request.html#d5dcbc6eb9e927f463a26c72957a87f8">00187</a>       <span class="keywordtype">void</span> <span class="keyword">set</span>(<a class="code" href="structFastcgipp_1_1Protocol_1_1FullId.html" title="A full ID value for a FastCGI request.">Protocol::FullId</a> id_, <a class="code" href="classFastcgipp_1_1Transceiver.html" title="Handles low level communication with &amp;quot;the other side&amp;quot;.">Transceiver</a>&amp; transceiver_, <a class="code" href="namespaceFastcgipp_1_1Protocol.html#f7523f6ab2986dfdbe73583b7d471569" title="Defines the possible roles a FastCGI application may play.">Protocol::Role</a> role_, <span class="keywordtype">bool</span> killCon_, boost::function&lt;void(Message)&gt; callback_)
<a name="l00188"></a>00188       {
<a name="l00189"></a>00189          <a class="code" href="classFastcgipp_1_1Request.html#6a2178f465265f9d8913e8661283a885" title="Boolean value indicating whether or not the file descriptor should be closed upon...">killCon</a>=killCon_;
<a name="l00190"></a>00190          <span class="keywordtype">id</span>=id_;
<a name="l00191"></a>00191          <a class="code" href="classFastcgipp_1_1Request.html#9ecf82dd494a233e4210e81e15cf9d78" title="Pointer to the transceiver object that will send data to the other side.">transceiver</a>=&amp;transceiver_;
<a name="l00192"></a>00192          <a class="code" href="classFastcgipp_1_1Request.html#112afffc10da7cf88dea1c5a636aa9ec" title="The role that the other side expects this request to play.">role</a>=role_;
<a name="l00193"></a>00193          <a class="code" href="classFastcgipp_1_1Request.html#e3624e083a77cb21401d3c5ac97205b6" title="Callback function for dealings outside the fastcgi++ library.">callback</a>=callback_;
<a name="l00194"></a>00194 
<a name="l00195"></a>00195          <a class="code" href="classFastcgipp_1_1Request.html#315c69db15907f935e29cbf849d2413e" title="Output stream to the HTTP server error log.">err</a>.<a class="code" href="classFastcgipp_1_1Fcgistream.html#2340bdcaab24edbe7f3e97332d98ccab" title="Arguments passed directly to Fcgibuf::set().">set</a>(id_, transceiver_, <a class="code" href="namespaceFastcgipp_1_1Protocol.html#79e41b489a9b2c0374eee108d375b646a7cb3de6b30e93d4b879fb03fc656676">Protocol::ERR</a>);
<a name="l00196"></a>00196          <a class="code" href="classFastcgipp_1_1Request.html#a38c06ef67b75fed9c619e6195663d76" title="Standard output stream to the client.">out</a>.<a class="code" href="classFastcgipp_1_1Fcgistream.html#2340bdcaab24edbe7f3e97332d98ccab" title="Arguments passed directly to Fcgibuf::set().">set</a>(id_, transceiver_, <a class="code" href="namespaceFastcgipp_1_1Protocol.html#79e41b489a9b2c0374eee108d375b64672b3e3ce36c558b14df3aadcec5bf0e6">Protocol::OUT</a>);
<a name="l00197"></a>00197       }
<a name="l00198"></a>00198    };
<a name="l00199"></a>00199 }
<a name="l00200"></a>00200 
<a name="l00201"></a>00201 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Sep 16 15:17:46 2008 for fastcgi++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>