2022-01-20 18:27:56 +00:00
|
|
|
// This file Copyright © 2007-2022 Mnemosyne LLC.
|
2022-08-08 18:05:39 +00:00
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
2022-01-20 18:27:56 +00:00
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2017-11-14 20:21:28 +00:00
|
|
|
#pragma once
|
|
|
|
|
2008-11-24 20:17:36 +00:00
|
|
|
#ifndef __TRANSMISSION__
|
2017-04-19 12:04:45 +00:00
|
|
|
#error only libtransmission should #include this header.
|
2008-11-24 20:17:36 +00:00
|
|
|
#endif
|
|
|
|
|
2022-04-08 01:50:26 +00:00
|
|
|
#include <cstdint> // uint8_t, uint32_t
|
|
|
|
|
2022-02-19 16:07:08 +00:00
|
|
|
#include "transmission.h"
|
|
|
|
|
|
|
|
#include "block-info.h"
|
|
|
|
|
2007-09-20 16:32:01 +00:00
|
|
|
struct tr_torrent;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2009-05-29 19:17:12 +00:00
|
|
|
/**
|
|
|
|
* @addtogroup file_io File IO
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2008-01-18 19:13:32 +00:00
|
|
|
/**
|
|
|
|
* Reads the block specified by the piece index, offset, and length.
|
2008-10-03 04:49:06 +00:00
|
|
|
* @return 0 on success, or an errno value on failure.
|
2008-01-18 19:13:32 +00:00
|
|
|
*/
|
2022-02-19 16:07:08 +00:00
|
|
|
int tr_ioRead(struct tr_torrent* tor, tr_block_info::Location loc, uint32_t len, uint8_t* setme);
|
2008-01-18 19:13:32 +00:00
|
|
|
|
2022-02-19 16:07:08 +00:00
|
|
|
int tr_ioPrefetch(tr_torrent* tor, tr_block_info::Location loc, uint32_t len);
|
2009-11-08 23:43:38 +00:00
|
|
|
|
2008-01-18 19:13:32 +00:00
|
|
|
/**
|
|
|
|
* Writes the block specified by the piece index, offset, and length.
|
2008-10-03 04:49:06 +00:00
|
|
|
* @return 0 on success, or an errno value on failure.
|
2008-01-18 19:13:32 +00:00
|
|
|
*/
|
2022-02-19 16:07:08 +00:00
|
|
|
int tr_ioWrite(struct tr_torrent* tor, tr_block_info::Location loc, uint32_t len, uint8_t const* writeme);
|
2007-01-14 12:00:21 +00:00
|
|
|
|
2007-09-20 16:32:01 +00:00
|
|
|
/**
|
2008-12-31 18:08:13 +00:00
|
|
|
* @brief Test to see if the piece matches its metainfo's SHA1 checksum.
|
2008-02-15 16:00:46 +00:00
|
|
|
*/
|
2017-04-19 12:04:45 +00:00
|
|
|
bool tr_ioTestPiece(tr_torrent* tor, tr_piece_index_t piece);
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2009-05-29 19:17:12 +00:00
|
|
|
/* @} */
|