source: trunk/libtransmission/session.h @ 7468

Last change on this file since 7468 was 7468, checked in by charles, 12 years ago

(trunk) patch from wereHamster to finish off tr_handle

  • Property svn:keywords set to Date Rev Author Id
File size: 4.6 KB
Line 
1/******************************************************************************
2 * $Id: session.h 7468 2008-12-22 19:14:43Z 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 __TRANSMISSION__
26#error only libtransmission should #include this header.
27#endif
28
29#ifndef TR_INTERNAL_H
30#define TR_INTERNAL_H 1
31
32#define TR_NAME "Transmission"
33
34#ifndef UNUSED
35 #ifdef __GNUC__
36  #define UNUSED __attribute__ ( ( unused ) )
37 #else
38  #define UNUSED
39 #endif
40#endif
41
42
43typedef enum { TR_NET_OK, TR_NET_ERROR, TR_NET_WAIT } tr_tristate_t;
44
45uint8_t*       tr_peerIdNew( void );
46
47const uint8_t* tr_getPeerId( void );
48
49struct tr_metainfo_lookup
50{
51    char    hashString[2 * SHA_DIGEST_LENGTH + 1];
52    char *  filename;
53};
54
55struct tr_address;
56struct tr_bandwidth;
57
58struct tr_session
59{
60    tr_bool                      isPortSet;
61    tr_bool                      isPortRandom;
62    tr_bool                      isPexEnabled;
63    tr_bool                      isBlocklistEnabled;
64    tr_bool                      isProxyEnabled;
65    tr_bool                      isProxyAuthEnabled;
66    tr_bool                      isClosed;
67    tr_bool                      useLazyBitfield;
68
69    tr_bool                      isSpeedLimited[2];
70    int                          speedLimit[2];
71
72    tr_encryption_mode           encryptionMode;
73
74    struct tr_event_handle *     events;
75
76    uint16_t                     peerLimitPerTorrent;
77
78    tr_port                      peerPort;
79    tr_port                      randomPortLow;
80    tr_port                      randomPortHigh;
81
82    int                          proxyPort;
83    int                          peerSocketTOS;
84
85    int                          torrentCount;
86    tr_torrent *                 torrentList;
87
88    char *                       tag;
89    char *                       configDir;
90    char *                       downloadDir;
91    char *                       resumeDir;
92    char *                       torrentDir;
93
94    tr_proxy_type                proxyType;
95    char *                       proxy;
96    char *                       proxyUsername;
97    char *                       proxyPassword;
98
99    struct tr_list *             blocklists;
100    struct tr_peerMgr *          peerMgr;
101    struct tr_shared *           shared;
102
103    struct tr_lock *             lock;
104
105    struct tr_web *              web;
106
107    struct tr_rpc_server *       rpcServer;
108    tr_rpc_func                  rpc_func;
109    void *                       rpc_func_user_data;
110
111    struct tr_stats_handle *     sessionStats;
112    struct tr_tracker_handle *   tracker;
113
114    struct tr_metainfo_lookup *  metainfoLookup;
115    int                          metainfoLookupCount;
116
117    /* the size of the output buffer for peer connections */
118    int so_sndbuf;
119
120    /* the size of the input buffer for peer connections */
121    int so_rcvbuf;
122
123    /* monitors the "global pool" speeds */
124    struct tr_bandwidth       * bandwidth;
125};
126
127const char * tr_sessionFindTorrentFile( const tr_session * session,
128                                        const char *       hashString );
129
130void         tr_sessionSetTorrentFile( tr_session * session,
131                                       const char * hashString,
132                                       const char * filename );
133
134tr_bool      tr_sessionIsAddressBlocked( const tr_session        * session,
135                                         const struct tr_address * addr );
136
137
138void         tr_globalLock( tr_session * );
139
140void         tr_globalUnlock( tr_session * );
141
142tr_bool      tr_globalIsLocked( const tr_session * );
143
144#endif
Note: See TracBrowser for help on using the repository browser.