source: trunk/libtransmission/session.h @ 7069

Last change on this file since 7069 was 7069, checked in by charles, 10 years ago

more fucking around with the speed measurements.

  • Property svn:keywords set to Date Rev Author Id
File size: 4.5 KB
Line 
1/******************************************************************************
2 * $Id: session.h 7069 2008-11-08 02:49:04Z 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
38
39typedef enum { TR_NET_OK, TR_NET_ERROR, TR_NET_WAIT } tr_tristate_t;
40
41uint8_t*       tr_peerIdNew( void );
42
43const uint8_t* tr_getPeerId( void );
44
45struct tr_metainfo_lookup
46{
47    char    hashString[2 * SHA_DIGEST_LENGTH + 1];
48    char *  filename;
49};
50
51struct tr_ratecontrol;
52
53struct tr_handle
54{
55    unsigned int                 isPortSet          : 1;
56    unsigned int                 isPexEnabled       : 1;
57    unsigned int                 isBlocklistEnabled : 1;
58    unsigned int                 isProxyEnabled     : 1;
59    unsigned int                 isProxyAuthEnabled : 1;
60    unsigned int                 isClosed           : 1;
61    unsigned int                 useUploadLimit     : 1;
62    unsigned int                 useDownloadLimit   : 1;
63    unsigned int                 useLazyBitfield    : 1;
64
65    tr_encryption_mode           encryptionMode;
66
67    struct tr_event_handle *     events;
68
69    int                          proxyPort;
70    int                          peerSocketTOS;
71
72    int                          torrentCount;
73    tr_torrent *                 torrentList;
74
75    char *                       tag;
76
77    char *                       configDir;
78    char *                       downloadDir;
79    char *                       resumeDir;
80    char *                       torrentDir;
81
82    tr_proxy_type                proxyType;
83    char *                       proxy;
84    char *                       proxyUsername;
85    char *                       proxyPassword;
86
87    int                          uploadLimit;
88    int                          downloadLimit;
89
90    struct tr_list *             blocklists;
91    struct tr_peerMgr *          peerMgr;
92    struct tr_shared *           shared;
93
94    struct tr_lock *             lock;
95
96    struct tr_web *              web;
97
98    struct tr_rpc_server *       rpcServer;
99    tr_rpc_func                  rpc_func;
100    void *                       rpc_func_user_data;
101
102    struct tr_stats_handle *     sessionStats;
103    struct tr_tracker_handle *   tracker;
104
105    struct tr_metainfo_lookup *  metainfoLookup;
106    int                          metainfoLookupCount;
107
108    /* the rate at which pieces are being transferred between client and peer.
109     * protocol overhead is NOT included; this is only the piece data */
110    struct tr_ratecontrol     *  pieceSpeed[2];
111
112    /* the rate at which bytes are being transferred between client and peer. */
113    struct tr_ratecontrol     *  rawSpeed[2];
114};
115
116const char * tr_sessionFindTorrentFile( const tr_session * session,
117                                        const char *       hashString );
118
119void         tr_sessionSetTorrentFile( tr_session * session,
120                                       const char * hashString,
121                                       const char * filename );
122
123struct in_addr;
124
125int          tr_sessionIsAddressBlocked( const tr_session *     session,
126                                         const struct in_addr * addr );
127
128
129void         tr_globalLock( tr_session * );
130
131void         tr_globalUnlock( tr_session * );
132
133int          tr_globalIsLocked( const tr_session * );
134
135#endif
Note: See TracBrowser for help on using the repository browser.