1 | /****************************************************************************** |
---|
2 | * $Id:$ |
---|
3 | * |
---|
4 | * Copyright (c) 2005-2008 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_INTERNAL_H |
---|
26 | #define TR_INTERNAL_H 1 |
---|
27 | |
---|
28 | #define TR_NAME "Transmission" |
---|
29 | |
---|
30 | #ifdef __GNUC__ |
---|
31 | #define UNUSED __attribute__((unused)) |
---|
32 | #else |
---|
33 | #define UNUSED |
---|
34 | #endif |
---|
35 | |
---|
36 | typedef enum { TR_NET_OK, TR_NET_ERROR, TR_NET_WAIT } tr_tristate_t; |
---|
37 | |
---|
38 | #ifndef TRUE |
---|
39 | #define TRUE 1 |
---|
40 | #endif |
---|
41 | |
---|
42 | #ifndef FALSE |
---|
43 | #define FALSE 0 |
---|
44 | #endif |
---|
45 | |
---|
46 | int tr_trackerInfoInit( struct tr_tracker_info * info, |
---|
47 | const char * address, |
---|
48 | int address_len ); |
---|
49 | |
---|
50 | void tr_trackerInfoClear( struct tr_tracker_info * info ); |
---|
51 | |
---|
52 | uint8_t* tr_peerIdNew( void ); |
---|
53 | |
---|
54 | const uint8_t* tr_getPeerId( void ); |
---|
55 | |
---|
56 | struct tr_handle |
---|
57 | { |
---|
58 | unsigned int isPortSet : 1; |
---|
59 | unsigned int isPexEnabled : 1; |
---|
60 | unsigned int isClosed : 1; |
---|
61 | unsigned int useUploadLimit : 1; |
---|
62 | unsigned int useDownloadLimit : 1; |
---|
63 | |
---|
64 | tr_encryption_mode encryptionMode; |
---|
65 | |
---|
66 | struct tr_event_handle * events; |
---|
67 | |
---|
68 | int torrentCount; |
---|
69 | tr_torrent * torrentList; |
---|
70 | |
---|
71 | char * tag; |
---|
72 | |
---|
73 | char * configDir; |
---|
74 | char * torrentDir; |
---|
75 | char * resumeDir; |
---|
76 | |
---|
77 | struct tr_ratecontrol * upload; |
---|
78 | struct tr_ratecontrol * download; |
---|
79 | |
---|
80 | struct tr_blocklist * blocklist; |
---|
81 | struct tr_peerMgr * peerMgr; |
---|
82 | struct tr_shared * shared; |
---|
83 | |
---|
84 | struct tr_lock * lock; |
---|
85 | |
---|
86 | tr_handle_status stats[2]; |
---|
87 | int statCur; |
---|
88 | |
---|
89 | struct tr_stats_handle * sessionStats; |
---|
90 | struct tr_tracker_handle * tracker; |
---|
91 | }; |
---|
92 | |
---|
93 | void tr_globalLock ( struct tr_handle * ); |
---|
94 | void tr_globalUnlock ( struct tr_handle * ); |
---|
95 | int tr_globalIsLocked ( const struct tr_handle * ); |
---|
96 | |
---|
97 | #endif |
---|