source: trunk/libtransmission/session.h @ 7151

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

(libT) add #ifdefs to ensure that client apps don't #include private libtransmission headers.

  • Property svn:keywords set to Date Rev Author Id
File size: 4.5 KB
Line 
1/******************************************************************************
2 * $Id: session.h 7151 2008-11-24 20:17:36Z 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_bandwidth;
56
57struct tr_handle
58{
59    unsigned int                 isPortSet          : 1;
60    unsigned int                 isPexEnabled       : 1;
61    unsigned int                 isBlocklistEnabled : 1;
62    unsigned int                 isProxyEnabled     : 1;
63    unsigned int                 isProxyAuthEnabled : 1;
64    unsigned int                 isClosed           : 1;
65    unsigned int                 useUploadLimit     : 1;
66    unsigned int                 useDownloadLimit   : 1;
67    unsigned int                 useLazyBitfield    : 1;
68
69    tr_encryption_mode           encryptionMode;
70
71    struct tr_event_handle *     events;
72
73    int                          proxyPort;
74    int                          peerSocketTOS;
75
76    int                          torrentCount;
77    tr_torrent *                 torrentList;
78
79    char *                       tag;
80
81    char *                       configDir;
82    char *                       downloadDir;
83    char *                       resumeDir;
84    char *                       torrentDir;
85
86    tr_proxy_type                proxyType;
87    char *                       proxy;
88    char *                       proxyUsername;
89    char *                       proxyPassword;
90
91    int                          uploadLimit;
92    int                          downloadLimit;
93
94    struct tr_list *             blocklists;
95    struct tr_peerMgr *          peerMgr;
96    struct tr_shared *           shared;
97
98    struct tr_lock *             lock;
99
100    struct tr_web *              web;
101
102    struct tr_rpc_server *       rpcServer;
103    tr_rpc_func                  rpc_func;
104    void *                       rpc_func_user_data;
105
106    struct tr_stats_handle *     sessionStats;
107    struct tr_tracker_handle *   tracker;
108
109    struct tr_metainfo_lookup *  metainfoLookup;
110    int                          metainfoLookupCount;
111
112    /* the size of the output buffer for peer connections */
113    int so_sndbuf;
114
115    /* the size of the input buffer for peer connections */
116    int so_rcvbuf;
117
118    /* monitors the "global pool" speeds */
119    struct tr_bandwidth       * bandwidth[2];
120};
121
122const char * tr_sessionFindTorrentFile( const tr_session * session,
123                                        const char *       hashString );
124
125void         tr_sessionSetTorrentFile( tr_session * session,
126                                       const char * hashString,
127                                       const char * filename );
128
129struct in_addr;
130
131int          tr_sessionIsAddressBlocked( const tr_session *     session,
132                                         const struct in_addr * addr );
133
134
135void         tr_globalLock( tr_session * );
136
137void         tr_globalUnlock( tr_session * );
138
139int          tr_globalIsLocked( const tr_session * );
140
141#endif
Note: See TracBrowser for help on using the repository browser.