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

apr_poll.h

Go to the documentation of this file.
00001 /* Copyright 2000-2004 The Apache Software Foundation
00002  *
00003  * Licensed under the Apache License, Version 2.0 (the "License");
00004  * you may not use this file except in compliance with the License.
00005  * You may obtain a copy of the License at
00006  *
00007  *     http://www.apache.org/licenses/LICENSE-2.0
00008  *
00009  * Unless required by applicable law or agreed to in writing, software
00010  * distributed under the License is distributed on an "AS IS" BASIS,
00011  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012  * See the License for the specific language governing permissions and
00013  * limitations under the License.
00014  */
00015 
00016 #ifndef APR_POLL_H
00017 #define APR_POLL_H
00018 
00022 #include "apr.h"
00023 #include "apr_pools.h"
00024 #include "apr_errno.h"
00025 #include "apr_inherit.h" 
00026 #include "apr_file_io.h" 
00027 #include "apr_network_io.h" 
00028 
00029 #if APR_HAVE_NETINET_IN_H
00030 #include <netinet/in.h>
00031 #endif
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif /* __cplusplus */
00036 
00047 #define APR_POLLIN    0x001     
00048 #define APR_POLLPRI   0x002     
00049 #define APR_POLLOUT   0x004     
00050 #define APR_POLLERR   0x010     
00051 #define APR_POLLHUP   0x020     
00052 #define APR_POLLNVAL  0x040     
00056 typedef enum { 
00057     APR_NO_DESC,                
00058     APR_POLL_SOCKET,            
00059     APR_POLL_FILE,              
00060     APR_POLL_LASTDESC           
00061 } apr_datatype_e ;
00062 
00064 typedef union {
00065     apr_file_t *f;              
00066     apr_socket_t *s;            
00067 } apr_descriptor;
00068 
00070 typedef struct apr_pollfd_t apr_pollfd_t;
00071 
00073 struct apr_pollfd_t {
00074     apr_pool_t *p;              
00075     apr_datatype_e desc_type;   
00076     apr_int16_t reqevents;      
00077     apr_int16_t rtnevents;      
00078     apr_descriptor desc;        
00079     void *client_data;          
00080 };
00081 
00089 APR_DECLARE(apr_status_t) apr_poll_setup(apr_pollfd_t **new_poll, 
00090                                          apr_int32_t num,
00091                                          apr_pool_t *cont);
00092 
00110 APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t numsock,
00111                                    apr_int32_t *nsds, 
00112                                    apr_interval_time_t timeout);
00113 
00126 APR_DECLARE(apr_status_t) apr_poll_socket_add(apr_pollfd_t *aprset, 
00127                                               apr_socket_t *sock,
00128                                               apr_int16_t event);
00129 
00142 APR_DECLARE(apr_status_t) apr_poll_socket_mask(apr_pollfd_t *aprset,
00143                                                apr_socket_t *sock,
00144                                                apr_int16_t events);
00151 APR_DECLARE(apr_status_t) apr_poll_socket_remove(apr_pollfd_t *aprset, 
00152                                                  apr_socket_t *sock);
00153 
00165 APR_DECLARE(apr_status_t) apr_poll_socket_clear(apr_pollfd_t *aprset, 
00166                                                  apr_int16_t events);
00167 
00184 APR_DECLARE(apr_status_t) apr_poll_revents_get(apr_int16_t *event, 
00185                                           apr_socket_t *sock,
00186                                           apr_pollfd_t *aprset);
00187 
00188 /* General-purpose poll API for arbitrarily large numbers of
00189  * file descriptors
00190  */
00191 
00193 typedef struct apr_pollset_t apr_pollset_t;
00194 
00203 APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset,
00204                                              apr_uint32_t size,
00205                                              apr_pool_t *p,
00206                                              apr_uint32_t flags);
00207 
00212 APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset);
00213 
00222 APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset,
00223                                           const apr_pollfd_t *descriptor);
00224 
00230 APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset,
00231                                              const apr_pollfd_t *descriptor);
00232 
00240 APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
00241                                            apr_interval_time_t timeout,
00242                                            apr_int32_t *num,
00243                                            const apr_pollfd_t **descriptors);
00244 
00247 #ifdef __cplusplus
00248 }
00249 #endif
00250 
00251 #endif  /* ! APR_POLL_H */
00252 

Generated on Fri Sep 17 11:18:21 2004 for Apache Portable Runtime by doxygen 1.3.5