00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
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
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
00189
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
00252