Apache Portable Runtime
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apr_network_io.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 APR_NETWORK_IO_H
18 #define APR_NETWORK_IO_H
19 /**
20  * @file apr_network_io.h
21  * @brief APR Network library
22  */
23 
24 #include "apr.h"
25 #include "apr_pools.h"
26 #include "apr_file_io.h"
27 #include "apr_errno.h"
28 #include "apr_inherit.h"
29 
30 #if APR_HAVE_NETINET_IN_H
31 #include <netinet/in.h>
32 #endif
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37 
38 /**
39  * @defgroup apr_network_io Network Routines
40  * @ingroup APR
41  * @{
42  */
43 
44 #ifndef APR_MAX_SECS_TO_LINGER
45 /** Maximum seconds to linger */
46 #define APR_MAX_SECS_TO_LINGER 30
47 #endif
48 
49 #ifndef APRMAXHOSTLEN
50 /** Maximum hostname length */
51 #define APRMAXHOSTLEN 256
52 #endif
53 
54 #ifndef APR_ANYADDR
55 /** Default 'any' address */
56 #define APR_ANYADDR "0.0.0.0"
57 #endif
58 
59 /**
60  * @defgroup apr_sockopt Socket option definitions
61  * @{
62  */
63 #define APR_SO_LINGER 1 /**< Linger */
64 #define APR_SO_KEEPALIVE 2 /**< Keepalive */
65 #define APR_SO_DEBUG 4 /**< Debug */
66 #define APR_SO_NONBLOCK 8 /**< Non-blocking IO */
67 #define APR_SO_REUSEADDR 16 /**< Reuse addresses */
68 #define APR_SO_SNDBUF 64 /**< Send buffer */
69 #define APR_SO_RCVBUF 128 /**< Receive buffer */
70 #define APR_SO_DISCONNECTED 256 /**< Disconnected */
71 #define APR_TCP_NODELAY 512 /**< For SCTP sockets, this is mapped
72  * to STCP_NODELAY internally.
73  */
74 #define APR_TCP_NOPUSH 1024 /**< No push */
75 #define APR_RESET_NODELAY 2048 /**< This flag is ONLY set internally
76  * when we set APR_TCP_NOPUSH with
77  * APR_TCP_NODELAY set to tell us that
78  * APR_TCP_NODELAY should be turned on
79  * again when NOPUSH is turned off
80  */
81 #define APR_INCOMPLETE_READ 4096 /**< Set on non-blocking sockets
82  * (timeout != 0) on which the
83  * previous read() did not fill a buffer
84  * completely. the next apr_socket_recv()
85  * will first call select()/poll() rather than
86  * going straight into read(). (Can also
87  * be set by an application to force a
88  * select()/poll() call before the next
89  * read, in cases where the app expects
90  * that an immediate read would fail.)
91  */
92 #define APR_INCOMPLETE_WRITE 8192 /**< like APR_INCOMPLETE_READ, but for write
93  * @see APR_INCOMPLETE_READ
94  */
95 #define APR_IPV6_V6ONLY 16384 /**< Don't accept IPv4 connections on an
96  * IPv6 listening socket.
97  */
98 #define APR_TCP_DEFER_ACCEPT 32768 /**< Delay accepting of new connections
99  * until data is available.
100  * @see apr_socket_accept_filter
101  */
102 
103 /** @} */
104 
105 /** Define what type of socket shutdown should occur. */
106 typedef enum {
107  APR_SHUTDOWN_READ, /**< no longer allow read request */
108  APR_SHUTDOWN_WRITE, /**< no longer allow write requests */
109  APR_SHUTDOWN_READWRITE /**< no longer allow read or write requests */
111 
112 #define APR_IPV4_ADDR_OK 0x01 /**< @see apr_sockaddr_info_get() */
113 #define APR_IPV6_ADDR_OK 0x02 /**< @see apr_sockaddr_info_get() */
114 
115 #if (!APR_HAVE_IN_ADDR)
116 /**
117  * We need to make sure we always have an in_addr type, so APR will just
118  * define it ourselves, if the platform doesn't provide it.
119  */
120 struct in_addr {
121  apr_uint32_t s_addr; /**< storage to hold the IP# */
122 };
123 #endif
124 
125 /** @def APR_INADDR_NONE
126  * Not all platforms have a real INADDR_NONE. This macro replaces
127  * INADDR_NONE on all platforms.
128  */
129 #ifdef INADDR_NONE
130 #define APR_INADDR_NONE INADDR_NONE
131 #else
132 #define APR_INADDR_NONE ((unsigned int) 0xffffffff)
133 #endif
134 
135 /**
136  * @def APR_INET
137  * Not all platforms have these defined, so we'll define them here
138  * The default values come from FreeBSD 4.1.1
139  */
140 #define APR_INET AF_INET
141 /** @def APR_UNSPEC
142  * Let the system decide which address family to use
143  */
144 #ifdef AF_UNSPEC
145 #define APR_UNSPEC AF_UNSPEC
146 #else
147 #define APR_UNSPEC 0
148 #endif
149 #if APR_HAVE_IPV6
150 /** @def APR_INET6
151 * IPv6 Address Family. Not all platforms may have this defined.
152 */
153 
154 #define APR_INET6 AF_INET6
155 #endif
156 
157 /**
158  * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
159  * @{
160  */
161 #define APR_PROTO_TCP 6 /**< TCP */
162 #define APR_PROTO_UDP 17 /**< UDP */
163 #define APR_PROTO_SCTP 132 /**< SCTP */
164 /** @} */
165 
166 /**
167  * Enum used to denote either the local and remote endpoint of a
168  * connection.
169  */
170 typedef enum {
171  APR_LOCAL, /**< Socket information for local end of connection */
172  APR_REMOTE /**< Socket information for remote end of connection */
174 
175 /**
176  * The specific declaration of inet_addr's ... some platforms fall back
177  * inet_network (this is not good, but necessary)
178  */
179 
180 #if APR_HAVE_INET_ADDR
181 #define apr_inet_addr inet_addr
182 #elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
183 /**
184  * @warning
185  * not generally safe... inet_network() and inet_addr() perform
186  * different functions */
187 #define apr_inet_addr inet_network
188 #endif
189 
190 /** A structure to represent sockets */
191 typedef struct apr_socket_t apr_socket_t;
192 /**
193  * A structure to encapsulate headers and trailers for apr_socket_sendfile
194  */
195 typedef struct apr_hdtr_t apr_hdtr_t;
196 /** A structure to represent in_addr */
197 typedef struct in_addr apr_in_addr_t;
198 /** A structure to represent an IP subnet */
200 
201 /** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
114 
115 #if (!APR_HAVE_IN_ADDR)
116 /**
117  * We need to make sure we always have an in_addr type, so APR will just
118  * define it ourselves, if the platform doesn't provide it.
119  */
120 struct in_addr {
121  apr_uint32_t s_addr; /**< storage to hold the IP# */
122 };
123 #endif
124 
125 /** @def APR_INADDR_NONE
126  * Not all platforms have a real INADDR_NONE. This macro replaces
127  * INADDR_NONE on all platforms.
128  */
129 #ifdef INADDR_NONE
130 #define APR_INADDR_NONE INADDR_NONE
131 #else
132 #define APR_INADDR_NONE ((unsigned int) 0xffffffff)
133 #endif
134 
135 /**
136  * @def APR_INET
137  * Not all platforms have these defined, so we'll define them here
138  * The default values come from FreeBSD 4.1.1
139  */
140 #define APR_INET AF_INET
141 /** @def APR_UNSPEC
142  * Let the system decide which address family to use
143  */
144 #ifdef AF_UNSPEC
145 #define APR_UNSPEC AF_UNSPEC
146 #else
147 #define APR_UNSPEC 0
148 #endif
149 #if APR_HAVE_IPV6
150 /** @def APR_INET6
151 * IPv6 Address Family. Not all platforms may have this defined.
152 */
153 
154 #define APR_INET6 AF_INET6
155 #endif
156 
157 /**
158  * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
159  * @{
160  */
161 #define APR_PROTO_TCP 6 /**< TCP */
162 #define APR_PROTO_UDP 17 /**< UDP */
163 #define APR_PROTO_SCTP 132 /**< SCTP */
164 /** @} */
165 
166 /**
167  * Enum used to denote either the local and remote endpoint of a
168  * connection.
169  */
170 typedef enum {
171  APR_LOCAL, /**< Socket information for local end of connection */
172  APR_REMOTE /**< Socket information for remote end of connection */
174 
175 /**
176  * The specific declaration of inet_addr's ... some platforms fall back
177  * inet_network (this is not good, but necessary)
178  */
179 
180 #if APR_HAVE_INET_ADDR
181 #define apr_inet_addr inet_addr
182 #elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
183 /**
184  * @warning
185  * not generally safe... inet_network() and inet_addr() perform
186  * different functions */
187 #define apr_inet_addr inet_network
188 #endif
189 
190 /** A structure to represent sockets */
191 typedef struct apr_socket_t apr_socket_t;
192 /**
193  * A structure to encapsulate headers and trailers for apr_socket_sendfile
194  */
195 typedef struct apr_hdtr_t apr_hdtr_t;
196 /** A structure to represent in_addr */
197 typedef struct in_addr apr_in_addr_t;
198 /** A structure to represent an IP subnet */
200 
201 /** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
114 
115 #if (!APR_HAVE_IN_ADDR)
116 /**
117  * We need to make sure we always have an in_addr type, so APR will just
118  * define it ourselves, if the platform doesn't provide it.
119  */
120 struct in_addr {
121  apr_uint32_t s_addr; /**< storage to hold the IP# */
122 };
123 #endif
124 
125 /** @def APR_INADDR_NONE
126  * Not all platforms have a real INADDR_NONE. This macro replaces
127  * INADDR_NONE on all platforms.
128  */
129 #ifdef INADDR_NONE
130 #define APR_INADDR_NONE INADDR_NONE
131 #else
132 #define APR_INADDR_NONE ((unsigned int) 0xffffffff)
133 #endif
134 
135 /**
136  * @def APR_INET
137  * Not all platforms have these defined, so we'll define them here
138  * The default values come from FreeBSD 4.1.1
139  */
140 #define APR_INET AF_INET
141 /** @def APR_UNSPEC
142  * Let the system decide which address family to use
143  */
144 #ifdef AF_UNSPEC
145 #define APR_UNSPEC AF_UNSPEC
146 #else
147 #define APR_UNSPEC 0
148 #endif
149 #if APR_HAVE_IPV6
150 /** @def APR_INET6
151 * IPv6 Address Family. Not all platforms may have this defined.
152 */
153 
154 #define APR_INET6 AF_INET6
155 #endif
156 
157 /**
158  * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
159  * @{
160  */
161 #define APR_PROTO_TCP 6 /**< TCP */
162 #define APR_PROTO_UDP 17 /**< UDP */
163 #define APR_PROTO_SCTP 132 /**< SCTP */
164 /** @} */
165 
166 /**
167  * Enum used to denote either the local and remote endpoint of a
168  * connection.
169  */
170 typedef enum {
171  APR_LOCAL, /**< Socket information for local end of connection */
172  APR_REMOTE /**< Socket information for remote end of connection */
174 
175 /**
176  * The specific declaration of inet_addr's ... some platforms fall back
177  * inet_network (this is not good, but necessary)
178  */
179 
180 #if APR_HAVE_INET_ADDR
181 #define apr_inet_addr inet_addr
182 #elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
183 /**
184  * @warning
185  * not generally safe... inet_network() and inet_addr() perform
186  * different functions */
187 #define apr_inet_addr inet_network
188 #endif
189 
190 /** A structure to represent sockets */
191 typedef struct apr_socket_t apr_socket_t;
192 /**
193  * A structure to encapsulate headers and trailers for apr_socket_sendfile
194  */
195 typedef struct apr_hdtr_t apr_hdtr_t;
196 /** A structure to represent in_addr */
197 typedef struct in_addr apr_in_addr_t;
198 /** A structure to represent an IP subnet */
200 
201 /** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
114 
115 #if (!APR_HAVE_IN_ADDR)
116 /**
117  * We need to make sure we always have an in_addr type, so APR will just
118  * define it ourselves, if the platform doesn't provide it.
119  */
120 struct in_addr {
121  apr_uint32_t s_addr; /**< storage to hold the IP# */
122 };
123 #endif
124 
125 /** @def APR_INADDR_NONE
126  * Not all platforms have a real INADDR_NONE. This macro replaces
127  * INADDR_NONE on all platforms.
128  */
129 #ifdef INADDR_NONE
130 #define APR_INADDR_NONE INADDR_NONE
131 #else
132 #define APR_INADDR_NONE ((unsigned int) 0xffffffff)
133 #endif
134 
135 /**
136  * @def APR_INET
137  * Not all platforms have these defined, so we'll define them here
138  * The default values come from FreeBSD 4.1.1
139  */
140 #define APR_INET AF_INET
141 /** @def APR_UNSPEC
142  * Let the system decide which address family to use
143  */
144 #ifdef AF_UNSPEC
145 #define APR_UNSPEC AF_UNSPEC
146 #else
147 #define APR_UNSPEC 0
148 #endif
149 #if APR_HAVE_IPV6
150 /** @def APR_INET6
151 * IPv6 Address Family. Not all platforms may have this defined.
152 */
153 
154 #define APR_INET6 AF_INET6
155 #endif
156 
157 /**
158  * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
159  * @{
160  */
161 #define APR_PROTO_TCP 6 /**< TCP */
162 #define APR_PROTO_UDP 17 /**< UDP */
163 #define APR_PROTO_SCTP 132 /**< SCTP */
164 /** @} */
165 
166 /**
167  * Enum used to denote either the local and remote endpoint of a
168  * connection.
169  */
170 typedef enum {
171  APR_LOCAL, /**< Socket information for local end of connection */
172  APR_REMOTE /**< Socket information for remote end of connection */
174 
175 /**
176  * The specific declaration of inet_addr's ... some platforms fall back
177  * inet_network (this is not good, but necessary)
178  */
179 
180 #if APR_HAVE_INET_ADDR
181 #define apr_inet_addr inet_addr
182 #elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
183 /**
184  * @warning
185  * not generally safe... inet_network() and inet_addr() perform
186  * different functions */
187 #define apr_inet_addr inet_network
188 #endif
189 
190 /** A structure to represent sockets */
191 typedef struct apr_socket_t apr_socket_t;
192 /**
193  * A structure to encapsulate headers and trailers for apr_socket_sendfile
194  */
195 typedef struct apr_hdtr_t apr_hdtr_t;
196 /** A structure to represent in_addr */
197 typedef struct in_addr apr_in_addr_t;
198 /** A structure to represent an IP subnet */
200 
201 /** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
114 
115 #if (!APR_HAVE_IN_ADDR)
116 /**
117  * We need to make sure we always have an in_addr type, so APR will just
118  * define it ourselves, if the platform doesn't provide it.
119  */
120 struct in_addr {
121  apr_uint32_t s_addr; /**< storage to hold the IP# */
122 };
123 #endif
124 
125 /** @def APR_INADDR_NONE
126  * Not all platforms have a real INADDR_NONE. This macro replaces
127  * INADDR_NONE on all platforms.
128  */
129 #ifdef INADDR_NONE
130 #define APR_INADDR_NONE INADDR_NONE
131 #else
132 #define APR_INADDR_NONE ((unsigned int) 0xffffffff)
133 #endif
134 
135 /**
136  * @def APR_INET
137  * Not all platforms have these defined, so we'll define them here
138  * The default values come from FreeBSD 4.1.1
139  */
140 #define APR_INET AF_INET
141 /** @def APR_UNSPEC
142  * Let the system decide which address family to use
143  */
144 #ifdef AF_UNSPEC
145 #define APR_UNSPEC AF_UNSPEC
146 #else
147 #define APR_UNSPEC 0
148 #endif
149 #if APR_HAVE_IPV6
150 /** @def APR_INET6
151 * IPv6 Address Family. Not all platforms may have this defined.
152 */
153 
154 #define APR_INET6 AF_INET6
155 #endif
156 
157 /**
158  * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
159  * @{
160  */
161 #define APR_PROTO_TCP 6 /**< TCP */
162 #define APR_PROTO_UDP 17 /**< UDP */
163 #define APR_PROTO_SCTP 132 /**< SCTP */
164 /** @} */
165 
166 /**
167  * Enum used to denote either the local and remote endpoint of a
168  * connection.
169  */
170 typedef enum {
171  APR_LOCAL, /**< Socket information for local end of connection */
172  APR_REMOTE /**< Socket information for remote end of connection */
174 
175 /**
176  * The specific declaration of inet_addr's ... some platforms fall back
177  * inet_network (this is not good, but necessary)
178  */
179 
180 #if APR_HAVE_INET_ADDR
181 #define apr_inet_addr inet_addr
182 #elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
183 /**
184  * @warning
185  * not generally safe... inet_network() and inet_addr() perform
186  * different functions */
187 #define apr_inet_addr inet_network
188 #endif
189 
190 /** A structure to represent sockets */
191 typedef struct apr_socket_t apr_socket_t;
192 /**
193  * A structure to encapsulate headers and trailers for apr_socket_sendfile
194  */
195 typedef struct apr_hdtr_t apr_hdtr_t;
196 /** A structure to represent in_addr */
197 typedef struct in_addr apr_in_addr_t;
198 /** A structure to represent an IP subnet */
200 
201 /** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
114 
115 #if (!APR_HAVE_IN_ADDR)
116 /**
117  * We need to make sure we always have an in_addr type, so APR will just
118  * define it ourselves, if the platform doesn't provide it.
119  */
120 struct in_addr {
121  apr_uint32_t s_addr; /**< storage to hold the IP# */
122 };
123 #endif
124 
125 /** @def APR_INADDR_NONE
126  * Not all platforms have a real INADDR_NONE. This macro replaces
127  * INADDR_NONE on all platforms.
128  */
129 #ifdef INADDR_NONE
130 #define APR_INADDR_NONE INADDR_NONE
131 #else
132 #define APR_INADDR_NONE ((unsigned int) 0xffffffff)
133 #endif
134 
135 /**
136  * @def APR_INET
137  * Not all platforms have these defined, so we'll define them here
138  * The default values come from FreeBSD 4.1.1
139  */
140 #define APR_INET AF_INET
141 /** @def APR_UNSPEC
142  * Let the system decide which address family to use
143  */
144 #ifdef AF_UNSPEC
145 #define APR_UNSPEC AF_UNSPEC
146 #else
147 #define APR_UNSPEC 0
148 #endif
149 #if APR_HAVE_IPV6
150 /** @def APR_INET6
151 * IPv6 Address Family. Not all platforms may have this defined.
152 */
153 
154 #define APR_INET6 AF_INET6
155 #endif
156 
157 /**
158  * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
159  * @{
160  */
161 #define APR_PROTO_TCP 6 /**< TCP */
162 #define APR_PROTO_UDP 17 /**< UDP */
163 #define APR_PROTO_SCTP 132 /**< SCTP */
164 /** @} */
165 
166 /**
167  * Enum used to denote either the local and remote endpoint of a
168  * connection.
169  */
170 typedef enum {
171  APR_LOCAL, /**< Socket information for local end of connection */
172  APR_REMOTE /**< Socket information for remote end of connection */
174 
175 /**
176  * The specific declaration of inet_addr's ... some platforms fall back
177  * inet_network (this is not good, but necessary)
178  */
179 
180 #if APR_HAVE_INET_ADDR
181 #define apr_inet_addr inet_addr
182 #elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
183 /**
184  * @warning
185  * not generally safe... inet_network() and inet_addr() perform
186  * different functions */
187 #define apr_inet_addr inet_network
188 #endif
189 
190 /** A structure to represent sockets */
191 typedef struct apr_socket_t apr_socket_t;
192 /**
193  * A structure to encapsulate headers and trailers for apr_socket_sendfile
194  */
195 typedef struct apr_hdtr_t apr_hdtr_t;
196 /** A structure to represent in_addr */
197 typedef struct in_addr apr_in_addr_t;
198 /** A structure to represent an IP subnet */
200 
201 /** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
114 
115 #if (!APR_HAVE_IN_ADDR)
116 /**
117  * We need to make sure we always have an in_addr type, so APR will just
118  * define it ourselves, if the platform doesn't provide it.
119  */
120 struct in_addr {
121  apr_uint32_t s_addr; /**< storage to hold the IP# */
122 };
123 #endif
124 
125 /** @def APR_INADDR_NONE
126  * Not all platforms have a real INADDR_NONE. This macro replaces
127  * INADDR_NONE on all platforms.
128  */
129 #ifdef INADDR_NONE
130 #define APR_INADDR_NONE INADDR_NONE
131 #else
132 #define APR_INADDR_NONE ((unsigned int) 0xffffffff)
133 #endif
134 
135 /**
136  * @def APR_INET
137  * Not all platforms have these defined, so we'll define them here
138  * The default values come from FreeBSD 4.1.1
139  */
140 #define APR_INET AF_INET
141 /** @def APR_UNSPEC
142  * Let the system decide which address family to use
143  */
144 #ifdef AF_UNSPEC
145 #define APR_UNSPEC AF_UNSPEC
146 #else
147 #define APR_UNSPEC 0
148 #endif
149 #if APR_HAVE_IPV6
150 /** @def APR_INET6
151 * IPv6 Address Family. Not all platforms may have this defined.
152 */
153 
154 #define APR_INET6 AF_INET6
155 #endif
156 
157 /**
158  * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
159  * @{
160  */
161 #define APR_PROTO_TCP 6 /**< TCP */
162 #define APR_PROTO_UDP 17 /**< UDP */
163 #define APR_PROTO_SCTP 132 /**< SCTP */
164 /** @} */
165 
166 /**
167  * Enum used to denote either the local and remote endpoint of a
168  * connection.
169  */
170 typedef enum {
171  APR_LOCAL, /**< Socket information for local end of connection */
172  APR_REMOTE /**< Socket information for remote end of connection */
174 
175 /**
176  * The specific declaration of inet_addr's ... some platforms fall back
177  * inet_network (this is not good, but necessary)
178  */
179 
180 #if APR_HAVE_INET_ADDR
181 #define apr_inet_addr inet_addr
182 #elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
183 /**
184  * @warning
185  * not generally safe... inet_network() and inet_addr() perform
186  * different functions */
187 #define apr_inet_addr inet_network
188 #endif
189 
190 /** A structure to represent sockets */
191 typedef struct apr_socket_t apr_socket_t;
192 /**
193  * A structure to encapsulate headers and trailers for apr_socket_sendfile
194  */
195 typedef struct apr_hdtr_t apr_hdtr_t;
196 /** A structure to represent in_addr */
197 typedef struct in_addr apr_in_addr_t;
198 /** A structure to represent an IP subnet */
200 
201 /** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
114 
115 #if (!APR_HAVE_IN_ADDR)
116 /**
117  * We need to make sure we always have an in_addr type, so APR will just
118  * define it ourselves, if the platform doesn't provide it.
119  */
120 struct in_addr {
121  apr_uint32_t s_addr; /**< storage to hold the IP# */
122 };
123 #endif
124 
125 /** @def APR_INADDR_NONE
126  * Not all platforms have a real INADDR_NONE. This macro replaces
127  * INADDR_NONE on all platforms.
128  */
129 #ifdef INADDR_NONE
130 #define APR_INADDR_NONE INADDR_NONE
131 #else
132 #define APR_INADDR_NONE ((unsigned int) 0xffffffff)
133 #endif
134 
135 /**
136  * @def APR_INET
137  * Not all platforms have these defined, so we'll define them here
138  * The default values come from FreeBSD 4.1.1
139  */
140 #define APR_INET AF_INET
141 /** @def APR_UNSPEC
142  * Let the system decide which address family to use
143  */
144 #ifdef AF_UNSPEC
145 #define APR_UNSPEC AF_UNSPEC
146 #else
147 #define APR_UNSPEC 0
148 #endif
149 #if APR_HAVE_IPV6
150 /** @def APR_INET6
151 * IPv6 Address Family. Not all platforms may have this defined.
152 */
153 
154 #define APR_INET6 AF_INET6
155 #endif
156 
157 /**
158  * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
159  * @{
160  */
161 #define APR_PROTO_TCP 6 /**< TCP */
162 #define APR_PROTO_UDP 17 /**< UDP */
163 #define APR_PROTO_SCTP 132 /**< SCTP */
164 /** @} */
165 
166 /**
167  * Enum used to denote either the local and remote endpoint of a
168  * connection.
169  */
170 typedef enum {
171  APR_LOCAL, /**< Socket information for local end of connection */
172  APR_REMOTE /**< Socket information for remote end of connection */
174 
175 /**
176  * The specific declaration of inet_addr's ... some platforms fall back
177  * inet_network (this is not good, but necessary)
178  */
179 
180 #if APR_HAVE_INET_ADDR
181 #define apr_inet_addr inet_addr
182 #elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
183 /**
184  * @warning
185  * not generally safe... inet_network() and inet_addr() perform
186  * different functions */
187 #define apr_inet_addr inet_network
188 #endif
189 
190 /** A structure to represent sockets */
191 typedef struct apr_socket_t apr_socket_t;
192 /**
193  * A structure to encapsulate headers and trailers for apr_socket_sendfile
194  */
195 typedef struct apr_hdtr_t apr_hdtr_t;
196 /** A structure to represent in_addr */
197 typedef struct in_addr apr_in_addr_t;
198 /** A structure to represent an IP subnet */
200 
201 /** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
114 
115 #if (!APR_HAVE_IN_ADDR)
116 /**
117  * We need to make sure we always have an in_addr type, so APR will just
118  * define it ourselves, if the platform doesn't provide it.
119  */
120 struct in_addr {
121  apr_uint32_t s_addr; /**< storage to hold the IP# */
122 };
123 #endif
124 
125 /** @def APR_INADDR_NONE
126  * Not all platforms have a real INADDR_NONE. This macro replaces
127  * INADDR_NONE on all platforms.
128  */
129 #ifdef INADDR_NONE
130 #define APR_INADDR_NONE INADDR_NONE
131 #else
132 #define APR_INADDR_NONE ((unsigned int) 0xffffffff)
133 #endif
134 
135 /**
136  * @def APR_INET
137  * Not all platforms have these defined, so we'll define them here
138