libtorrent+API+手册(中文版)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

libtorrentAPI文档(中文版)作者:ArvidNorberg,arvi@rasterbar.com翻译:小朋友软件,xpysoft@163.com文档原处::0.14.5内容列表·总观·网络原语·sessionosession()o~session()opause()resume()is_paused()oabort()oadd_torrent()oremove_torrent()ofind_torrent()get_torrents()oset_upload_rate_limit()set_download_rate_limit()upload_rate_limit()download_rate_limit()oset_max_uploads()set_max_connections()onum_uploads()num_connections()oset_max_half_open_connections()max_half_open_connections()oload_asnum_db()load_country_db()intas_for_ip()oload_state()state()oset_ip_filter()oget_ip_filter()ostatus()oget_cache_status()oget_cache_info()ois_listening()listen_port()listen_on()opop_alert()set_alert_mask()wait_for_alert()set_alert_queue_size_limit()oadd_extension()oset_settings()set_pe_settings()oset_peer_proxy()set_web_seed_proxy()set_tracker_proxy()set_dht_proxy()opeer_proxy()web_seed_proxy()tracker_proxy()dht_proxy()ostart_dht()stop_dht()set_dht_settings()dht_state()oadd_dht_node()add_dht_router()ostart_lsd()stop_lsd()ostart_upnp()stop_upnp()ostart_natpmp()stop_natpmp()entryointeger()string()list()dict()type()ooperator[]ofind_key()torrent_infootorrent_info()oadd_tracker()ofiles()orig_files()orename_file()obegin_files()end_files()rbegin_files()rend_files()onum_files()file_at()omap_block()omap_file()ourl_seeds()add_url_seed()otrackers()ototal_size()piece_length()piece_size()num_pieces()ohash_for_piece()hash_for_piece_ptr()info_hash()oname()comment()creation_date()creator()opriv()onodes()oadd_node()ometadata()metadata_size()torrent_handleopiece_priority()prioritize_pieces()piece_priorities()ofile_priority()prioritize_files()file_priorities()ofile_progress()osave_path()omove_storage()orename_file()oget_storage_impl()oforce_reannounce()oscrape_tracker()oconnect_peer()oname()oset_ratio()oset_upload_limit()set_download_limit()upload_limit()download_limit()oset_sequential_download()is_sequential_download()oset_peer_upload_limit()set_peer_download_limit()opause()resume()is_paused()oforce_recheck()oclear_error()oresolve_countries()ois_seed()ois_auto_managed()auto_managed()ohas_metadata()oset_tracker_login()otrackers()replace_trackers()oadd_url_seed()remove_url_seed()url_seeds()oqueue_position()queue_position_up()queue_position_down()queue_position_top()queue_position_bottom()ouse_interface()oinfo_hash()oset_max_uploads()set_max_connections()osave_resume_data()ostatus()oget_download_queue()oget_peer_info()oget_torrent_info()ois_valid()torrent_statuspeer_infosession_settingspe_settingsproxy_settingsip_filteroip_filter()oadd_rule()oaccess()oexport_filter()big_numberbitfieldhasherfingerprintUPnPandNAT-PMPoadd_mappingodelete_mappingorouter_model()freefunctionsoidentify_client()oclient_fingerprint()obdecode()bencode()oadd_magnet_uri()omake_magnet_uri()alertsoexternal_ip_alertolisten_failed_alertoportmap_error_alertoportmap_alertofile_error_alertofile_renamed_alertofile_rename_failed_alertotracker_announce_alertotracker_error_alertotracker_reply_alertodht_reply_alertotracker_warning_alertoscrape_reply_alertoscrape_failed_alertourl_seed_alertohash_failed_alertopeer_ban_alertopeer_error_alertoinvalid_request_alertotorrent_finished_alertoperformance_alertometadata_failed_alertometadata_received_alertofastresume_rejected_alertopeer_blocked_alertostorage_moved_alertostorage_moved_failed_alertotorrent_paused_alertotorrent_resumed_alertosave_resume_data_alertosave_resume_data_failed_alertodispatcherexceptionsoinvalid_handleoduplicate_torrentoinvalid_encodingotype_erroroinvalid_torrent_filestorage_interfaceoinitialize()ohas_any_file()oread()owrite()omove_storage()overify_resume_data()owrite_resume_data()omove_slot()oswap_slots()oswap_slots3()ohash_for_slot()orename_file()orelease_files()odelete_files()magnetlinksqueuingodownloadingoseedingfastresumeofileformatthreadsstorageallocationosparseallocationofullallocationocompactallocationextensionsometadatafrompeersoHTTPseedingfilenamechecks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名字空间中选出。它们是:typedefasio::ip::addressaddress;typedefasio::ip::address_v4address_v4;typedefasio::ip::address_v6address_v6;usingasio::ip::tcp;usingasio::ip::udp;这些在libtorrent/socket.hpp头文件中描述.这些表述为以下几方面提供简易接口:tcp::endpointudp::endpoint这些端点类型在libtorrent库中被使用.一个端点是一个地址与相关端口的结合。关于这些类型的文档,请查看相关asio的文件说明.session事务类有如下一些概要:classsession:publicboost::noncopyable{session(fingerprintconst&print=libtorrent::fingerprint(LT,0,1,0,0),intflags=start_default_features|add_default_p

1 / 96
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功