source: trunk/libtransmission/session.h @ 5911

Last change on this file since 5911 was 5911, checked in by charles, 14 years ago

more cleanup work:
(1) kill the pointless "tr_tracker_stat" struct.
(2) kill the unused "tr_torrentRemoveSaved()" function.
(3) kill the redundant "nextManualAnnounceTime" variable.
(4) make the TR_ERROR_IS_* macros private.

  • Property svn:keywords set to Date Rev Author Id
File size: 3.7 KB
Line 
1/******************************************************************************
2 * $Id: session.h 5911 2008-05-22 23:11:21Z charles $
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#ifndef UNUSED
31#ifdef __GNUC__
32#define UNUSED __attribute__((unused))
33#else
34#define UNUSED
35#endif
36#endif
37
38typedef enum { TR_NET_OK, TR_NET_ERROR, TR_NET_WAIT } tr_tristate_t;
39
40uint8_t* tr_peerIdNew( void );
41
42const uint8_t* tr_getPeerId( void );
43
44struct tr_metainfo_lookup
45{
46    char hashString[2*SHA_DIGEST_LENGTH+1];
47    char * filename;
48};
49
50struct tr_handle
51{
52    unsigned int                 isPortSet        : 1;
53    unsigned int                 isPexEnabled     : 1;
54    unsigned int                 isClosed         : 1;
55    unsigned int                 useUploadLimit   : 1;
56    unsigned int                 useDownloadLimit : 1;
57
58    tr_encryption_mode           encryptionMode;
59
60    struct tr_event_handle     * events;
61
62    int                          peerSocketTOS;
63
64    int                          torrentCount;
65    tr_torrent                 * torrentList;
66
67    char                       * tag;
68
69    char                       * configDir;
70    char                       * downloadDir;
71    char                       * resumeDir;
72    char                       * torrentDir;
73
74    struct tr_ratecontrol      * upload;
75    struct tr_ratecontrol      * download;
76
77    struct tr_blocklist        * blocklist;
78    struct tr_peerMgr          * peerMgr;
79    struct tr_shared           * shared;
80
81    struct tr_lock             * lock;
82
83    struct tr_web              * web;
84
85    struct tr_rpc_server       * rpcServer;
86    tr_rpc_func                  rpc_func;
87    void                       * rpc_func_user_data;
88
89    struct tr_stats_handle     * sessionStats;
90    struct tr_tracker_handle   * tracker;
91
92    struct tr_metainfo_lookup  * metainfoLookup;
93    int                          metainfoLookupCount;
94};
95
96typedef struct tr_handle tr_session;
97
98const char * tr_sessionFindTorrentFile( const tr_session * session,
99                                        const char       * hashString );
100
101void tr_sessionSetTorrentFile( tr_session   * session,
102                               const char   * hashString,
103                               const char   * filename );
104
105void tr_globalLock       ( tr_session * );
106void tr_globalUnlock     ( tr_session * );
107int  tr_globalIsLocked   ( const tr_session * );
108
109
110#define TR_ERROR_IS_IO(e) (TR_ERROR_IO_PARENT<=(e) && (e)<=TR_ERROR_IO_OTHER)
111#define TR_ERROR_IS_TC(e) (TR_ERROR_TC_ERROR<=(e) && (e)<=TR_ERROR_TC_WARNING)
112
113
114#endif
Note: See TracBrowser for help on using the repository browser.