made it build on linux. No linux implementation for getting default route yet

This commit is contained in:
Arvid Norberg 2008-01-11 10:18:14 +00:00
parent dad00f68cd
commit c23539b272
1 changed files with 12 additions and 11 deletions

View File

@ -45,6 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
#endif #endif
#include "libtorrent/enum_net.hpp" #include "libtorrent/enum_net.hpp"
#include "libtorrent/broadcast_socket.hpp"
#include <asio/ip/host_name.hpp> #include <asio/ip/host_name.hpp>
namespace libtorrent namespace libtorrent
@ -69,14 +70,6 @@ namespace libtorrent
} }
return address(); return address();
} }
bool verify_sockaddr(sockaddr_in* sin)
{
return (sin->sin_len == sizeof(sockaddr_in)
&& sin->sin_family == AF_INET)
|| (sin->sin_len == sizeof(sockaddr_in6)
&& sin->sin_family == AF_INET6);
}
} }
bool in_subnet(address const& addr, ip_interface const& iface) bool in_subnet(address const& addr, ip_interface const& iface)
@ -226,9 +219,17 @@ namespace libtorrent
address get_default_gateway(asio::io_service& ios, address const& interface, asio::error_code& ec) address get_default_gateway(asio::io_service& ios, address const& interface, asio::error_code& ec)
{ {
#if defined __linux__ || (defined __APPLE__ && __MACH__) || defined __FreeBSD__ || defined __NetBSD__ \ #if (defined __APPLE__ && __MACH__) || defined __FreeBSD__ || defined __NetBSD__ \
|| defined __OpenBSD__ || defined __bsdi__ || defined __DragonFly__ || defined __OpenBSD__ || defined __bsdi__ || defined __DragonFly__
bool verify_sockaddr(sockaddr_in* sin)
{
return (sin->sin_len == sizeof(sockaddr_in)
&& sin->sin_family == AF_INET)
|| (sin->sin_len == sizeof(sockaddr_in6)
&& sin->sin_family == AF_INET6);
}
struct rt_msg struct rt_msg
{ {
rt_msghdr m_rtm; rt_msghdr m_rtm;
@ -392,9 +393,9 @@ namespace libtorrent
return ret; return ret;
//#elif defined __linux__
// No linux implementation yet
#else #else
address interface = guess_local_address(ios);
if (!interface.is_v4()) if (!interface.is_v4())
{ {
ec = asio::error::operation_not_supported; ec = asio::error::operation_not_supported;