00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
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
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
00228
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
00291