source: trunk/gtk/tr_torrent.h @ 2441

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

more work on the speed limits as hammered out w/BentMyWookie

  • Property svn:keywords set to Date Rev Author Id
File size: 3.8 KB
Line 
1/******************************************************************************
2 * $Id: tr_torrent.h 2441 2007-07-20 03:24:04Z charles $
3 *
4 * Copyright (c) 2006-2007 Transmission authors and contributors
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *****************************************************************************/
24
25#ifndef TR_TORRENT_H
26#define TR_TORRENT_H
27
28#include <glib-object.h>
29#include <libtransmission/transmission.h>
30#include <libtransmission/bencode.h>
31#include "util.h"
32
33/* boxed type for tr_tracker_info_t */
34#define TR_TRACKER_BOXED_TYPE (tr_tracker_boxed_get_type ())
35GType
36tr_tracker_boxed_get_type( void );
37
38#define TR_TORRENT_TYPE           (tr_torrent_get_type ())
39#define TR_TORRENT(obj) \
40  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TR_TORRENT_TYPE, TrTorrent))
41#define TR_TORRENT_CLASS(klass) \
42  (G_TYPE_CHECK_CLASS_CAST ((klass), TR_TORRENT_TYPE, TrTorrentClass))
43#define TR_IS_TORRENT(obj) \
44  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TR_TORRENT_TYPE))
45#define TR_IS_TORRENT_CLASS(klass) \
46  (G_TYPE_CHECK_CLASS_TYPE ((klass), TR_TORRENT_TYPE))
47#define TR_TORRENT_GET_CLASS(obj) \
48  (G_TYPE_INSTANCE_GET_CLASS ((obj), TR_TORRENT_TYPE, TrTorrentClass))
49
50typedef struct _TrTorrent TrTorrent;
51typedef struct _TrTorrentClass TrTorrentClass;
52
53/* treat the contents of this structure as private */
54struct _TrTorrent {
55  GObject parent;
56  tr_torrent_t *handle;
57  char *dir;
58  char *delfile;
59  tr_stat_t stat;
60  time_t lastStatTime;
61
62  /* FIXME: hm, are these heavyweight enough to deserve their own properties? */
63  gboolean severed;
64  gboolean disposed;
65  gboolean seeding_cap_enabled;
66  gdouble seeding_cap; /* ratio to stop seeding at */
67};
68
69struct _TrTorrentClass {
70  GObjectClass parent;
71};
72
73GType
74tr_torrent_get_type(void);
75
76tr_torrent_t *
77tr_torrent_handle(TrTorrent *tor);
78
79const tr_stat_t *
80tr_torrent_stat(TrTorrent *tor);
81
82const tr_info_t *
83tr_torrent_info(TrTorrent *tor);
84
85void
86tr_torrent_start( TrTorrent * tor );
87
88void
89tr_torrent_stop( TrTorrent * tor );
90
91char*
92tr_torrent_status_str ( TrTorrent * tor );
93
94void
95tr_torrent_check_seeding_cap ( TrTorrent* );
96void
97tr_torrent_set_seeding_cap_ratio ( TrTorrent*, gdouble ratio );
98void
99tr_torrent_set_seeding_cap_enabled ( TrTorrent*, gboolean );
100
101TrTorrent *
102tr_torrent_new( tr_handle_t * handle, const char * path, const char * dir,
103                enum tr_torrent_action act, gboolean paused, char ** err);
104
105TrTorrent *
106tr_torrent_new_with_data( tr_handle_t * handle, uint8_t * data, size_t size,
107                          const char * dir, gboolean paused, char ** err );
108
109TrTorrent *
110tr_torrent_new_with_state( tr_handle_t * handle, benc_val_t * state,
111                           gboolean forcepaused, char ** err );
112
113gboolean
114tr_torrent_get_state( TrTorrent * tor, benc_val_t * state );
115
116void
117tr_torrent_state_saved(TrTorrent *tor);
118
119void
120tr_torrent_sever( TrTorrent * tor );
121
122#endif
Note: See TracBrowser for help on using the repository browser.