forked from pobrn/mktorrent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibmktorrent.h
65 lines (54 loc) · 1.52 KB
/
libmktorrent.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef _MKTORRENT_H
#define _MKTORRENT_H
#ifdef _WIN32
#define DIRSEP "\\"
#define DIRSEP_CHAR '\\'
#else
#define DIRSEP "/"
#define DIRSEP_CHAR '/'
#endif
/* string list */
struct slist_s;
typedef struct slist_s slist_t;
struct slist_s {
char *s;
slist_t *next;
};
/* list of string lists */
struct llist_s;
typedef struct llist_s llist_t;
struct llist_s {
slist_t *l;
llist_t *next;
};
/* file list */
struct flist_s;
typedef struct flist_s flist_t;
struct flist_s {
char *path;
off_t size;
flist_t *next;
};
typedef struct {
/* options */
unsigned int piece_length; /* piece length */
llist_t *announce_list; /* announce URLs */
char *comment; /* optional comment */
const char *torrent_name; /* name of torrent (name of directory) */
char *metainfo_file_path; /* absolute path to the metainfo file */
slist_t *web_seed_list; /* web seed URLs */
int target_is_directory; /* target is a directory */
int no_creation_date; /* don't write the creation date */
int private; /* set the private flag */
int verbose; /* be verbose */
#ifdef USE_PTHREADS
unsigned int threads; /* number of threads used for hashing */
#endif
/* information calculated by read_dir() */
off_t size; /* combined size of all files */
flist_t *file_list; /* list of files and their sizes */
unsigned int pieces; /* number of pieces */
} metafile_t;
metafile_t *getDefaultMetaStruc();
int mktorrent(char *, char*, metafile_t *);
#endif /* _MKTORRENT_H */