1 // Copyright 2009 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // This is a convenience header to pull in the platform-specific headers 6 // that define at least: 7 // 8 // struct addrinfo 9 // struct sockaddr* 10 // getaddrinfo() 11 // freeaddrinfo() 12 // AI_* 13 // AF_* 14 // 15 // Prefer including this file instead of directly writing the #if / #else, 16 // since it avoids duplicating the platform-specific selections. 17 // 18 // Note that this header transitively includes windows.h on Windows, which 19 // pollutes the global namespace with thousands of macro definitions, so try to 20 // avoid including this in headers. Including windows.h can also add significant 21 // build overhead. 22 23 #ifndef NET_BASE_SYS_ADDRINFO_H_ 24 #define NET_BASE_SYS_ADDRINFO_H_ 25 26 #include "build/build_config.h" 27 28 #if BUILDFLAG(IS_WIN) 29 #include <winsock2.h> 30 #include <ws2tcpip.h> 31 #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) 32 #include <netdb.h> 33 #include <netinet/in.h> 34 #include <sys/socket.h> 35 #endif 36 37 #endif // NET_BASE_SYS_ADDRINFO_H_ 38