Apache HTTPD
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
97struct sock_userdata_t {
99 const char *key;
100 void *data;
101};
102
103struct apr_socket_t {
105 int socketdes;
106 int type;
107 int protocol;
111#ifndef HAVE_POLL
113#endif
114#if APR_HAVE_SOCKADDR_UN
115 int bound;
116#endif
123#ifndef WAITIO_USES_POLL
124 /* if there is a timeout set, then this pollset is used */
126#endif
127};
128
129const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size);
130int 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
APR Error Codes.
APR Miscellaneous library routines.
APR general purpose library routines.
APR Network library.
APR Poll interface.
const char * src
Definition apr_encode.h:167
apr_size_t size
apr_uint16_t apr_port_t
apr_int64_t apr_interval_time_t
Definition apr_time.h:55
void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t)
Definition sockaddr.c:180
const char * apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size)
Definition inet_ntop.c:74
int apr_inet_pton(int af, const char *src, void *dst)
Definition inet_pton.c:79
apr_pool_t * pool
sock_userdata_t * userdata
apr_interval_time_t timeout
apr_sockaddr_t * remote_addr
apr_pollset_t * pollset
apr_int32_t options
apr_int32_t inherit
apr_sockaddr_t * local_addr
sock_userdata_t * next