#include <iostream>#include <fstream>#include <iterator>#include <exception>#include "libtorrent/config.hpp"#include <boost/filesystem/operations.hpp>#include <boost/filesystem/fstream.hpp>#include <boost/filesystem/exception.hpp>#include <boost/date_time/posix_time/posix_time.hpp>#include <boost/bind.hpp>#include <boost/program_options.hpp>#include <boost/regex.hpp>#include "libtorrent/extensions/metadata_transfer.hpp"#include "libtorrent/extensions/ut_pex.hpp"#include "libtorrent/entry.hpp"#include "libtorrent/bencode.hpp"#include "libtorrent/session.hpp"#include "libtorrent/identify_client.hpp"#include "libtorrent/alert_types.hpp"#include "libtorrent/ip_filter.hpp"#include <stdlib.h>#include <stdio.h>#include <termios.h>#include <string.h>Go to the source code of this file.
Classes | |
| struct | set_keypress |
Defines | |
| #define | ANSI_TERMINAL_COLORS |
Typedefs | |
| typedef std::multimap < std::string, libtorrent::torrent_handle > | handles_t |
Functions | |
| bool | sleep_and_input (char *c) |
| void | clear_home () |
| std::string | esc (char const *code) |
| std::string | to_string (float v, int width, int precision=3) |
| std::string | pos_to_string (float v, int width, int precision=4) |
| std::string | ratio (float a, float b) |
| std::string | add_suffix (float val) |
| std::string | progress_bar (float progress, int width, char const *code="33") |
| int | peer_index (libtorrent::tcp::endpoint addr, std::vector< libtorrent::peer_info > const &peers) |
| void | print_peer_info (std::ostream &out, std::vector< libtorrent::peer_info > const &peers) |
| void | add_torrent (libtorrent::session &ses, handles_t &handles, std::string const &torrent, float preferred_ratio, bool compact_mode, path const &save_path, bool monitored_dir) |
| void | scan_dir (path const &dir_path, libtorrent::session &ses, handles_t &handles, float preferred_ratio, bool compact_mode, path const &save_path) |
| int | main (int ac, char *av[]) |
| #define ANSI_TERMINAL_COLORS |
Definition at line 82 of file client_test.cpp.
| typedef std::multimap<std::string, libtorrent::torrent_handle> handles_t |
Definition at line 283 of file client_test.cpp.
| std::string add_suffix | ( | float | val | ) |
Definition at line 183 of file client_test.cpp.
References to_string().
Referenced by main(), and print_peer_info().
| void add_torrent | ( | libtorrent::session & | ses, | |
| handles_t & | handles, | |||
| std::string const & | torrent, | |||
| float | preferred_ratio, | |||
| bool | compact_mode, | |||
| path const & | save_path, | |||
| bool | monitored_dir | |||
| ) |
Definition at line 295 of file client_test.cpp.
References libtorrent::session::add_torrent(), libtorrent::bdecode(), simple_client::e, simple_client::h, and simple_client::s.
Referenced by libtorrent::session::add_torrent(), bind_session(), main(), and scan_dir().
| void clear_home | ( | ) |
| std::string esc | ( | char const * | code | ) |
Definition at line 126 of file client_test.cpp.
Referenced by main(), print_peer_info(), and progress_bar().
| int main | ( | int | ac, | |
| char * | av[] | |||
| ) |
Definition at line 399 of file client_test.cpp.
References a, add_suffix(), add_torrent(), b, libtorrent::bdecode(), libtorrent::bencode(), asio::detail::socket_ops::bind(), clear_home(), libtorrent::create_metadata_plugin(), libtorrent::create_ut_pex_plugin(), simple_client::e, esc(), file_progress(), simple_client::h, libtorrent::identify_client(), index, simple_client::info, asio::placeholders::iterator, LIBTORRENT_VERSION, peer_index(), print_peer_info(), progress_bar(), ratio(), simple_client::s, scan_dir(), simple_client::ses, sha1_hash(), sleep_and_input(), and simple_client::state_str.
| int peer_index | ( | libtorrent::tcp::endpoint | addr, | |
| std::vector< libtorrent::peer_info > const & | peers | |||
| ) |
Definition at line 209 of file client_test.cpp.
References asio::detail::socket_ops::bind(), and ip.
Referenced by main().
| std::string pos_to_string | ( | float | v, | |
| int | width, | |||
| int | precision = 4 | |||
| ) |
| void print_peer_info | ( | std::ostream & | out, | |
| std::vector< libtorrent::peer_info > const & | peers | |||
| ) |
Definition at line 220 of file client_test.cpp.
References add_suffix(), esc(), progress_bar(), and to_string().
Referenced by main().
| std::string progress_bar | ( | float | progress, | |
| int | width, | |||
| char const * | code = "33" | |||
| ) |
Definition at line 196 of file client_test.cpp.
References esc().
Referenced by main(), and print_peer_info().
| std::string ratio | ( | float | a, | |
| float | b | |||
| ) |
Definition at line 162 of file client_test.cpp.
References pos_to_string(), and simple_client::s.
Referenced by main(), and libtorrent::peer_connection::share_diff().
| void scan_dir | ( | path const & | dir_path, | |
| libtorrent::session & | ses, | |||
| handles_t & | handles, | |||
| float | preferred_ratio, | |||
| bool | compact_mode, | |||
| path const & | save_path | |||
| ) |
Definition at line 339 of file client_test.cpp.
References add_torrent(), libtorrent::bencode(), simple_client::h, asio::placeholders::iterator, libtorrent::session::remove_torrent(), and simple_client::s.
Referenced by main().
| bool sleep_and_input | ( | char * | c | ) |
Definition at line 101 of file client_test.cpp.
References simple_client::s, and asio::detail::socket_ops::select().
Referenced by main().
| std::string to_string | ( | float | v, | |
| int | width, | |||
| int | precision = 3 | |||
| ) |
Definition at line 140 of file client_test.cpp.
References simple_client::s.
Referenced by add_suffix(), bind_fingerprint(), libtorrent::peer_connection::peer_connection(), and print_peer_info().
1.5.6