source: trunk/gtk/tr_torrent.h @ 1125

Last change on this file since 1125 was 760, checked in by joshe, 15 years ago

Change all my 2-clause BSD licenses to the same MIT/X11 license as libtransmission.

  • Property svn:keywords set to Date Rev Author Id
File size: 3.3 KB
Line 
1/******************************************************************************
2 * $Id: tr_torrent.h 760 2006-08-13 00:26:52Z livings124 $
3 *
4 * Copyright (c) 2006 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
30#include "transmission.h"
31#include "bencode.h"
32
33#define TR_TORRENT_TYPE           (tr_torrent_get_type ())
34#define TR_TORRENT(obj) \
35  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TR_TORRENT_TYPE, TrTorrent))
36#define TR_TORRENT_CLASS(klass) \
37  (G_TYPE_CHECK_CLASS_CAST ((klass), TR_TORRENT_TYPE, TrTorrentClass))
38#define TR_IS_TORRENT(obj) \
39  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TR_TORRENT_TYPE))
40#define TR_IS_TORRENT_CLASS(klass) \
41  (G_TYPE_CHECK_CLASS_TYPE ((klass), TR_TORRENT_TYPE))
42#define TR_TORRENT_GET_CLASS(obj) \
43  (G_TYPE_INSTANCE_GET_CLASS ((obj), TR_TORRENT_TYPE, TrTorrentClass))
44
45typedef struct _TrTorrent TrTorrent;
46typedef struct _TrTorrentClass TrTorrentClass;
47
48/* treat the contents of this structure as private */
49struct _TrTorrent {
50  GObject parent;
51  tr_torrent_t *handle;
52  GObject *back;
53  char *dir;
54  gboolean closing;
55  char *delfile;
56  gboolean disposed;
57};
58
59struct _TrTorrentClass {
60  GObjectClass parent;
61  int paused_signal_id;
62};
63
64GType
65tr_torrent_get_type(void);
66
67tr_torrent_t *
68tr_torrent_handle(TrTorrent *tor);
69
70tr_stat_t *
71tr_torrent_stat(TrTorrent *tor);
72
73tr_info_t *
74tr_torrent_info(TrTorrent *tor);
75
76/* explicitly start the torrent running or paused */
77#define TR_TORNEW_PAUSED        0x01
78#define TR_TORNEW_RUNNING       0x02
79/* load a saved torrent file, torrent param is hash instead of filename */
80#define TR_TORNEW_LOAD_SAVED    0x04
81/* save a private copy of the torrent file */
82#define TR_TORNEW_SAVE_COPY     0x08
83/* save a private copy of the torrent file and remove the original */
84#define TR_TORNEW_SAVE_MOVE     0x10
85
86TrTorrent *
87tr_torrent_new(GObject *backend, const char *torrent, const char *dir,
88               guint flags, char **err);
89
90TrTorrent *
91tr_torrent_new_with_state(GObject *backend, benc_val_t *state, char **err);
92
93void
94tr_torrent_stop_politely(TrTorrent *tor);
95
96tr_stat_t *
97tr_torrent_stat_polite(TrTorrent *tor);
98
99#ifdef TR_WANT_TORRENT_PRIVATE
100void
101tr_torrent_get_state(TrTorrent *tor, benc_val_t *state);
102void
103tr_torrent_state_saved(TrTorrent *tor);
104#endif
105
106#endif
Note: See TracBrowser for help on using the repository browser.