Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apr_arch_networkio.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef NETWORK_IO_H
18 #define NETWORK_IO_H
19 
20 #include "apr.h"
21 #include "apr_private.h"
22 #include "apr_network_io.h"
23 #include "apr_errno.h"
24 #include "apr_general.h"
25 #include "apr_lib.h"
26 #ifndef WAITIO_USES_POLL
27 #include "apr_poll.h"
28 #endif
29 
30 /* System headers the network I/O library needs */
31 #if APR_HAVE_SYS_TYPES_H
32 #include <sys/types.h>
33 #endif
34 #if APR_HAVE_SYS_UIO_H
35 #include <sys/uio.h>
36 #endif
37 #ifdef HAVE_SYS_SELECT_H
38 #include <sys/select.h>
39 #endif
40 #if APR_HAVE_ERRNO_H
41 #include <errno.h>
42 #endif
43 #if APR_HAVE_SYS_TIME_H
44 #include <sys/time.h>
45 #endif
46 #if APR_HAVE_UNISTD_H
47 #include <unistd.h>
48 #endif
49 #if APR_HAVE_STRING_H
50 #include <string.h>
51 #endif
52 #if APR_HAVE_NETINET_TCP_H
53 #include <netinet/tcp.h>
54 #endif
55 #if APR_HAVE_NETINET_SCTP_UIO_H
56 #include <netinet/sctp_uio.h>
57 #endif
58 #if APR_HAVE_NETINET_SCTP_H
59 #include <netinet/sctp.h>
60 #endif
61 #if APR_HAVE_NETINET_IN_H
62 #include <netinet/in.h>
63 #endif
64 #if APR_HAVE_ARPA_INET_H
65 #include <arpa/inet.h>
66 #endif
67 #if APR_HAVE_SYS_SOCKET_H
68 #include <sys/socket.h>
69 #endif
70 #if APR_HAVE_SYS_SOCKIO_H
71 #include <sys/sockio.h>
72 #endif
73 #if APR_HAVE_NETDB_H
74 #include <netdb.h>
75 #endif
76 #if APR_HAVE_FCNTL_H
77 #include <fcntl.h>
78 #endif
79 #if APR_HAVE_SYS_SENDFILE_H
80 #include <sys/sendfile.h>
81 #endif
82 #if APR_HAVE_SYS_IOCTL_H
83 #include <sys/ioctl.h>
84 #endif
85 /* End System Headers */
86 
87 #ifndef HAVE_POLLIN
88 #define POLLIN 1
89 #define POLLPRI 2
90 #define POLLOUT 4
91 #define POLLERR 8
92 #define POLLHUP 16
93 #define POLLNVAL 32
94 #endif
95 
97 struct sock_userdata_t {
99  const char *key;
100  void *data;
101 };
102 
103 struct apr_socket_t {
104  apr_pool_t *pool;
105  int socketdes;
106  int type;
107  int protocol;
111 #ifndef HAVE_POLL
112  int connected;
113 #endif
114 #if APR_HAVE_SOCKADDR_UN
115  int bound;
116 #endif
117  int local_port_unknown;
123 #ifndef WAITIO_USES_POLL
124  /* if there is a timeout set, then this pollset is used */
126 #endif
127 };
128 
129 const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size);
130 int apr_inet_pton(int af, const char *src, void *dst);
132 
133 #define apr_is_option_set(skt, option) \
134  (((skt)->options & (option)) == (option))
135 
136 #define apr_set_option(skt, option, on) \
137  do { \
138  if (on) \
139  (skt)->options |= (option); \
140  else \
141  (skt)->options &= ~(option); \
142  } while (0)
143 
144 #endif /* ! NETWORK_IO_H */
145 
int apr_inet_pton(int af, const char *src, void *dst)
size_t apr_size_t
Definition: apr.h:375
int socketdes
Definition: apr_arch_networkio.h:39
APR Network library.
void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t)
int remote_addr_unknown
Definition: apr_arch_networkio.h:48
int protocol
Definition: apr_arch_networkio.h:41
int local_interface_unknown
Definition: apr_arch_networkio.h:47
const char * apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size)
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
APR Miscellaneous library routines.
APR Poll interface.
dav_buffer apr_size_t size
Definition: mod_dav.h:457
int local_port_unknown
Definition: apr_arch_networkio.h:46
Definition: apr_arch_networkio.h:37
dav_error * src
Definition: mod_dav.h:186
APR Error Codes.
APR Platform Definitions.
sock_userdata_t * userdata
Definition: apr_arch_networkio.h:51
APR general purpose library routines.
const char * key
Definition: apr_arch_networkio.h:33
sock_userdata_t * next
Definition: apr_arch_networkio.h:32
void * data
Definition: apr_arch_networkio.h:34
Definition: apr_arch_networkio.h:31
apr_sockaddr_t * remote_addr
Definition: apr_arch_networkio.h:43
apr_int32_t inherit
Definition: apr_arch_networkio.h:50
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
apr_int32_t options
Definition: apr_arch_networkio.h:49
apr_sockaddr_t * local_addr
Definition: apr_arch_networkio.h:42
apr_uint16_t apr_port_t
Definition: apr_network_io.h:257
int type
Definition: apr_arch_networkio.h:40
apr_interval_time_t timeout
Definition: apr_arch_networkio.h:44
apr_pool_t * pool
Definition: apr_arch_networkio.h:38
Definition: apr_network_io.h:266
apr_pollset_t * pollset
Definition: apr_arch_networkio.h:54
int apr_int32_t
Definition: apr.h:333
Definition: apr_arch_poll_private.h:119