support for sha1 file-hashes
This commit is contained in:
@@ -222,6 +222,7 @@ The ``create_torrent`` class has the following synopsis::
|
||||
, merkle = 2
|
||||
, modification_time = 4
|
||||
, symlink = 8
|
||||
, calculate_file_hashes = 16
|
||||
};
|
||||
create_torrent(file_storage& fs, int piece_size = 0, int pad_size_limit = -1, int flags = optimize);
|
||||
create_torrent(torrent_info const& ti);
|
||||
@@ -233,6 +234,7 @@ The ``create_torrent`` class has the following synopsis::
|
||||
void set_comment(char const* str);
|
||||
void set_creator(char const* str);
|
||||
void set_hash(int index, sha1_hash const& h);
|
||||
void set_file_hash(int index, sha1_hash const& h);
|
||||
void add_url_seed(std::string const& url);
|
||||
void add_node(std::pair<std::string, int> const& node);
|
||||
void add_tracker(std::string const& url, int tier = 0);
|
||||
@@ -254,6 +256,7 @@ create_torrent()
|
||||
, merkle = 2
|
||||
, modification_time = 4
|
||||
, symlink = 8
|
||||
, calculate_file_hashes = 16
|
||||
};
|
||||
create_torrent(file_storage& fs, int piece_size = 0, int pad_size_limit = -1, int flags = optimize);
|
||||
create_torrent(torrent_info const& ti);
|
||||
@@ -303,6 +306,12 @@ symlink
|
||||
of the symlink so that the original directory structure can be reproduced
|
||||
on the downloading side.
|
||||
|
||||
calculate_file_hashes
|
||||
If this is set, the `set_piece_hashes()`_ function will, as it calculates
|
||||
the piece hashes, also calculate the file hashes and add those associated
|
||||
with each file. Note that unless you use the `set_piece_hashes()`_ function,
|
||||
this flag will have no effect.
|
||||
|
||||
generate()
|
||||
----------
|
||||
|
||||
@@ -366,6 +375,17 @@ to set the hash for every piece in the torrent before generating it. If you have
|
||||
the files on disk, you can use the high level convenience function to do this.
|
||||
See `set_piece_hashes()`_.
|
||||
|
||||
set_file_hash()
|
||||
---------------
|
||||
|
||||
::
|
||||
|
||||
void set_file_hash(int index, sha1_hash const& h);
|
||||
|
||||
This sets the sha1 hash for this file. This hash will end up under the key ``sha1``
|
||||
associated with this file (for multi-file torrents) or in the root info dictionary
|
||||
for single-file torrents.
|
||||
|
||||
add_url_seed()
|
||||
--------------
|
||||
|
||||
|
@@ -1653,9 +1653,12 @@ iterators with the type ``file_entry``.
|
||||
size_type offset;
|
||||
size_type size;
|
||||
size_type file_base;
|
||||
std::string symlink_path;
|
||||
boost::shared_ptr<sha1_hash> filehash;
|
||||
bool pad_file:1;
|
||||
bool hidden_attribute:1;
|
||||
bool executable_attribute:1;
|
||||
bool symlink_attribute:1;
|
||||
};
|
||||
|
||||
The ``path`` is the full (relative) path of each file. i.e. if it is a multi-file
|
||||
@@ -1678,6 +1681,16 @@ They are just there to make sure the next file is aligned to a particular byte o
|
||||
or piece boundry. These files should typically be hidden from an end user. They are
|
||||
not written to disk.
|
||||
|
||||
``hidden_attribute`` is true if the file was marked as hidden (on windows).
|
||||
|
||||
``executable_attribute`` is true if the file was marked as executable (posix)
|
||||
|
||||
``symlink_attribute`` is true if the file was a symlink. If this is the case
|
||||
the ``symlink_path`` specifies the original location where the data for this file
|
||||
was found.
|
||||
|
||||
``filehash`` is a pointer that is set in case the torrent file included a sha1 hash
|
||||
for this file. This may be use to look up more sources for this file on other networks.
|
||||
|
||||
num_files() file_at()
|
||||
---------------------
|
||||
|
Reference in New Issue
Block a user