transmission/libtransmission/inout.h

46 lines
1.3 KiB
C
Raw Normal View History

// This file Copyright © 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),
// 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
#pragma once
#ifndef __TRANSMISSION__
#error only libtransmission should #include this header.
#endif
#include <cstddef> // size_t
#include <cstdint> // uint8_t, uint32_t
2023-07-08 15:24:03 +00:00
#include "libtransmission/transmission.h"
2023-07-08 15:24:03 +00:00
#include "libtransmission/block-info.h"
struct tr_torrent;
2006-07-16 19:39:23 +00:00
/**
* @addtogroup file_io File IO
* @{
*/
/**
* 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.
*/
2023-04-14 22:06:26 +00:00
[[nodiscard]] int tr_ioRead(struct tr_torrent* tor, tr_block_info::Location const& loc, size_t len, uint8_t* setme);
2023-04-14 22:06:26 +00:00
int tr_ioPrefetch(tr_torrent* tor, tr_block_info::Location const& loc, size_t len);
/**
* 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.
*/
2023-04-14 22:06:26 +00:00
[[nodiscard]] int tr_ioWrite(struct tr_torrent* tor, tr_block_info::Location const& loc, size_t len, uint8_t const* writeme);
2007-01-14 12:00:21 +00:00
/**
* @brief Test to see if the piece matches its metainfo's SHA1 checksum.
*/
bool tr_ioTestPiece(tr_torrent* tor, tr_piece_index_t piece);
2006-07-16 19:39:23 +00:00
/* @} */