summaryrefslogtreecommitdiff
path: root/src/torrent.h
blob: 85d963235fec8acdd362e395c41aa42ff83ba429 (plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 * transmission-remote-gtk - A GTK RPC client to Transmission
 * Copyright (C) 2011  Alan Fitton

 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef TORRENT_H_
#define TORRENT_H_

#include <json-glib/json-glib.h>

#define TORRENT_FLAG_ERROR             (1 << 0) /* 0x01 */
#define TORRENT_FLAG_COMPLETE          (1 << 1) /* 0x02 */
#define TORRENT_FLAG_INCOMPLETE        (1 << 2) /* 0x04 */
#define TORRENT_FLAG_SEEDING           (1 << 3) /* 0x08 */
#define TORRENT_FLAG_CHECKING          (1 << 4) /* 0x16 */
#define TORRENT_FLAG_WAITING_CHECK     (1 << 5) /* 0x32 */
#define TORRENT_FLAG_DOWNLOADING       (1 << 6) /* 0x64 */
#define TORRENT_FLAG_PAUSED            (1 << 7) /* 0x128 */
#define TORRENT_FLAG_ACTIVE            (1 << 8) /* 0x256 */
#define FILTER_FLAG_TRACKER            (1 << 9) /* 0x512 */
#define FILTER_FLAG_DIR                (1 << 10) /* 0x1024 */

gint64 torrent_get_size(JsonObject * t);
const gchar *torrent_get_name(JsonObject * t);
gint64 torrent_get_rate_down(JsonObject * t);
gint64 torrent_get_rate_up(JsonObject * t);
gint64 torrent_get_eta(JsonObject * t);
gint64 torrent_get_uploaded(JsonObject * t);
gint64 torrent_get_downloaded(JsonObject * t);
const gchar *torrent_get_errorstr(JsonObject * t);
const gchar *torrent_get_download_dir(JsonObject * t);
gint64 torrent_get_have_unchecked(JsonObject * t);
gint64 torrent_get_have_valid(JsonObject * t);
gint64 torrent_get_status(JsonObject * t);
gchar *torrent_get_status_string(gint64 value);
gchar *torrent_get_status_icon(guint flags);
JsonArray *torrent_get_peers(JsonObject * t);
JsonArray *torrent_get_trackers(JsonObject * t);
JsonArray *torrent_get_wanted(JsonObject * t);
JsonArray *torrent_get_priorities(JsonObject * t);
gint64 torrent_get_id(JsonObject * t);
gint64 tracker_get_tier(JsonObject * t);
gint64 tracker_get_id(JsonObject * t);
const gchar *tracker_get_announce(JsonObject * t);
const gchar *tracker_get_scrape(JsonObject * t);
JsonArray *torrent_get_files(JsonObject * args);
gdouble torrent_get_percent_done(JsonObject * t);
gint64 torrent_get_left_until_done(JsonObject * t);
gboolean torrent_get_is_finished(JsonObject * t);
gboolean torrent_get_honors_session_limits(JsonObject * t);
gint64 torrent_get_bandwidth_priority(JsonObject * t);
gint64 torrent_get_upload_limit(JsonObject * t);
gint64 torrent_get_added_date(JsonObject * t);
gint64 torrent_get_done_date(JsonObject * t);
gboolean torrent_get_upload_limited(JsonObject * t);
gint64 torrent_get_download_limit(JsonObject * t);
gboolean torrent_get_download_limited(JsonObject * t);
gdouble torrent_get_seed_ratio_limit(JsonObject * t);
gint64 torrent_get_seed_ratio_mode(JsonObject * t);
gint64 torrent_get_peer_limit(JsonObject * t);
gboolean torrent_has_tracker(JsonObject * t, GRegex * rx, gchar * search);

JsonArray *get_torrents(JsonObject * response);
JsonArray *get_torrents_removed(JsonObject * response);

#endif                          /* TORRENT_H_ */