Support if_indextoname in the socket portability header
[folly.git] / folly / IPAddressV6.cpp
index 70428f3adbd69fa29920d880c2b13606d4869fe1..3490669dcbdd72db0cf2484c24e3e6708c045970 100644 (file)
 #include <ostream>
 #include <string>
 
-#include <net/if.h>
-
 #include <folly/Format.h>
 #include <folly/IPAddress.h>
 #include <folly/IPAddressV4.h>
 #include <folly/MacAddress.h>
 #include <folly/detail/IPAddressSource.h>
 
+#if !_WIN32
+#include <net/if.h>
+#else
+// Because of the massive pain that is libnl, this can't go into the socket
+// portability header as you can't include <linux/if.h> and <net/if.h> in
+// the same translation unit without getting errors -_-...
+#include <iphlpapi.h>
+#include <ntddndis.h>
+
+// Alias the max size of an interface name to what posix expects.
+#define IFNAMSIZ IF_NAMESIZE
+#endif
+
 using std::ostream;
 using std::string;