source: trunk/libtransmission/inout.h @ 14225

Last change on this file since 14225 was 14225, checked in by jordan, 7 years ago

Licensing changes:

  1. add the option the code to be used under GPLv2 or GPLv3; previously only GPLv2 was allowed
  1. add the "proxy option" as described in GPLv3 so we can add future licenses without having to bulk-edit everything again :)
  1. remove the awkward "exception for MIT code in Mac client" clause; it was unnecessary and confusing.
  • Property svn:keywords set to Date Rev Author Id
File size: 1.8 KB
Line 
1/*
2 * This file Copyright (C) 2007-2014 Mnemosyne LLC
3 *
4 * It may be used under the GNU Public License v2 or v3 licenses,
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: inout.h 14225 2014-01-19 01:09:44Z jordan $
8 */
9
10#ifndef __TRANSMISSION__
11 #error only libtransmission should #include this header.
12#endif
13
14#ifndef TR_IO_H
15#define TR_IO_H 1
16
17struct tr_torrent;
18
19/**
20 * @addtogroup file_io File IO
21 * @{
22 */
23
24/**
25 * Reads the block specified by the piece index, offset, and length.
26 * @return 0 on success, or an errno value on failure.
27 */
28int tr_ioRead (struct tr_torrent   * tor,
29               tr_piece_index_t      pieceIndex,
30               uint32_t              offset,
31               uint32_t              len,
32               uint8_t             * setme);
33
34int tr_ioPrefetch (tr_torrent       * tor,
35                   tr_piece_index_t   pieceIndex,
36                   uint32_t           begin,
37                   uint32_t           len);
38
39/**
40 * Writes the block specified by the piece index, offset, and length.
41 * @return 0 on success, or an errno value on failure.
42 */
43int tr_ioWrite (struct tr_torrent  * tor,
44                tr_piece_index_t     pieceIndex,
45                uint32_t             offset,
46                uint32_t             len,
47                const uint8_t      * writeme);
48
49/**
50 * @brief Test to see if the piece matches its metainfo's SHA1 checksum.
51 */
52bool tr_ioTestPiece (tr_torrent       * tor,
53                     tr_piece_index_t   piece);
54
55
56/**
57 * Converts a piece index + offset into a file index + offset.
58 */
59void tr_ioFindFileLocation (const tr_torrent  * tor,
60                             tr_piece_index_t   pieceIndex,
61                             uint32_t           pieceOffset,
62                             tr_file_index_t  * fileIndex,
63                             uint64_t         * fileOffset);
64
65
66/* @} */
67#endif
Note: See TracBrowser for help on using the repository browser.