low level network primitives should not be exported. Moved enum_if into tests (since it uses internal functions)
This commit is contained in:
parent
6e28e33b32
commit
bbe62564ad
|
@ -21,7 +21,6 @@ exe client_test : client_test.cpp ;
|
||||||
exe simple_client : simple_client.cpp ;
|
exe simple_client : simple_client.cpp ;
|
||||||
exe dump_torrent : dump_torrent.cpp ;
|
exe dump_torrent : dump_torrent.cpp ;
|
||||||
exe make_torrent : make_torrent.cpp ;
|
exe make_torrent : make_torrent.cpp ;
|
||||||
exe enum_if : enum_if.cpp ;
|
|
||||||
exe connection_tester : connection_tester.cpp ;
|
exe connection_tester : connection_tester.cpp ;
|
||||||
exe fragmentation_test : fragmentation_test.cpp ;
|
exe fragmentation_test : fragmentation_test.cpp ;
|
||||||
exe rss_reader : rss_reader.cpp ;
|
exe rss_reader : rss_reader.cpp ;
|
||||||
|
|
|
@ -59,7 +59,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/magnet_uri.hpp"
|
#include "libtorrent/magnet_uri.hpp"
|
||||||
#include "libtorrent/bitfield.hpp"
|
#include "libtorrent/bitfield.hpp"
|
||||||
#include "libtorrent/peer_info.hpp"
|
#include "libtorrent/peer_info.hpp"
|
||||||
#include "libtorrent/socket_io.hpp" // print_address
|
|
||||||
#include "libtorrent/time.hpp"
|
#include "libtorrent/time.hpp"
|
||||||
#include "libtorrent/create_torrent.hpp"
|
#include "libtorrent/create_torrent.hpp"
|
||||||
|
|
||||||
|
@ -264,6 +263,21 @@ bool is_hex(char const *in, int len)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string print_endpoint(libtorrent::tcp::endpoint const& ep)
|
||||||
|
{
|
||||||
|
using namespace libtorrent;
|
||||||
|
error_code ec;
|
||||||
|
char buf[200];
|
||||||
|
address const& addr = ep.address();
|
||||||
|
#if TORRENT_USE_IPV6
|
||||||
|
if (addr.is_v6())
|
||||||
|
snprintf(buf, sizeof(buf), "[%s]:%d", addr.to_string(ec).c_str(), ep.port());
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
snprintf(buf, sizeof(buf), "%s:%d", addr.to_string(ec).c_str(), ep.port());
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
torrents_all,
|
torrents_all,
|
||||||
torrents_downloading,
|
torrents_downloading,
|
||||||
|
@ -571,9 +585,9 @@ void print_peer_info(std::string& out, std::vector<libtorrent::peer_info> const&
|
||||||
|
|
||||||
if (print_ip)
|
if (print_ip)
|
||||||
{
|
{
|
||||||
snprintf(str, sizeof(str), "%-30s %-22s", (print_endpoint(i->ip) +
|
snprintf(str, sizeof(str), "%-30s %-22s", (::print_endpoint(i->ip) +
|
||||||
(i->connection_type == peer_info::bittorrent_utp ? " [uTP]" : "")).c_str()
|
(i->connection_type == peer_info::bittorrent_utp ? " [uTP]" : "")).c_str()
|
||||||
, print_endpoint(i->local_endpoint).c_str());
|
, ::print_endpoint(i->local_endpoint).c_str());
|
||||||
out += str;
|
out += str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,20 +45,20 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
TORRENT_EXPORT bool is_local(address const& a);
|
TORRENT_EXTRA_EXPORT bool is_local(address const& a);
|
||||||
TORRENT_EXPORT bool is_loopback(address const& addr);
|
TORRENT_EXTRA_EXPORT bool is_loopback(address const& addr);
|
||||||
TORRENT_EXPORT bool is_multicast(address const& addr);
|
TORRENT_EXTRA_EXPORT bool is_multicast(address const& addr);
|
||||||
TORRENT_EXPORT bool is_any(address const& addr);
|
TORRENT_EXTRA_EXPORT bool is_any(address const& addr);
|
||||||
TORRENT_EXPORT bool is_teredo(address const& addr);
|
TORRENT_EXTRA_EXPORT bool is_teredo(address const& addr);
|
||||||
TORRENT_EXTRA_EXPORT int cidr_distance(address const& a1, address const& a2);
|
TORRENT_EXTRA_EXPORT int cidr_distance(address const& a1, address const& a2);
|
||||||
|
|
||||||
// determines if the operating system supports IPv6
|
// determines if the operating system supports IPv6
|
||||||
TORRENT_EXPORT bool supports_ipv6();
|
TORRENT_EXTRA_EXPORT bool supports_ipv6();
|
||||||
|
|
||||||
TORRENT_EXTRA_EXPORT int common_bits(unsigned char const* b1
|
TORRENT_EXTRA_EXPORT int common_bits(unsigned char const* b1
|
||||||
, unsigned char const* b2, int n);
|
, unsigned char const* b2, int n);
|
||||||
|
|
||||||
TORRENT_EXPORT address guess_local_address(io_service&);
|
TORRENT_EXTRA_EXPORT address guess_local_address(io_service&);
|
||||||
|
|
||||||
typedef boost::function<void(udp::endpoint const& from
|
typedef boost::function<void(udp::endpoint const& from
|
||||||
, char* buffer, int size)> receive_handler_t;
|
, char* buffer, int size)> receive_handler_t;
|
||||||
|
|
|
@ -62,20 +62,20 @@ namespace libtorrent
|
||||||
|
|
||||||
// returns a list of the configured IP interfaces
|
// returns a list of the configured IP interfaces
|
||||||
// on the machine
|
// on the machine
|
||||||
TORRENT_EXPORT std::vector<ip_interface> enum_net_interfaces(io_service& ios
|
TORRENT_EXTRA_EXPORT std::vector<ip_interface> enum_net_interfaces(io_service& ios
|
||||||
, error_code& ec);
|
, error_code& ec);
|
||||||
|
|
||||||
TORRENT_EXPORT std::vector<ip_route> enum_routes(io_service& ios, error_code& ec);
|
TORRENT_EXTRA_EXPORT std::vector<ip_route> enum_routes(io_service& ios, error_code& ec);
|
||||||
|
|
||||||
// return (a1 & mask) == (a2 & mask)
|
// return (a1 & mask) == (a2 & mask)
|
||||||
TORRENT_EXPORT bool match_addr_mask(address const& a1, address const& a2, address const& mask);
|
TORRENT_EXTRA_EXPORT bool match_addr_mask(address const& a1, address const& a2, address const& mask);
|
||||||
|
|
||||||
// returns true if the specified address is on the same
|
// returns true if the specified address is on the same
|
||||||
// local network as us
|
// local network as us
|
||||||
TORRENT_EXPORT bool in_local_network(io_service& ios, address const& addr
|
TORRENT_EXTRA_EXPORT bool in_local_network(io_service& ios, address const& addr
|
||||||
, error_code& ec);
|
, error_code& ec);
|
||||||
|
|
||||||
TORRENT_EXPORT address get_default_gateway(io_service& ios
|
TORRENT_EXTRA_EXPORT address get_default_gateway(io_service& ios
|
||||||
, error_code& ec);
|
, error_code& ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,10 +43,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
TORRENT_EXPORT std::string print_address(address const& addr);
|
TORRENT_EXTRA_EXPORT std::string print_address(address const& addr);
|
||||||
TORRENT_EXPORT std::string print_endpoint(tcp::endpoint const& ep);
|
TORRENT_EXTRA_EXPORT std::string print_endpoint(tcp::endpoint const& ep);
|
||||||
TORRENT_EXPORT std::string print_endpoint(udp::endpoint const& ep);
|
TORRENT_EXTRA_EXPORT std::string print_endpoint(udp::endpoint const& ep);
|
||||||
TORRENT_EXPORT std::string address_to_bytes(address const& a);
|
TORRENT_EXTRA_EXPORT std::string address_to_bytes(address const& a);
|
||||||
TORRENT_EXTRA_EXPORT void hash_address(address const& ip, sha1_hash& h);
|
TORRENT_EXTRA_EXPORT void hash_address(address const& ip, sha1_hash& h);
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
|
|
|
@ -67,25 +67,15 @@ namespace libtorrent
|
||||||
std::string print_endpoint(tcp::endpoint const& ep)
|
std::string print_endpoint(tcp::endpoint const& ep)
|
||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
std::string ret;
|
char buf[200];
|
||||||
address const& addr = ep.address();
|
address const& addr = ep.address();
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
if (addr.is_v6())
|
if (addr.is_v6())
|
||||||
{
|
snprintf(buf, sizeof(buf), "[%s]:%d", addr.to_string(ec).c_str(), ep.port());
|
||||||
ret += '[';
|
|
||||||
ret += addr.to_string(ec);
|
|
||||||
ret += ']';
|
|
||||||
ret += ':';
|
|
||||||
ret += to_string(ep.port()).elems;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
snprintf(buf, sizeof(buf), "%s:%d", addr.to_string(ec).c_str(), ep.port());
|
||||||
ret += addr.to_string(ec);
|
return buf;
|
||||||
ret += ':';
|
|
||||||
ret += to_string(ep.port()).elems;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string print_endpoint(udp::endpoint const& ep)
|
std::string print_endpoint(udp::endpoint const& ep)
|
||||||
|
|
|
@ -5,7 +5,11 @@ use-project /torrent : .. ;
|
||||||
exe test_natpmp : test_natpmp.cpp /torrent//torrent
|
exe test_natpmp : test_natpmp.cpp /torrent//torrent
|
||||||
: <threading>multi <debug-iterators>on <invariant-checks>full ;
|
: <threading>multi <debug-iterators>on <invariant-checks>full ;
|
||||||
|
|
||||||
|
exe enum_if : enum_if.cpp /torrent//torrent
|
||||||
|
: <threading>multi <debug-iterators>on <invariant-checks>full ;
|
||||||
|
|
||||||
explicit test_natpmp ;
|
explicit test_natpmp ;
|
||||||
|
explicit enum_if ;
|
||||||
|
|
||||||
lib libtorrent_test
|
lib libtorrent_test
|
||||||
: # sources
|
: # sources
|
||||||
|
|
Loading…
Reference in New Issue