source: trunk/libtransmission/inout.h @ 14241

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

Copyedit the license's revised text: (1) remove unnecessary repitition use of the word 'license' from the top of the header and source files (2) add the standard 'we hope it's useful, but no warranty' clause to COPYING (3) make explicit that linking OpenSSL is allowed (see https://people.gnome.org/~markmc/openssl-and-the-gpl.html for background) (4) sync the Qt and GTK+ clients' license popups with COPYING's revised text

  • 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 GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: inout.h 14241 2014-01-21 03:10:30Z 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.