~ubuntu-branches/debian/experimental/libtorrent/experimental

« back to all changes in this revision

Viewing changes to src/torrent/torrent.h

  • Committer: Bazaar Package Importer
  • Author(s): Jose Luis Rivas
  • Date: 2007-03-31 10:31:05 UTC
  • mto: (4.1.4 gutsy) (6.2.1 squeeze) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20070331103105-jzpp1rml6ud0ff75
Tags: upstream-0.11.4
ImportĀ upstreamĀ versionĀ 0.11.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
#include <list>
41
41
#include <string>
42
 
#include <inttypes.h>
 
42
#include <torrent/common.h>
43
43
#include <torrent/download.h>
44
44
 
45
 
#include <sys/types.h>
46
 
#include <sys/select.h>
47
 
 
48
 
struct sockaddr;
49
 
 
50
45
namespace torrent {
51
46
 
52
 
class Poll;
53
 
class Rate;
54
 
class ChunkManager;
55
 
class ConnectionManager;
56
 
class Object;
57
 
 
58
47
// Make sure you seed srandom and srand48 if available.
59
 
void                initialize(Poll* poll);
 
48
void                initialize(Poll* poll) LIBTORRENT_EXPORT;
60
49
 
61
50
// Clean up and close stuff. Stopping all torrents and waiting for
62
51
// them to finish is not required, but recommended.
63
 
void                cleanup();
 
52
void                cleanup() LIBTORRENT_EXPORT;
64
53
 
65
 
int64_t             next_timeout();
 
54
int64_t             next_timeout() LIBTORRENT_EXPORT;
66
55
 
67
56
// Calls this function when get_next_timeout() is zero or at
68
57
// semi-regular intervals when socket events accure. It updates the
69
58
// cached time and performs scheduled tasks.
70
59
//
71
60
// Bad name, find something better.
72
 
void                perform();
73
 
 
74
 
bool                is_inactive();
75
 
 
76
 
ChunkManager*       chunk_manager();
77
 
ConnectionManager*  connection_manager();
78
 
 
79
 
uint32_t            total_handshakes();
 
61
void                perform() LIBTORRENT_EXPORT;
 
62
 
 
63
bool                is_inactive() LIBTORRENT_EXPORT;
 
64
 
 
65
ChunkManager*       chunk_manager() LIBTORRENT_EXPORT;
 
66
ClientList*         client_list() LIBTORRENT_EXPORT;
 
67
ConnectionManager*  connection_manager() LIBTORRENT_EXPORT;
 
68
 
 
69
uint32_t            total_handshakes() LIBTORRENT_EXPORT;
80
70
 
81
71
// These should really be unsigned, but there was a bug in the
82
72
// client. ;( Fix this later.
83
73
//
84
74
// 0 == UNLIMITED.
85
 
int32_t             down_throttle();
86
 
void                set_down_throttle(int32_t bytes);
87
 
 
88
 
int32_t             up_throttle();
89
 
void                set_up_throttle(int32_t bytes);
90
 
 
91
 
uint32_t            currently_unchoked();
92
 
uint32_t            max_unchoked();
93
 
void                set_max_unchoked(uint32_t count);
94
 
 
95
 
const Rate*         down_rate();
96
 
const Rate*         up_rate();
97
 
 
98
 
const char*         version();
 
75
int32_t             down_throttle() LIBTORRENT_EXPORT;
 
76
void                set_down_throttle(int32_t bytes) LIBTORRENT_EXPORT;
 
77
 
 
78
int32_t             up_throttle() LIBTORRENT_EXPORT;
 
79
void                set_up_throttle(int32_t bytes) LIBTORRENT_EXPORT;
 
80
 
 
81
uint32_t            currently_unchoked() LIBTORRENT_EXPORT;
 
82
uint32_t            max_unchoked() LIBTORRENT_EXPORT;
 
83
void                set_max_unchoked(uint32_t count) LIBTORRENT_EXPORT;
 
84
 
 
85
uint32_t            download_unchoked() LIBTORRENT_EXPORT;
 
86
uint32_t            max_download_unchoked() LIBTORRENT_EXPORT;
 
87
void                set_max_download_unchoked(uint32_t count) LIBTORRENT_EXPORT;
 
88
 
 
89
const Rate*         down_rate() LIBTORRENT_EXPORT;
 
90
const Rate*         up_rate() LIBTORRENT_EXPORT;
 
91
 
 
92
const char*         version() LIBTORRENT_EXPORT;
99
93
 
100
94
// Disk access tuning.
101
 
uint32_t            hash_read_ahead();
102
 
void                set_hash_read_ahead(uint32_t bytes);
103
 
 
104
 
uint32_t            hash_interval();
105
 
void                set_hash_interval(uint32_t usec);
106
 
 
107
 
uint32_t            hash_max_tries();
108
 
void                set_hash_max_tries(uint32_t tries);
109
 
 
110
 
uint32_t            open_files();
111
 
uint32_t            max_open_files();
112
 
void                set_max_open_files(uint32_t size);
113
 
 
114
 
uint32_t            open_sockets();
115
 
uint32_t            max_open_sockets();
116
 
void                set_max_open_sockets(uint32_t size);
 
95
uint32_t            hash_read_ahead() LIBTORRENT_EXPORT;
 
96
void                set_hash_read_ahead(uint32_t bytes) LIBTORRENT_EXPORT;
 
97
 
 
98
uint32_t            hash_interval() LIBTORRENT_EXPORT;
 
99
void                set_hash_interval(uint32_t usec) LIBTORRENT_EXPORT;
 
100
 
 
101
uint32_t            hash_max_tries() LIBTORRENT_EXPORT;
 
102
void                set_hash_max_tries(uint32_t tries) LIBTORRENT_EXPORT;
 
103
 
 
104
uint32_t            open_files() LIBTORRENT_EXPORT;
 
105
uint32_t            max_open_files() LIBTORRENT_EXPORT;
 
106
void                set_max_open_files(uint32_t size) LIBTORRENT_EXPORT;
117
107
 
118
108
typedef std::list<Download> DList;
119
109
typedef std::list<std::string> EncodingList;
120
110
 
121
 
EncodingList*       encoding_list();
 
111
EncodingList*       encoding_list() LIBTORRENT_EXPORT;
122
112
 
123
113
// Will always return a valid Download. On errors it
124
114
// throws. 'encodingList' contains a list of prefered encodings to use
129
119
// is done by 'download_remove'.
130
120
//
131
121
// Might consider redesigning that...
132
 
Download            download_add(Object* s);
133
 
void                download_remove(Download d);
 
122
Download            download_add(Object* s) LIBTORRENT_EXPORT;
 
123
void                download_remove(Download d) LIBTORRENT_EXPORT;
134
124
 
135
125
// Add all downloads to dlist. The client is responsible for clearing
136
126
// it before the call.
137
 
void                download_list(DList& dlist);
 
127
void                download_list(DList& dlist) LIBTORRENT_EXPORT;
138
128
 
139
129
// Make sure you check the returned Download's is_valid().
140
 
Download            download_find(const std::string& infohash);
 
130
Download            download_find(const std::string& infohash) LIBTORRENT_EXPORT;
141
131
 
142
 
uint32_t            download_priority(Download d);
143
 
void                download_set_priority(Download d, uint32_t pri);
 
132
uint32_t            download_priority(Download d) LIBTORRENT_EXPORT;
 
133
void                download_set_priority(Download d, uint32_t pri) LIBTORRENT_EXPORT;
144
134
 
145
135
}
146
136