Switch uses of networking headers to <folly/portability/Sockets.h>
authorChristopher Dykes <cdykes@fb.com>
Mon, 30 May 2016 23:05:21 +0000 (16:05 -0700)
committerFacebook Github Bot 6 <facebook-github-bot-6-bot@fb.com>
Mon, 30 May 2016 23:09:20 +0000 (16:09 -0700)
Summary:
Diff #14 of 14.

This just switches the includes of the headers, it does not make the adjustments actually required to work for MSVC.

Reviewed By: mzlee

Differential Revision: D3249009

fbshipit-source-id: 434f58a7b8f4d0b7d142bc6a4abed8d95c953a7f

26 files changed:
folly/FileUtil.cpp
folly/SocketAddress.h
folly/Subprocess.cpp
folly/detail/IPAddress.h
folly/detail/SocketFastOpen.h
folly/experimental/io/test/AsyncIOTest.cpp
folly/io/ShutdownSocketSet.cpp
folly/io/async/AsyncSSLSocket.cpp
folly/io/async/AsyncSSLSocket.h
folly/io/async/AsyncServerSocket.cpp
folly/io/async/AsyncServerSocket.h
folly/io/async/AsyncSocket.cpp
folly/io/async/AsyncSocket.h
folly/io/async/AsyncUDPSocket.cpp
folly/io/async/NotificationQueue.h
folly/io/async/SSLContext.h
folly/io/async/ssl/OpenSSLUtils.cpp
folly/io/async/ssl/OpenSSLUtils.h
folly/io/async/test/AsyncSSLSocketTest.cpp
folly/io/async/test/AsyncSSLSocketTest.h
folly/io/async/test/AsyncSocketTest.h
folly/io/async/test/AsyncSocketTest2.cpp
folly/io/async/test/SocketPair.cpp
folly/io/test/ShutdownSocketSetTest.cpp
folly/test/IPAddressTest.h
folly/test/SocketAddressTestHelper.cpp

index 9d50e82..71eee1d 100644 (file)
 #include <folly/FileUtil.h>
 
 #include <cerrno>
