source: trunk/libtransmission/session.h @ 6120

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

wire up the backend proxy support.

  • Property svn:keywords set to Date Rev Author Id
File size: 3.9 KB
Line 
1/******************************************************************************
2 * $Id: session.h 6120 2008-06-10 16:16:31Z 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                 isProxyEnabled     : 1;
55    unsigned int                 isProxyAuthEnabled : 1;
56    unsigned int                 isClosed           : 1;
57    unsigned int                 useUploadLimit     : 1;
58    unsigned int                 useDownloadLimit   : 1;
59
60    tr_encryption_mode           encryptionMode;
61
62    struct tr_event_handle     * events;
63
64    int                          peerSocketTOS;
65
66    int                          torrentCount;
67    tr_torrent                 * torrentList;
68
69    char                       * tag;
70
71    char                       * configDir;
72    char                       * downloadDir;
73    char                       * resumeDir;
74    char                       * torrentDir;
75
76    char                       * proxy;
77    char                       * proxyUsername;
78    char                       * proxyPassword;
79
80    struct tr_ratecontrol      * upload;
81    struct tr_ratecontrol      * download;
82
83    struct tr_blocklist        * blocklist;
84    struct tr_peerMgr          * peerMgr;
85    struct tr_shared           * shared;
86
87    struct tr_lock             * lock;
88
89    struct tr_web              * web;
90
91    struct tr_rpc_server       * rpcServer;
92    tr_rpc_func                  rpc_func;
93    void                       * rpc_func_user_data;
94
95    struct tr_stats_handle     * sessionStats;
96    struct tr_tracker_handle   * tracker;
97
98    struct tr_metainfo_lookup  * metainfoLookup;
99    int                          metainfoLookupCount;
100};
101
102const char * tr_sessionFindTorrentFile( const tr_session * session,
103                                        const char       * hashString );
104
105void tr_sessionSetTorrentFile( tr_session   * session,
106                               const char   * hashString,
107                               const char   * filename );
108
109void tr_globalLock       ( tr_session * );
110void tr_globalUnlock     ( tr_session * );
111int  tr_globalIsLocked   ( const tr_session * );
112
113
114#define TR_ERROR_IS_IO(e) (TR_ERROR_IO_PARENT<=(e) && (e)<=TR_ERROR_IO_OTHER)
115#define TR_ERROR_IS_TC(e) (TR_ERROR_TC_ERROR<=(e) && (e)<=TR_ERROR_TC_WARNING)
116
117
118#endif
Note: See TracBrowser for help on using the repository browser.