5 have.h -- include headers which are known to exist
6 Copyright (C) 1998-2005 Ivo Timmermans
7 2003-2021 Guus Sliepen <guus@tinc-vpn.org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #define _WIN32_WINNT 0x0600
27 #define WIN32_LEAN_AND_MEAN
28 #define _CRT_SECURE_NO_WARNINGS
29 #define _CRT_NONSTDC_NO_WARNINGS
48 #ifdef HAVE_STATIC_ASSERT
49 #define STATIC_ASSERT(expr, msg) _Static_assert((expr), msg)
51 #define STATIC_ASSERT(check, msg)
54 #ifdef HAVE_ATTR_PACKED
55 #define PACKED(...) __VA_ARGS__ __attribute__((__packed__))
58 #define PACKED(...) __pragma(pack(push, 1)) __VA_ARGS__ __pragma(pack(pop))
60 #warning Your compiler does not support __packed__. Use at your own risk.
64 #ifdef HAVE_ATTR_MALLOC
65 #define ATTR_MALLOC __attribute__((__malloc__))
70 #ifdef HAVE_ATTR_NONNULL
71 #define ATTR_NONNULL __attribute__((__nonnull__))
76 #ifdef HAVE_ATTR_WARN_UNUSED_RESULT
77 #define ATTR_WARN_UNUSED __attribute__((__warn_unused_result__))
79 #define ATTR_WARN_UNUSED
82 #ifdef HAVE_ATTR_FORMAT
83 #define ATTR_FORMAT(func, str, nonstr) __attribute__((format(func, str, nonstr)))
85 #define ATTR_FORMAT(func, str, nonstr)
90 #elif defined(HAVE_NETBSD)
91 #define alloca(size) __builtin_alloca(size)
101 #include <ws2tcpip.h>
108 #endif // HAVE_WINDOWS
110 #ifdef HAVE_TERMIOS_H
114 #ifdef HAVE_INTTYPES_H
115 #include <inttypes.h>
118 /* Include system specific headers */
128 #ifdef HAVE_SYS_TIME_H
129 #include <sys/time.h>
133 #ifdef HAVE_SYS_TYPES_H
134 #include <sys/types.h>
137 #ifdef HAVE_SYS_STAT_H
138 #include <sys/stat.h>
141 #ifdef HAVE_SYS_FILE_H
142 #include <sys/file.h>
145 #ifdef HAVE_SYS_MMAN_H
146 #include <sys/mman.h>
149 #ifdef HAVE_SYS_WAIT_H
150 #include <sys/wait.h>
153 #ifdef HAVE_SYS_IOCTL_H
154 #include <sys/ioctl.h>
157 #ifdef HAVE_SYS_PARAM_H
158 #include <sys/param.h>
161 #ifdef HAVE_SYS_RESOURCE_H
162 #include <sys/resource.h>
171 #elif defined(_MSC_VER)
175 /* SunOS really wants sys/socket.h BEFORE net/if.h,
176 and FreeBSD wants these lines below the rest. */
182 #ifdef HAVE_SYS_SOCKET_H
183 #include <sys/socket.h>
190 #ifdef HAVE_NET_IF_TYPES_H
191 #include <net/if_types.h>
194 #ifdef HAVE_NET_IF_TUN_H
195 #include <net/if_tun.h>
198 #ifdef HAVE_NET_TUN_IF_TUN_H
199 #include <net/tun/if_tun.h>
202 #ifdef HAVE_NET_IF_TAP_H
203 #include <net/if_tap.h>
206 #ifdef HAVE_NET_TAP_IF_TAP_H
207 #include <net/tap/if_tap.h>
210 #ifdef HAVE_NETINET_IN_SYSTM_H
211 #include <netinet/in_systm.h>
214 #ifdef HAVE_NETINET_IN_H
215 #include <netinet/in.h>
218 #ifdef HAVE_ARPA_INET_H
219 #include <arpa/inet.h>
222 #ifdef HAVE_NETINET_IP_H
223 #include <netinet/ip.h>
226 #ifdef HAVE_NETINET_TCP_H
227 #include <netinet/tcp.h>
230 #ifdef HAVE_NETINET_IN6_H
231 #include <netinet/in6.h>
234 #ifdef HAVE_NETINET_IP6_H
235 #include <netinet/ip6.h>
238 #ifdef HAVE_NET_ETHERNET_H
239 #include <net/ethernet.h>
242 #ifdef HAVE_NET_IF_ARP_H
243 #include <net/if_arp.h>
246 #ifdef HAVE_NETINET_IP_ICMP_H
247 #include <netinet/ip_icmp.h>
250 #ifdef HAVE_NETINET_ICMP6_H
251 #include <netinet/icmp6.h>
254 #ifdef HAVE_NETINET_IF_ETHER_H
255 #include <netinet/if_ether.h>
258 #ifdef HAVE_ARPA_NAMESER_H
259 #include <arpa/nameser.h>
266 #ifdef HAVE_LINUX_IF_TUN_H
267 #include <linux/if_tun.h>