《libtorrent+API+手册(中文版)》由会员分享,可在线阅读,更多相关《libtorrent+API+手册(中文版)(96页珍藏版)》请在金锄头文库上搜索。
1、libtorrent API 文档(中文版)作者:Arvid Norberg, 翻译:小朋友软件, 文档原处:http:/ 总观 网络原语 sessiono session()o session()o pause() resume() is_paused()o abort()o add_torrent()o remove_torrent()o find_torrent() get_torrents()o set_upload_rate_limit() set_download_rate_limit() upload_rate_limit() download_rate_limit()o set
2、_max_uploads() set_max_connections()o num_uploads() num_connections()o set_max_half_open_connections() max_half_open_connections()o load_asnum_db() load_country_db() int as_for_ip()o load_state() state()o set_ip_filter()o get_ip_filter()o status()o get_cache_status()o get_cache_info()o is_listening(
3、) listen_port() listen_on()o pop_alert() set_alert_mask() wait_for_alert() set_alert_queue_size_limit()o add_extension()o set_settings() set_pe_settings()o set_peer_proxy() set_web_seed_proxy() set_tracker_proxy() set_dht_proxy()o peer_proxy() web_seed_proxy() tracker_proxy() dht_proxy()o start_dht(
4、) stop_dht() set_dht_settings() dht_state()o add_dht_node() add_dht_router()o start_lsd() stop_lsd()o start_upnp() stop_upnp()o start_natpmp() stop_natpmp() entry o integer() string() list() dict() type()o operatoro find_key() torrent_info o torrent_info()o add_tracker()o files() orig_files()o renam
5、e_file()o begin_files() end_files() rbegin_files() rend_files()o num_files() file_at()o map_block()o map_file()o url_seeds() add_url_seed()o trackers()o total_size() piece_length() piece_size() num_pieces()o hash_for_piece() hash_for_piece_ptr() info_hash()o name() comment() creation_date() creator(
6、)o priv()o nodes()o add_node()o metadata() metadata_size() torrent_handle o piece_priority() prioritize_pieces() piece_priorities()o file_priority() prioritize_files() file_priorities()o file_progress()o save_path()o move_storage()o rename_file()o get_storage_impl()o force_reannounce()o scrape_track
7、er()o connect_peer()o name()o set_ratio()o set_upload_limit() set_download_limit() upload_limit() download_limit()o set_sequential_download() is_sequential_download()o set_peer_upload_limit() set_peer_download_limit()o pause() resume() is_paused()o force_recheck()o clear_error()o resolve_countries()
8、o is_seed()o is_auto_managed() auto_managed()o has_metadata()o set_tracker_login()o trackers() replace_trackers()o add_url_seed() remove_url_seed() url_seeds()o queue_position() queue_position_up() queue_position_down() queue_position_top() queue_position_bottom()o use_interface()o info_hash()o set_
9、max_uploads() set_max_connections()o save_resume_data()o status()o get_download_queue()o get_peer_info()o get_torrent_info()o is_valid() torrent_status peer_info session_settings pe_settings proxy_settings ip_filter o ip_filter()o add_rule()o access()o export_filter() big_number bitfield hasher fing
10、erprint UPnP and NAT-PMP o add_mappingo delete_mappingo router_model() free functions o identify_client()o client_fingerprint()o bdecode() bencode()o add_magnet_uri()o make_magnet_uri() alerts o external_ip_alerto listen_failed_alerto portmap_error_alerto portmap_alerto file_error_alerto file_rename
11、d_alerto file_rename_failed_alerto tracker_announce_alerto tracker_error_alerto tracker_reply_alerto dht_reply_alerto tracker_warning_alerto scrape_reply_alerto scrape_failed_alerto url_seed_alerto hash_failed_alerto peer_ban_alerto peer_error_alerto invalid_request_alerto torrent_finished_alerto pe
12、rformance_alerto metadata_failed_alerto metadata_received_alerto fastresume_rejected_alerto peer_blocked_alerto storage_moved_alerto storage_moved_failed_alerto torrent_paused_alerto torrent_resumed_alerto save_resume_data_alerto save_resume_data_failed_alerto dispatcher exceptions o invalid_handleo
13、 duplicate_torrento invalid_encodingo type_erroro invalid_torrent_file storage_interface o initialize()o has_any_file()o read()o write()o move_storage()o verify_resume_data()o write_resume_data()o move_slot()o swap_slots()o swap_slots3()o hash_for_slot()o rename_file()o release_files()o delete_files
14、() magnet links queuing o downloadingo seeding fast resume o file format threads storage allocation o sparse allocationo full allocationo compact allocation extensions o metadata from peerso HTTP seeding filename checks acknowledgments概述libtorrent库的接口由少量几个类组成。最主要的类是session类,它有一个为所有任务服务的主循环.基本的用法如下:l 创建一个sessionl 打开 扩展(查看 add_extension().l 打开 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();l 解析 .torrent文件 并且把它们加入到session中(查看 bdecode(), bencode(