Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

apr_poll.h

Go to the documentation of this file.
00001 /* ==================================================================== 00002 * The Apache Software License, Version 1.1 00003 * 00004 * Copyright (c) 2000-2003 The Apache Software Foundation. All rights 00005 * reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * 2. Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in 00016 * the documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * 3. The end-user documentation included with the redistribution, 00020 * if any, must include the following acknowledgment: 00021 * "This product includes software developed by the 00022 * Apache Software Foundation (http://www.apache.org/)." 00023 * Alternately, this acknowledgment may appear in the software itself, 00024 * if and wherever such third-party acknowledgments normally appear. 00025 * 00026 * 4. The names "Apache" and "Apache Software Foundation" must 00027 * not be used to endorse or promote products derived from this 00028 * software without prior written permission. For written 00029 * permission, please contact apache@apache.org. 00030 * 00031 * 5. Products derived from this software may not be called "Apache", 00032 * nor may "Apache" appear in their name, without prior written 00033 * permission of the Apache Software Foundation. 00034 * 00035 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00036 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00037 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00038 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00039 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00040 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00041 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00042 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00043 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00044 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00045 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00046 * SUCH DAMAGE. 00047 * ==================================================================== 00048 * 00049 * This software consists of voluntary contributions made by many 00050 * individuals on behalf of the Apache Software Foundation. For more 00051 * information on the Apache Software Foundation, please see 00052 * <http://www.apache.org/>. 00053 */ 00054 00055 #ifndef APR_POLL_H 00056 #define APR_POLL_H 00057 00061 #include "apr.h" 00062 #include "apr_pools.h" 00063 #include "apr_errno.h" 00064 #include "apr_inherit.h" 00065 #include "apr_file_io.h" 00066 #include "apr_network_io.h" 00067 00068 #if APR_HAVE_NETINET_IN_H 00069 #include <netinet/in.h> 00070 #endif 00071 00072 #ifdef __cplusplus 00073 extern "C" { 00074 #endif /* __cplusplus */ 00075 00086 #define APR_POLLIN 0x001 00087 #define APR_POLLPRI 0x002 00088 #define APR_POLLOUT 0x004 00089 #define APR_POLLERR 0x010 00090 #define APR_POLLHUP 0x020 00091 #define APR_POLLNVAL 0x040 00095 typedef enum { 00096 APR_NO_DESC, 00097 APR_POLL_SOCKET, 00098 APR_POLL_FILE, 00099 APR_POLL_LASTDESC 00100 } apr_datatype_e ; 00101 00103 typedef union { 00104 apr_file_t *f; 00105 apr_socket_t *s; 00106 } apr_descriptor; 00107 00109 typedef struct apr_pollfd_t apr_pollfd_t; 00110 00112 struct apr_pollfd_t { 00113 apr_pool_t *p; 00114 apr_datatype_e desc_type; 00115 apr_int16_t reqevents; 00116 apr_int16_t rtnevents; 00117 apr_descriptor desc; 00118 void *client_data; 00119 }; 00120 00128 APR_DECLARE(apr_status_t) apr_poll_setup(apr_pollfd_t **new_poll, 00129 apr_int32_t num, 00130 apr_pool_t *cont); 00131 00149 APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t numsock, 00150 apr_int32_t *nsds, 00151 apr_interval_time_t timeout); 00152 00165 APR_DECLARE(apr_status_t) apr_poll_socket_add(apr_pollfd_t *aprset, 00166 apr_socket_t *sock, 00167 apr_int16_t event); 00168 00181 APR_DECLARE(apr_status_t) apr_poll_socket_mask(apr_pollfd_t *aprset, 00182 apr_socket_t *sock, 00183 apr_int16_t events); 00190 APR_DECLARE(apr_status_t) apr_poll_socket_remove(apr_pollfd_t *aprset, 00191 apr_socket_t *sock); 00192 00204 APR_DECLARE(apr_status_t) apr_poll_socket_clear(apr_pollfd_t *aprset, 00205 apr_int16_t events); 00206 00223 APR_DECLARE(apr_status_t) apr_poll_revents_get(apr_int16_t *event, 00224 apr_socket_t *sock, 00225 apr_pollfd_t *aprset); 00226 00227 /* General-purpose poll API for arbitrarily large numbers of 00228 * file descriptors 00229 */ 00230 00232 typedef struct apr_pollset_t apr_pollset_t; 00233 00242 APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, 00243 apr_uint32_t size, 00244 apr_pool_t *p, 00245 apr_uint32_t flags); 00246 00251 APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset); 00252 00261 APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, 00262 const apr_pollfd_t *descriptor); 00263 00269 APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, 00270 const apr_pollfd_t *descriptor); 00271 00279 APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, 00280 apr_interval_time_t timeout, 00281 apr_int32_t *num, 00282 const apr_pollfd_t **descriptors); 00283 00286 #ifdef __cplusplus 00287 } 00288 #endif 00289 00290 #endif /* ! APR_POLL_H */ 00291

Generated on Wed Sep 1 05:15:08 2004 for Apache Portable Runtime by doxygen 1.3.8