00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef APR_POLL_H
00018 #define APR_POLL_H
00019
00023 #include "apr.h"
00024 #include "apr_pools.h"
00025 #include "apr_errno.h"
00026 #include "apr_inherit.h"
00027 #include "apr_file_io.h"
00028 #include "apr_network_io.h"
00029
00030 #if APR_HAVE_NETINET_IN_H
00031 #include <netinet/in.h>
00032 #endif
00033
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037
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
00057 #define APR_POLLSET_THREADSAFE 0x001
00060 typedef enum {
00061 APR_NO_DESC,
00062 APR_POLL_SOCKET,
00063 APR_POLL_FILE,
00064 APR_POLL_LASTDESC
00065 } apr_datatype_e ;
00066
00068 typedef union {
00069 apr_file_t *f;
00070 apr_socket_t *s;
00071 } apr_descriptor;
00072
00074 typedef struct apr_pollfd_t apr_pollfd_t;
00075
00077 struct apr_pollfd_t {
00078 apr_pool_t *p;
00079 apr_datatype_e desc_type;
00080 apr_int16_t reqevents;
00081 apr_int16_t rtnevents;
00082 apr_descriptor desc;
00083 void *client_data;
00084 };
00085
00086
00087
00088
00089
00090
00092 typedef struct apr_pollset_t apr_pollset_t;
00093
00108 APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset,
00109 apr_uint32_t size,
00110 apr_pool_t *p,
00111 apr_uint32_t flags);
00112
00117 APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset);
00118
00136 APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset,
00137 const apr_pollfd_t *descriptor);
00138
00153 APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset,
00154 const apr_pollfd_t *descriptor);
00155
00163 APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
00164 apr_interval_time_t timeout,
00165 apr_int32_t *num,
00166 const apr_pollfd_t **descriptors);
00167
00168
00184 APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t numsock,
00185 apr_int32_t *nsds,
00186 apr_interval_time_t timeout);
00187
00191 #ifdef __cplusplus
00192 }
00193 #endif
00194
00195 #endif
00196