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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include "apr_private.h"
22 #include "apr_network_io.h"
23 #include "apr_errno.h"
24 #include "apr_general.h"
26 #ifndef WAITIO_USES_POLL
30 /* System headers the network I/O library needs */
31 #if APR_HAVE_SYS_TYPES_H
32 #include <sys/types.h>
34 #if APR_HAVE_SYS_UIO_H
37 #ifdef HAVE_SYS_SELECT_H
38 #include <sys/select.h>
43 #if APR_HAVE_SYS_TIME_H
52 #if APR_HAVE_NETINET_TCP_H
53 #include <netinet/tcp.h>
55 #if APR_HAVE_NETINET_SCTP_UIO_H
56 #include <netinet/sctp_uio.h>
58 #if APR_HAVE_NETINET_SCTP_H
59 #include <netinet/sctp.h>
61 #if APR_HAVE_NETINET_IN_H
62 #include <netinet/in.h>
64 #if APR_HAVE_ARPA_INET_H
65 #include <arpa/inet.h>
67 #if APR_HAVE_SYS_SOCKET_H
68 #include <sys/socket.h>
70 #if APR_HAVE_SYS_SOCKIO_H
71 #include <sys/sockio.h>
79 #if APR_HAVE_SYS_SENDFILE_H
80 #include <sys/sendfile.h>
82 #if APR_HAVE_SYS_IOCTL_H
83 #include <sys/ioctl.h>
85 /* End System Headers */
96 typedef struct sock_userdata_t sock_userdata_t;
97 struct sock_userdata_t {
98 sock_userdata_t *next;
103 struct apr_socket_t {
108 apr_sockaddr_t *local_addr;
109 apr_sockaddr_t *remote_addr;
110 apr_interval_time_t timeout;
114 int local_port_unknown;
115 int local_interface_unknown;
116 int remote_addr_unknown;
119 sock_userdata_t *userdata;
120 #ifndef WAITIO_USES_POLL
121 /* if there is a timeout set, then this pollset is used */
122 apr_pollset_t *pollset;
126 const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size);
127 int apr_inet_pton(int af, const char *src, void *dst);
128 void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t);
130 #define apr_is_option_set(skt, option) \
131 (((skt)->options & (option)) == (option))
133 #define apr_set_option(skt, option, on) \
136 (skt)->options |= (option); \
138 (skt)->options &= ~(option); \
141 #endif /* ! NETWORK_IO_H */