source: trunk/libtransmission/makemeta.h @ 2843

Last change on this file since 2843 was 2843, checked in by charles, 15 years ago

update version.sh to exclude third-party. add $Id:$ to the new files s.t. version.sh will find them.

File size: 2.5 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 * $Id:
11 */
12
13#ifndef TR_MAKEMETA_H
14#define TR_MAKEMETA_H 1
15
16typedef struct tr_metainfo_builder_file_s
17{
18    char * filename;
19    uint64_t size;
20}
21tr_metainfo_builder_file_t;
22
23typedef struct tr_metainfo_builder_s
24{
25    /**
26    ***  These are set by tr_makeMetaInfoBuilderCreate()
27    ***  and cleaned up by tr_metaInfoBuilderFree()
28    **/
29
30    char * top;
31    tr_metainfo_builder_file_t * files;
32    uint64_t totalSize;
33    int fileCount;
34    int pieceSize;
35    int pieceCount;
36    int isSingleFile;
37    tr_handle_t * handle;
38
39    /**
40    ***  These are set inside tr_makeMetaInfo()
41    ***  by copying the arguments passed to it,
42    ***  and cleaned up by tr_metaInfoBuilderFree()
43    **/
44
45    char * announce;
46    char * comment;
47    char * outputFile;
48    int isPrivate;
49
50    /**
51    ***  These are set inside tr_makeMetaInfo() so the client
52    ***  can poll periodically to see what the status is.
53    ***  The client can also set abortFlag to nonzero to
54    ***  tell tr_makeMetaInfo() to abort and clean up after itself.
55    **/
56
57    int pieceIndex;
58    int abortFlag;
59    int isDone;
60    int failed; /* only meaningful if isDone is set */
61
62    /**
63    ***  This is an implementation detail.
64    ***  The client should never use these fields.
65    **/
66
67    struct tr_metainfo_builder_s * nextBuilder;
68}
69tr_metainfo_builder_t;
70
71
72
73
74tr_metainfo_builder_t*
75tr_metaInfoBuilderCreate( tr_handle_t  * handle,
76                          const char   * topFile );
77
78void
79tr_metaInfoBuilderFree( tr_metainfo_builder_t* );
80
81/**
82 * 'outputFile' if NULL, builder->top + ".torrent" will be used.
83 *
84 * This is actually done in a worker thread, not the main thread!
85 * Otherwise the client's interface would lock up while this runs.
86 *
87 * It is the caller's responsibility to poll builder->isDone
88 * from time to time!  When the worker thread sets that flag,
89 * the caller must pass the builder to tr_metaInfoBuilderFree().
90 */
91void
92tr_makeMetaInfo( tr_metainfo_builder_t  * builder,
93                 const char             * outputFile,
94                 const char             * announce,
95                 const char             * comment,
96                 int                      isPrivate );
97
98
99#endif
Note: See TracBrowser for help on using the repository browser.