source: branches/file_selection/libtransmission/makemeta.h @ 2143

Last change on this file since 2143 was 2143, checked in by charles, 15 years ago
  • fix 'piece size is always 1MB on 32 bit machines' bug.
  • fix label typo in gtk+ client
File size: 2.4 KB
Line 
1/*
2 * This file Copyright (C) 2007 Charles Kerr <charles@rebelbase.com>
3 *
4 * This file is licensed by the GPL version 2.  Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 */
10
11#ifndef TR_MAKEMETA_H
12#define TR_MAKEMETA_H 1
13
14typedef struct tr_metainfo_builder_s
15{
16    /**
17    ***  These are set by tr_makeMetaInfo()
18    ***  and cleaned up by tr_metaInfoBuilderFree()
19    **/
20
21    char * top;
22    char ** files;
23    uint64_t * fileLengths;
24    uint64_t totalSize;
25    int fileCount;
26    int pieceSize;
27    int pieceCount;
28    int isSingleFile;
29    tr_handle_t * handle;
30
31    /**
32    ***  These are set inside tr_makeMetaInfo()
33    ***  by copying the arguments passed to it,
34    ***  and cleaned up by tr_metaInfoBuilderFree()
35    **/
36
37    char * announce;
38    char * comment;
39    char * outputFile;
40    int isPrivate;
41
42    /**
43    ***  These are set inside tr_makeMetaInfo() so the client
44    ***  can poll periodically to see what the status is.
45    ***  The client can also set abortFlag to nonzero to
46    ***  tell tr_makeMetaInfo() to abort and clean up after itself.
47    **/
48
49    int pieceIndex;
50    int abortFlag;
51    int isDone;
52    int failed; /* only meaningful if isDone is set */
53
54    /**
55    ***  This is an implementation detail.
56    ***  The client should never use these fields.
57    **/
58
59    struct tr_metainfo_builder_s * nextBuilder;
60}
61tr_metainfo_builder_t;
62
63
64
65
66tr_metainfo_builder_t*
67tr_metaInfoBuilderCreate( tr_handle_t  * handle,
68                          const char   * topFile );
69
70void
71tr_metaInfoBuilderFree( tr_metainfo_builder_t* );
72
73/**
74 * 'outputFile' if NULL, builder->top + ".torrent" will be used.
75 *
76 * This is actually done in a worker thread, not the main thread!
77 * Otherwise the client's interface would lock up while this runs.
78 *
79 * It is the caller's responsibility to poll builder->isDone
80 * from time to time!  When the worker thread sets that flag,
81 * the caller must pass the builder to tr_metaInfoBuilderFree().
82 */
83void
84tr_makeMetaInfo( tr_metainfo_builder_t  * builder,
85                 const char             * outputFile,
86                 const char             * announce,
87                 const char             * comment,
88                 int                      isPrivate );
89
90
91#endif
Note: See TracBrowser for help on using the repository browser.