logo资料库

libtorrent API 文档(中文版).doc

第1页 / 共96页
第2页 / 共96页
第3页 / 共96页
第4页 / 共96页
第5页 / 共96页
第6页 / 共96页
第7页 / 共96页
第8页 / 共96页
资料共96页,剩余部分请下载后查看
libtorrent API 文档(中文版)
session
session()
~session()
pause() resume() is_paused()
void pause();
void resume();
bool is_pause() const;
abort()
session_proxy abort()
add_torrent()
remove_torrent()
find_torrent() get torrents()
set_upload_rate_limit()
set_download_rate_limit() upload_rate_limit()
download_rate_limit()
num_uploads() num_connections()
set_max_half_open_connetions()
load_state() state()
set_ip_filter()
get_ip_filter()
status()
get_cache_status()
is_listening() listen_port() listen_on()
pop_alert() set_alert_mask() wait_for_alert() set_
add_extension()
set_settings() set_pe_settings()
set_peer_proxy() set_web_seed_proxy() set_tracker_
peer_proxy() web_seed_proxy() tracker_proxy() dht_
start_dht() stop_dht() set_dht_settings() dht_stat
start_lsd() stop_lsd()
start_upnp() stop_upnp()
start_natpmp() stop_natpmp()
entry
integer() string() list() dict() type()
operator[]
find_key()
torrent_info
torrent_info()
files() orig_files()
rename_file()
begin_files() end_files() rbegin_files() rend_file
num_files() file_at()
map_block()
url_seeds() add_url_seed()
total_size() piece_length() piece_size() num_piece
hash_for_piece() hash_for_piece_ptr() info_hash()
name() comment() creation_date() creator()
priv()
nodes()
add_node()
metadata() metadata_size()
torrent_handle
piece_priority() prioritize_pieces() piece_priorit
file_priority() prioritize_files() file_priorities
file_progress()
save_path()
move_storage()
rename_file()
get_storage_impl()
force_reannounce()
scrape_tracker()
connect_peer()
name()
set_upload_limit() set_download_limit() upload_lim
set_sequential_download() is_sequential_download()
set_peer_upload_limit() set_peer_download_limit()
pause() resume() is_paused()
force_recheck()
clear_error()
resolve_countries()
is_seed()
is_auto_managed() auto_managed()
has_metadata()
set_tracker_login()
trackers() replace_trackers()
add_url_seed() remove_url_seed() url_seeds()
queue_position() queue_position_up() queue_positio
use_interface()
info_hash()
set_max_uploads() set_max_connections()
save_resume_data()
get_download_queue()
get_peer_info()
get_torrent_info()
is_valid()
torrent_status
peer_info
session_settings
pe_settings
proxy_settings
ip_filter
ip_filter()
access()
export_filter()
big_number
bitfield
hasher
fingerprint
UPnP and NAT-PMP
add_mapping
delete_mapping
router_model()
free functions
identify_client()
client_fingerprint()
bdecode() bencode()
add_magnet_uri()
make_magnet_uri()
alerts
error_notification
*激活报告错误的警告.包括
*·服务器错误
*·服务器警告
*文件错误
*恢复数据失败
*网页种子错误
*.torrent文件错误
*监听套接字错误
*端口映射错误
peer_notification
当对等点发送了非法请求,禁用,或没有上传或者下载时抛警告
port_mapping_notification
为端口映射事件而警告。例如NAT-PMP和UpnP
storage_notification
为存储事情而警告。存储的文件错误和同步错误,文件改名等。
tracker_notification 
使所有的服务器事情激活。包括通知服务器,接收响应,警告和错误。
debug_notification
当对等点连接或者断开时的低级别警告
status_notification
当一个任务或者事务改变状态时激活警告
progress_notification
当块被请求或者完成时,就会警告。当片完成时也会警告
ip_block_notification
当一个对等眯被ip 块阻止或者端口阻止时会产生警告
performance_warning
当一些可能限制上传或者下载速率的限制生效时,会产行此警告。
all_categories
完全比特模,表示所有的激活目录。
external_ip_alert
listen_failed_alert
portmap_error_alert
portmap_alert
file_error_alert
file_renamed_alert
file_rename_failed_alert
tracker_announce_alert
tracker_error_alert
tracker_reply_alert
dht_reply_alert
tracker_warning_alert
scrape_reply_alert
scrape_failed_alert
url_seed_alert
hash_failed_alert
peer_ban_alert
peer_error_alert
invalid_request_alert
torrent_finished_alert
performance_alert
metadata_failed_alert
metadata_received_alert
fastresume_rejected_alert
peer_blocked_alert
storage_moved_alert
storage_moved_failed_alert
torrent_paused_alert
torrent_resumed_alert
save_resume_data_failed_alert
dispatcher
exceptions
invalid_handle
duplicate_torrent
invalid_encoding
type_error
invalid_torrent_file
storage_interface
initialize()
has_any_file()
read()
write()
move_storage()
verify_resume_data()
write_resume_data()
move_slot()
swap_slots()
swap_slots3()
hash_for_slot()
rename_file()
release_files()
delete_files()
magnet links
queuing
downloading
fast resume
file format
threads
storage allocation
sparse allocation
full allocation
compact allocation
extensions
metadata from peers
HTTP seeding
filename checks
acknowledgments
libtorrent API 文档(中文版) 作者:Arvid Norberg, arvi@rasterbar.com 翻译:小朋友软件, xpysoft@163.com 文档原处:http://www.rasterbar.com/products/libtorrent/manual.html version:0.14.5 内容列表 ·总观 ·网络原语 ·session o o o o o o o o o o o o o o o o o o o o o o o o o o o o o entry  session() ~session() pause() resume() is_paused() abort() add_torrent() remove_torrent() find_torrent() get_torrents() set_upload_rate_limit() set_download_rate_limit() upload_rate_limit() download_rate_limit() set_max_uploads() set_max_connections() num_uploads() num_connections() set_max_half_open_connections() max_half_open_connections() load_asnum_db() load_country_db() int as_for_ip() load_state() state() set_ip_filter() get_ip_filter() status() get_cache_status() get_cache_info() is_listening() listen_port() listen_on() pop_alert() set_alert_mask() wait_for_alert() set_alert_queue_size_limit() add_extension() set_settings() set_pe_settings() set_peer_proxy() set_web_seed_proxy() set_tracker_proxy() set_dht_proxy() peer_proxy() web_seed_proxy() tracker_proxy() dht_proxy() start_dht() stop_dht() set_dht_settings() dht_state() add_dht_node() add_dht_router() start_lsd() stop_lsd() start_upnp() stop_upnp() start_natpmp() stop_natpmp()
integer() string() list() dict() type() operator[] find_key() torrent_info o o o o o o o o o o o o o o o o o o o o   torrent_info() add_tracker() files() orig_files() rename_file() begin_files() end_files() rbegin_files() rend_files() num_files() file_at() map_block() map_file() url_seeds() add_url_seed() trackers() total_size() piece_length() piece_size() num_pieces() hash_for_piece() hash_for_piece_ptr() info_hash() name() comment() creation_date() creator() priv() nodes() add_node() metadata() metadata_size() torrent_handle o o o o o o o o o o o o o o o o o o o o o piece_priority() prioritize_pieces() piece_priorities() file_priority() prioritize_files() file_priorities() file_progress() save_path() move_storage() rename_file() get_storage_impl() force_reannounce() scrape_tracker() connect_peer() name() set_ratio() set_upload_limit() set_download_limit() upload_limit() download_limit() set_sequential_download() is_sequential_download() set_peer_upload_limit() set_peer_download_limit() pause() resume() is_paused() force_recheck() clear_error() resolve_countries() is_seed() is_auto_managed() auto_managed()
has_metadata() set_tracker_login() trackers() replace_trackers() add_url_seed() remove_url_seed() url_seeds() queue_position() queue_position_up() queue_position_down() queue_position_top() queue_position_bottom() use_interface() info_hash() set_max_uploads() set_max_connections() save_resume_data() status() get_download_queue() get_peer_info() get_torrent_info() is_valid() torrent_status peer_info session_settings pe_settings proxy_settings ip_filter ip_filter() add_rule() access() export_filter() big_number bitfield hasher fingerprint UPnP and NAT-PMP o o o o o o o o o o o o o o o o o o o o o              add_mapping delete_mapping router_model() free functions identify_client() client_fingerprint() bdecode() bencode() add_magnet_uri() make_magnet_uri() o o o o o alerts o o o o external_ip_alert listen_failed_alert portmap_error_alert portmap_alert
file_error_alert file_renamed_alert file_rename_failed_alert tracker_announce_alert tracker_error_alert tracker_reply_alert dht_reply_alert tracker_warning_alert scrape_reply_alert scrape_failed_alert url_seed_alert hash_failed_alert peer_ban_alert peer_error_alert invalid_request_alert torrent_finished_alert performance_alert metadata_failed_alert metadata_received_alert fastresume_rejected_alert peer_blocked_alert storage_moved_alert storage_moved_failed_alert torrent_paused_alert torrent_resumed_alert save_resume_data_alert save_resume_data_failed_alert dispatcher exceptions invalid_handle duplicate_torrent invalid_encoding type_error invalid_torrent_file o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o   storage_interface o o o o o o o o o initialize() has_any_file() read() write() move_storage() verify_resume_data() write_resume_data() move_slot() swap_slots()
swap_slots3() hash_for_slot() rename_file() release_files() delete_files() magnet links queuing downloading seeding fast resume file format threads storage allocation o o o o o o o o o o o o o sparse allocation full allocation compact allocation metadata from peers HTTP seeding extensions filename checks acknowledgments         概述 libtorrent 库的接口由少量几个类组成。最主要的类是 session 类,它有 一个为所有任务服务的主循环. 基本的用法如下:  创建一个 session  打开 扩展(查看 add_extension()).  打开 DHT, LSD, UPnP, NAT-PMP 等 (查看 start_dht(), stop_dht(), set_dht_settings(), dht_state(), start_lsd(), stop_lsd(), start_upnp(), stop_upnp 和 start_natpmp(), stop_natpmp());  解析 .torrent 文件 并且把它们加入到 session 中(查看 bdecode(), bencode()和 add_torrent())  主循环(查看 session)  查询事务句柄, 得到下载进度(查看 torrent_handler 类)  查询事务,得到下载信息。  在运行时从事务中增加或者删除下载任务。  主循环(查看 session)  为任务句柄保存新下载的数据(可以查看 save_resume_data()函数)  析构事务对象 每个类和函数在这个手册中被描述到
关于如何创建任务种子文件的描述,但看 make_torrent 函数 网络原语 在 libtorrent 名字空间中有一些宏定义,这些定义从 asio 名字空间中 选出。它们是: typedef asio::ip::address address; typedef asio::ip::address_v4 address_v4; typedef asio::ip::address_v6 address_v6; using asio::ip::tcp; using asio::ip::udp; 这些在头文件中描述. 这些表述为以下几方面提供简易接口: tcp::endpoint udp::endpoint 这些端点类型在 libtorrent 库中被使用.一个端点是一个地址与相关 端口的结合。 关于这些类型的文档,请查看相关 asio 的文件说明. session 事务类有如下一些概要: class session: public boost::noncopyable { session(fingerprint const& print = libtorrent::fingerprint( "LT", 0, 1, 0, 0) , int flags = start_default_features | add_default_plugins); session( fingerprint const& print , std::pair listen_port_range , char const* listen_interface = 0
add_default_plugins); , int flags = start_default_features | torrent_handle add_torrent(add_torrent_params const& params); void pause(); void resume(); bool is_paused() const; session_proxy abort(); enum options_t { none = 0, delete_files = 1 }; enum session_flags_t { add_default_plugins = 1, start_default_features = 2 }; void remove_torrent(torrent_handle const& h, int options = none); torrent_handle find_torrent(sha_hash const& ih); std::vector get_torrents() const; void set_settings(session_settings const& settings); void set_pe_settings(pe_settings const& settings); void set_upload_rate_limit(int bytes_per_second); int upload_rate_limit() const; void set_download_rate_limit(int bytes_per_second); int download_rate_limit() const; void set_max_uploads(int limit); void set_max_connections(int limit); void set_max_half_open_connections(int limit); int max_half_open_connections() const; void set_peer_proxy(proxy_settings const& s); void set_web_seed_proxy(proxy_settings const& s); void set_tracker_proxy(proxy_settings const& s);
proxy_settings const& peer_proxy() const; proxy_settings const& web_seed_proxy() const; proxy_settings const& tracker_proxy() const; int num_uploads() const; int num_connections() const; bool load_asnum_db(char const* file); bool load_country_db(char const* file); int as_for_ip(address const& adr); void load_state(entry const& ses_state); entry state() const; void set_ip_filter(ip_filter const& f); ip_filter const& get_ip_filter() const; session_status status() const; cache_status get_cache_status() const; bool is_listening() const; unsigned short listen_port() const; bool listen_on( std::pair const& port_range , char const* interface = 0); std::auto_ptr pop_alert(); alert const* wait_for_alert(time_duration max_wait); void set_alert_mask(int m); size_t set_alert_queue_size_limit(size_t queue_size_limit_); void add_extension(boost::function< boost::shared_ptr(torrent*)> ext); void start_dht(); void stop_dht(); void set_dht_settings( dht_settings const& settings); entry dht_state() const; void add_dht_node(std::pair const& node); void add_dht_router(std::pair const& node);
分享到:
收藏