Sophie

Sophie

distrib > Mandriva > 10.2 > i586 > by-pkgid > 4f37b923758ceff94a2c0ccca62b4b43 > files > 89

libapr1-devel-1.1.1-1mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Apache Portable Runtime: apr_poll.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">home</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">oden</a>&nbsp;/&nbsp;<a class="el" href="dir_000002.html">RPM</a>&nbsp;/&nbsp;<a class="el" href="dir_000003.html">BUILD</a>&nbsp;/&nbsp;<a class="el" href="dir_000004.html">apr-1.1.1</a>&nbsp;/&nbsp;<a class="el" href="dir_000005.html">include</a></div>
<h1>apr_poll.h</h1><a href="apr__poll_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/* Copyright 2000-2004 The Apache Software Foundation</span>
00002 <span class="comment"> *</span>
00003 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
00004 <span class="comment"> * you may not use this file except in compliance with the License.</span>
00005 <span class="comment"> * You may obtain a copy of the License at</span>
00006 <span class="comment"> *</span>
00007 <span class="comment"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
00008 <span class="comment"> *</span>
00009 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
00010 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
00011 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
00012 <span class="comment"> * See the License for the specific language governing permissions and</span>
00013 <span class="comment"> * limitations under the License.</span>
00014 <span class="comment"> */</span>
00015 
00016 <span class="preprocessor">#ifndef APR_POLL_H</span>
00017 <span class="preprocessor"></span><span class="preprocessor">#define APR_POLL_H</span>
00018 <span class="preprocessor"></span><span class="comment">/**</span>
00019 <span class="comment"> * @file apr_poll.h</span>
00020 <span class="comment"> * @brief APR Poll interface</span>
00021 <span class="comment"> */</span>
00022 <span class="preprocessor">#include "<a class="code" href="apr_8h.html">apr.h</a>"</span>
00023 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
00024 <span class="preprocessor">#include "<a class="code" href="apr__errno_8h.html">apr_errno.h</a>"</span>
00025 <span class="preprocessor">#include "<a class="code" href="apr__inherit_8h.html">apr_inherit.h</a>"</span> 
00026 <span class="preprocessor">#include "<a class="code" href="apr__file__io_8h.html">apr_file_io.h</a>"</span> 
00027 <span class="preprocessor">#include "<a class="code" href="apr__network__io_8h.html">apr_network_io.h</a>"</span> 
00028 
00029 <span class="preprocessor">#if APR_HAVE_NETINET_IN_H</span>
00030 <span class="preprocessor"></span><span class="preprocessor">#include &lt;netinet/in.h&gt;</span>
00031 <span class="preprocessor">#endif</span>
00032 <span class="preprocessor"></span>
00033 <span class="preprocessor">#ifdef __cplusplus</span>
00034 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00035 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
00036 <span class="comment"></span>
00037 <span class="comment">/**</span>
00038 <span class="comment"> * @defgroup apr_poll Poll Routines</span>
00039 <span class="comment"> * @ingroup APR </span>
00040 <span class="comment"> * @{</span>
00041 <span class="comment"> */</span>
00042 <span class="comment"></span>
00043 <span class="comment">/**</span>
00044 <span class="comment"> * Poll options</span>
00045 <span class="comment"> */</span>
<a name="l00046"></a><a class="code" href="group__apr__poll.html#ga8">00046</a> <span class="preprocessor">#define APR_POLLIN    0x001     </span><span class="comment">/**&lt; Can read without blocking */</span>
<a name="l00047"></a><a class="code" href="group__apr__poll.html#ga9">00047</a> <span class="preprocessor">#define APR_POLLPRI   0x002     </span><span class="comment">/**&lt; Priority data available */</span>
<a name="l00048"></a><a class="code" href="group__apr__poll.html#ga10">00048</a> <span class="preprocessor">#define APR_POLLOUT   0x004     </span><span class="comment">/**&lt; Can write without blocking */</span>
<a name="l00049"></a><a class="code" href="group__apr__poll.html#ga11">00049</a> <span class="preprocessor">#define APR_POLLERR   0x010     </span><span class="comment">/**&lt; Pending error */</span>
<a name="l00050"></a><a class="code" href="group__apr__poll.html#ga12">00050</a> <span class="preprocessor">#define APR_POLLHUP   0x020     </span><span class="comment">/**&lt; Hangup occurred */</span>
<a name="l00051"></a><a class="code" href="group__apr__poll.html#ga13">00051</a> <span class="preprocessor">#define APR_POLLNVAL  0x040     </span><span class="comment">/**&lt; Descriptior invalid */</span>
00052 <span class="comment"></span>
00053 <span class="comment">/**</span>
00054 <span class="comment"> * Pollset Flags</span>
00055 <span class="comment"> */</span>
<a name="l00056"></a><a class="code" href="group__apr__poll.html#ga14">00056</a> <span class="preprocessor">#define APR_POLLSET_THREADSAFE 0x001 </span><span class="comment">/**&lt; Adding or Removing a Descriptor is thread safe */</span>
00057 <span class="comment"></span>
00058 <span class="comment">/** Used in apr_pollfd_t to determine what the apr_descriptor is */</span>
<a name="l00059"></a><a class="code" href="group__apr__poll.html#ga15">00059</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> { 
00060     APR_NO_DESC,                <span class="comment">/**&lt; nothing here */</span>
00061     APR_POLL_SOCKET,            <span class="comment">/**&lt; descriptor refers to a socket */</span>
00062     APR_POLL_FILE,              <span class="comment">/**&lt; descriptor refers to a file */</span>
00063     <a class="code" href="group__apr__poll.html#gga15a12">APR_POLL_LASTDESC</a>           <span class="comment">/**&lt; descriptor is the last one in the list */</span>
00064 } apr_datatype_e ;
00065 <span class="comment"></span>
00066 <span class="comment">/** Union of either an APR file or socket. */</span>
<a name="l00067"></a><a class="code" href="unionapr__descriptor.html">00067</a> <span class="keyword">typedef</span> <span class="keyword">union </span>{
<a name="l00068"></a><a class="code" href="unionapr__descriptor.html#o0">00068</a>     <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *f;              <span class="comment">/**&lt; file */</span>
<a name="l00069"></a><a class="code" href="unionapr__descriptor.html#o1">00069</a>     <a class="code" href="group__apr__network__io.html#ga0">apr_socket_t</a> *s;            <span class="comment">/**&lt; socket */</span>
00070 } <a class="code" href="unionapr__descriptor.html">apr_descriptor</a>;
00071 <span class="comment"></span>
00072 <span class="comment">/** @see apr_pollfd_t */</span>
<a name="l00073"></a><a class="code" href="group__apr__poll.html#ga0">00073</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__pollfd__t.html">apr_pollfd_t</a> <a class="code" href="group__apr__poll.html#ga0">apr_pollfd_t</a>;
00074 <span class="comment"></span>
00075 <span class="comment">/** Poll descriptor set. */</span>
<a name="l00076"></a><a class="code" href="structapr__pollfd__t.html">00076</a> <span class="keyword">struct </span><a class="code" href="group__apr__poll.html#ga0">apr_pollfd_t</a> {
<a name="l00077"></a><a class="code" href="structapr__pollfd__t.html#o0">00077</a>     <a class="code" href="group__apr__pools.html#ga0">apr_pool_t</a> *p;              <span class="comment">/**&lt; associated pool */</span>
<a name="l00078"></a><a class="code" href="structapr__pollfd__t.html#o1">00078</a>     <a class="code" href="group__apr__poll.html#ga15">apr_datatype_e</a> desc_type;   <span class="comment">/**&lt; descriptor type */</span>
<a name="l00079"></a><a class="code" href="structapr__pollfd__t.html#o2">00079</a>     apr_int16_t reqevents;      <span class="comment">/**&lt; requested events */</span>
<a name="l00080"></a><a class="code" href="structapr__pollfd__t.html#o3">00080</a>     apr_int16_t rtnevents;      <span class="comment">/**&lt; returned events */</span>
<a name="l00081"></a><a class="code" href="structapr__pollfd__t.html#o4">00081</a>     <a class="code" href="unionapr__descriptor.html">apr_descriptor</a> desc;        <span class="comment">/**&lt; @see apr_descriptor */</span>
<a name="l00082"></a><a class="code" href="structapr__pollfd__t.html#o5">00082</a>     <span class="keywordtype">void</span> *client_data;          <span class="comment">/**&lt; allows app to associate context */</span>
00083 };
00084 
00085 
00086 <span class="comment">/* General-purpose poll API for arbitrarily large numbers of</span>
00087 <span class="comment"> * file descriptors</span>
00088 <span class="comment"> */</span>
00089 <span class="comment"></span>
00090 <span class="comment">/** Opaque structure used for pollset API */</span>
<a name="l00091"></a><a class="code" href="group__apr__poll.html#ga1">00091</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__poll.html#ga1">apr_pollset_t</a> <a class="code" href="group__apr__poll.html#ga1">apr_pollset_t</a>;
00092 <span class="comment"></span>
00093 <span class="comment">/**</span>
00094 <span class="comment"> * Setup a pollset object</span>
00095 <span class="comment"> * @param pollset  The pointer in which to return the newly created object </span>
00096 <span class="comment"> * @param size The maximum number of descriptors that this pollset can hold</span>
00097 <span class="comment"> * @param p The pool from which to allocate the pollset</span>
00098 <span class="comment"> * @param flags Optional flags to modify the operation of the pollset.</span>
00099 <span class="comment"> *</span>
00100 <span class="comment"> * @remark If flags equals APR_POLLSET_THREADSAFE, then a pollset is</span>
00101 <span class="comment"> * created on which it is safe to make concurrent calls to</span>
00102 <span class="comment"> * apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll() from</span>
00103 <span class="comment"> * separate threads.  This feature is only supported on some</span>
00104 <span class="comment"> * platforms; the apr_pollset_create() call will fail with</span>
00105 <span class="comment"> * APR_ENOTIMPL on platforms where it is not supported.</span>
00106 <span class="comment"> */</span>
00107 <a class="code" href="group__apr__platform.html#ga123">APR_DECLARE</a>(apr_status_t) apr_pollset_create(apr_pollset_t **pollset,
00108                                              apr_uint32_t size,
00109                                              apr_pool_t *p,
00110                                              apr_uint32_t flags);
00111 <span class="comment"></span>
00112 <span class="comment">/**</span>
00113 <span class="comment"> * Destroy a pollset object</span>
00114 <span class="comment"> * @param pollset The pollset to destroy</span>
00115 <span class="comment"> */</span>
00116 APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset);
00117 <span class="comment"></span>
00118 <span class="comment">/**</span>
00119 <span class="comment"> * Add a socket or file descriptor to a pollset</span>
00120 <span class="comment"> * @param pollset The pollset to which to add the descriptor</span>
00121 <span class="comment"> * @param descriptor The descriptor to add</span>
00122 <span class="comment"> * @remark If you set client_data in the descriptor, that value</span>
00123 <span class="comment"> *         will be returned in the client_data field whenever this</span>
00124 <span class="comment"> *         descriptor is signalled in apr_pollset_poll().</span>
00125 <span class="comment"> */</span>
00126 APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset,
00127                                           const apr_pollfd_t *descriptor);
00128 <span class="comment"></span>
00129 <span class="comment">/**</span>
00130 <span class="comment"> * Remove a descriptor from a pollset</span>
00131 <span class="comment"> * @param pollset The pollset from which to remove the descriptor</span>
00132 <span class="comment"> * @param descriptor The descriptor to remove</span>
00133 <span class="comment"> */</span>
00134 APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset,
00135                                              const apr_pollfd_t *descriptor);
00136 <span class="comment"></span>
00137 <span class="comment">/**</span>
00138 <span class="comment"> * Block for activity on the descriptor(s) in a pollset</span>
00139 <span class="comment"> * @param pollset The pollset to use</span>
00140 <span class="comment"> * @param timeout Timeout in microseconds</span>
00141 <span class="comment"> * @param num Number of signalled descriptors (output parameter)</span>
00142 <span class="comment"> * @param descriptors Array of signalled descriptors (output parameter)</span>
00143 <span class="comment"> */</span>
00144 APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
00145                                            apr_interval_time_t timeout,
00146                                            apr_int32_t *num,
00147                                            const apr_pollfd_t **descriptors);
00148 
00149 <span class="comment"></span>
00150 <span class="comment">/**</span>
00151 <span class="comment"> * Poll the sockets in the poll structure</span>
00152 <span class="comment"> * @param aprset The poll structure we will be using. </span>
00153 <span class="comment"> * @param numsock The number of sockets we are polling</span>
00154 <span class="comment"> * @param nsds The number of sockets signalled.</span>
00155 <span class="comment"> * @param timeout The amount of time in microseconds to wait.  This is </span>
00156 <span class="comment"> *                a maximum, not a minimum.  If a socket is signalled, we </span>
00157 <span class="comment"> *                will wake up before this time.  A negative number means </span>
00158 <span class="comment"> *                wait until a socket is signalled.</span>
00159 <span class="comment"> * @remark The number of sockets signalled is returned in the third argument. </span>
00160 <span class="comment"> *         This is a blocking call, and it will not return until either a </span>
00161 <span class="comment"> *         socket has been signalled, or the timeout has expired. </span>
00162 <span class="comment"> */</span>
00163 APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t numsock,
00164                                    apr_int32_t *nsds, 
00165                                    apr_interval_time_t timeout);
00166 <span class="comment"></span>
00167 <span class="comment">/** @} */</span>
00168 
00169 
00170 #ifdef __cplusplus
00171 }
00172 #endif
00173 
00174 #endif  <span class="comment">/* ! APR_POLL_H */</span>
00175 
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Mar 20 19:52:26 2005 for Apache Portable Runtime by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>
</body>
</html>