-#include <sys/socket.h>
 
 #include <folly/detail/FileUtilDetail.h>
 #include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/SysFile.h>
 
 namespace folly {
index 1953e21..d48f3cc 100644 (file)
 #pragma once
 
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <netdb.h>
 #include <cstddef>
 #include <iostream>
 #include <string>
@@ -28,6 +24,7 @@
 #include <folly/IPAddress.h>
 #include <folly/Portability.h>
 #include <folly/Range.h>
+#include <folly/portability/Sockets.h>
 
 namespace folly {
 
index c208de5..1e294ba 100644 (file)
@@ -24,7 +24,6 @@
 #include <sys/prctl.h>
 #endif
 #include <fcntl.h>
-#include <poll.h>
 
 #include <array>
 #include <algorithm>
@@ -41,6 +40,7 @@
 #include <folly/String.h>
 #include <folly/io/Cursor.h>
 #include <folly/portability/Environment.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 constexpr int kExecFailure = 127;
index 19dba37..b92ce65 100644 (file)
 #include <sstream>
 #include <type_traits>
 #include <vector>
-
-extern "C" {
-#ifndef _MSC_VER
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#else
-#include <winsock2.h>
-#include <ws2tcpip.h>
-// missing in socket headers
-#define sa_family_t ADDRESS_FAMILY
-#endif
-
 #include <sys/types.h>
-#include <netdb.h>
-}
 
 #include <folly/Conv.h>
 #include <folly/Format.h>
+#include <folly/portability/Sockets.h>
 
 // BSDish platforms don't provide standard access to s6_addr16
 #ifndef s6_addr16
index a372a90..1295a1e 100644 (file)
@@ -16,7 +16,7 @@
 
 #pragma once
 
-#include <sys/socket.h>
+#include <folly/portability/Sockets.h>
 #include <sys/types.h>
 
 #if !defined(FOLLY_ALLOW_TFO) && defined(TCP_FASTOPEN) && defined(MSG_FASTOPEN)
index e117ebd..eae19c1 100644 (file)
@@ -19,7 +19,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
-#include <poll.h>
 
 #include <cstdlib>
 #include <cstdio>
@@ -34,6 +33,7 @@
 #include <folly/experimental/io/FsUtil.h>
 #include <folly/ScopeGuard.h>
 #include <folly/String.h>
+#include <folly/portability/Sockets.h>
 
 namespace fs = folly::fs;
 using folly::AsyncIO;
index 024d145..9114c8f 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <folly/io/ShutdownSocketSet.h>
 
-#include <sys/socket.h>
 #include <sys/types.h>
 
 #include <chrono>
@@ -26,6 +25,7 @@
 
 #include <folly/FileUtil.h>
 #include <folly/Malloc.h>
+#include <folly/portability/Sockets.h>
 
 namespace folly {
 
index c972c87..1656589 100644 (file)
 #include <folly/io/async/AsyncSSLSocket.h>
 
 #include <folly/io/async/EventBase.h>
+#include <folly/portability/Sockets.h>
 
 #include <boost/noncopyable.hpp>
 #include <errno.h>
 #include <fcntl.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
 #include <openssl/err.h>
 #include <openssl/asn1.h>
 #include <openssl/ssl.h>
 #include <sys/types.h>
-#include <sys/socket.h>
 #include <chrono>
 
 #include <folly/Bits.h>
index af3fd06..b4e4ca4 100644 (file)
@@ -16,7 +16,6 @@
 
 #pragma once
 
-#include <arpa/inet.h>
 #include <iomanip>
 
 #include <folly/Optional.h>
@@ -33,6 +32,7 @@
 #include <folly/Bits.h>
 #include <folly/io/IOBuf.h>
 #include <folly/io/Cursor.h>
+#include <folly/portability/Sockets.h>
 
 namespace folly {
 
index 5d15ff4..bc68a30 100644 (file)
 #include <folly/io/async/EventBase.h>
 #include <folly/io/async/NotificationQueue.h>
 #include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <errno.h>
-#include <netinet/tcp.h>
 #include <string.h>
-#include <sys/socket.h>
 #include <sys/types.h>
 
 namespace folly {
index 9214d23..d2f5002 100644 (file)
 #include <folly/io/async/EventBase.h>
 #include <folly/io/async/EventHandler.h>
 #include <folly/io/async/NotificationQueue.h>
+#include <folly/portability/Sockets.h>
+
 #include <limits.h>
 #include <stddef.h>
-#include <sys/socket.h>
 #include <exception>
 #include <memory>
 #include <vector>
index c35d7b4..0fe8e88 100644 (file)
 #include <folly/SocketAddress.h>
 #include <folly/io/IOBuf.h>
 #include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/SysUio.h>
 #include <folly/portability/Unistd.h>
 
-#include <poll.h>
 #include <errno.h>
 #include <limits.h>
 #include <thread>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
 #include <boost/preprocessor/control/if.hpp>
 
 using std::string;
index 37fdf08..2a77ac3 100644 (file)
@@ -25,7 +25,8 @@
 #include <folly/io/async/AsyncTransport.h>
 #include <folly/io/async/DelayedDestruction.h>
 #include <folly/io/async/EventHandler.h>
-#include <sys/socket.h>
+#include <folly/portability/Sockets.h>
+
 #include <sys/types.h>
 
 #include <chrono>
index 236e60e..2166f84 100644 (file)
@@ -19,6 +19,7 @@
 #include <folly/io/async/EventBase.h>
 #include <folly/Likely.h>
 #include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <errno.h>
index 0f26d88..625d64e 100644 (file)
@@ -16,7 +16,6 @@
 
 #pragma once
 
-#include <poll.h>
 #include <sys/types.h>
 
 #include <algorithm>
@@ -35,6 +34,7 @@
 #include <folly/ScopeGuard.h>
 #include <folly/SpinLock.h>
 #include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <glog/logging.h>
index e3ebaf5..81c8a21 100644 (file)
 #include <string>
 #include <random>
 
+// This has to come before SSL.
+#include <folly/portability/Sockets.h>
+
 #include <openssl/ssl.h>
 #include <openssl/tls1.h>
 
-#include <sys/socket.h>
-#include <netinet/in.h>
-
 #include <glog/logging.h>
 
 #ifndef FOLLY_NO_CONFIG
index c276f6d..4df8b3b 100644 (file)
  */
 #include <folly/io/async/ssl/OpenSSLUtils.h>
 #include <folly/ScopeGuard.h>
+#include <folly/portability/Sockets.h>
 
 #include <openssl/err.h>
 #include <openssl/rand.h>
 #include <openssl/ssl.h>
 #include <openssl/x509v3.h>
 
-#include <netinet/in.h>
-#include <sys/socket.h>
-
 #include <glog/logging.h>
 
 namespace folly {
index 5d232c4..7f211bf 100644 (file)
  */
 #pragma once
 
-#include <openssl/x509v3.h>
+#include <folly/portability/Sockets.h>
 
-#include <netinet/in.h>
-#include <sys/socket.h>
+#include <openssl/x509v3.h>
 
 namespace folly {
 namespace ssl {
index 2e5f246..d4078e5 100644 (file)
@@ -21,6 +21,7 @@
 #include <folly/io/async/AsyncSSLSocket.h>
 #include <folly/io/async/EventBase.h>
 #include <folly/SocketAddress.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <folly/io/async/test/BlockingSocket.h>
 #include <set>
 #include <fcntl.h>
 #include <openssl/bio.h>
-#include <poll.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/tcp.h>
 #include <folly/io/Cursor.h>
 
 using std::string;
index 5c0fe43..43ada24 100644 (file)
 #include <folly/io/async/AsyncTransport.h>
 #include <folly/io/async/EventBase.h>
 #include <folly/io/async/ssl/SSLErrors.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <gtest/gtest.h>
 #include <iostream>
 #include <list>
 #include <fcntl.h>
-#include <poll.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/tcp.h>
 
 namespace folly {
 
index fe03fa6..a0087c1 100644 (file)
@@ -17,9 +17,9 @@
 
 #include <folly/io/async/AsyncSocket.h>
 #include <folly/io/async/test/BlockingSocket.h>
+#include <folly/portability/Sockets.h>
 
 #include <boost/scoped_array.hpp>
-#include <poll.h>
 
 enum StateEnum {
   STATE_WAITING,
index 927d74f..23b806a 100644 (file)
@@ -24,6 +24,7 @@
 #include <folly/io/IOBuf.h>
 #include <folly/io/async/test/AsyncSocketTest.h>
 #include <folly/io/async/test/Util.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 #include <folly/test/SocketAddressTestHelper.h>
 
 #include <boost/scoped_array.hpp>
 #include <iostream>
 #include <fcntl.h>
-#include <poll.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/tcp.h>
 #include <thread>
 
 using namespace boost;
index eff35d7..7d0cafd 100644 (file)
 #include <folly/io/async/test/SocketPair.h>
 
 #include <folly/Conv.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/types.h>
-#include <sys/socket.h>
 #include <stdexcept>
 
 namespace folly {
index 88b9e98..63dd96c 100644 (file)
 #include <chrono>
 #include <thread>
 
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/socket.h>
-
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 
+#include <folly/portability/Sockets.h>
+
 using folly::ShutdownSocketSet;
 
 namespace folly { namespace test {
index ef50c13..01aa3c4 100644 (file)
 
 #include <gtest/gtest.h>
 
-extern "C" {
 #include <sys/types.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-}
 
 #include <folly/IPAddress.h>
+#include <folly/portability/Sockets.h>
 
 namespace folly {
 
index ae29c2e..6211023 100644 (file)
@@ -16,8 +16,7 @@
 
 #include <folly/test/SocketAddressTestHelper.h>
 
-#include <sys/socket.h>
-#include <netdb.h>
+#include <folly/portability/Sockets.h>
 #include <glog/logging.h>
 
 namespace folly {