Ticket #1559: session_init3.patch
File session_init3.patch, 23.9 KB (added by KyleK, 12 years ago) |
---|
-
daemon/daemon.c
diff -auBbr -xmissing -xinstall-sh -xmkinstalldirs -I '$Id:' TM-svn/daemon/daemon.c TM-2/daemon/daemon.c
old new 159 159 int blocklistEnabled ) 160 160 { 161 161 tr_benc state, *dict = NULL; 162 int peerPort = -1, peers = -1;163 int whitelistEnabled = -1;164 int pexEnabled = -1;165 int fwdEnabled = -1;166 int upLimit = -1, upLimited = -1, downLimit = -1,167 downLimited = -1;168 int encryption = -1;169 int useLazyBitfield = -1;170 162 tr_ctor * ctor; 171 163 tr_torrent ** torrents; 172 164 173 if( !tr_bencLoadJSONFile( myConfigFilename, &state ) ) 165 int64_t numval; 166 167 // 1. get benclist with only default values 168 169 tr_benc * sessionConfig = tr_getDefaultSettings(); 170 171 // 2. overwrite defaults with preferences from settings file 172 if( !tr_bencLoadJSONFile( myConfigFilename, &state ) ) { 174 173 dict = &state; 174 tr_bencMergeDicts( sessionConfig, dict); 175 } 175 176 177 // 3. overwrite settings with preferences from the command line 178 if(rpcPort != -1 ) { 179 replaceInt( sessionConfig, TR_PREFS_KEY_RPC_PORT, rpcPort ); 180 } 181 if(whitelist && *whitelist) { 182 replaceStr( sessionConfig, TR_PREFS_KEY_WHITELIST, whitelist ); 183 replaceInt( sessionConfig, TR_PREFS_KEY_WHITELIST_ENABLED, TRUE ); 184 } 185 if(authRequired != -1 && username && password) { 186 replaceInt( sessionConfig, TR_PREFS_KEY_RPC_AUTH_REQUIRED, authRequired ); 187 replaceStr( sessionConfig, TR_PREFS_KEY_RPC_USERNAME, username ); 188 replaceStr( sessionConfig, TR_PREFS_KEY_RPC_PASSWORD, password ); 189 } 190 if(blocklistEnabled != -1) { 191 replaceInt( sessionConfig, TR_PREFS_KEY_BLOCKLIST, blocklistEnabled ); 192 } 193 if(downloadDir != NULL) { 194 replaceStr( sessionConfig, TR_PREFS_KEY_DOWNLOAD_DIR, downloadDir ); 195 } 176 196 177 /***178 **** Decide on which values to pass into tr_sessionInitFull().179 **** The command-line arguments are given precedence and180 **** the state file from the previous session is used as a fallback.181 **** If neither of those can be found, the TR_DEFAULT fields are used .182 ***/183 184 getConfigStr( dict, KEY_DOWNLOAD_DIR, &downloadDir, TR_DEFAULT_DOWNLOAD_DIR );185 getConfigInt( dict, KEY_PEX_ENABLED, &pexEnabled, TR_DEFAULT_PEX_ENABLED );186 getConfigInt( dict, KEY_PORT_FORWARDING, &fwdEnabled, TR_DEFAULT_PORT_FORWARDING_ENABLED );187 getConfigInt( dict, KEY_PEER_PORT, &peerPort, TR_DEFAULT_PORT );188 getConfigInt( dict, KEY_DSPEED, &downLimit, 100 );189 getConfigInt( dict, KEY_DSPEED_ENABLED, &downLimited, FALSE );190 getConfigInt( dict, KEY_USPEED, &upLimit, 100 );191 getConfigInt( dict, KEY_USPEED_ENABLED, &upLimited, FALSE );192 getConfigInt( dict, KEY_LAZY_BITFIELD, &useLazyBitfield, TR_DEFAULT_LAZY_BITFIELD_ENABLED );193 getConfigInt( dict, KEY_PEER_LIMIT, &peers, TR_DEFAULT_GLOBAL_PEER_LIMIT );194 getConfigInt( dict, KEY_BLOCKLIST, &blocklistEnabled, TR_DEFAULT_BLOCKLIST_ENABLED );195 getConfigInt( dict, KEY_RPC_PORT, &rpcPort, TR_DEFAULT_RPC_PORT );196 getConfigStr( dict, KEY_WHITELIST, &whitelist, TR_DEFAULT_RPC_WHITELIST );197 getConfigInt( dict, KEY_AUTH_REQUIRED, &authRequired, FALSE );198 getConfigStr( dict, KEY_USERNAME, &username, NULL );199 getConfigStr( dict, KEY_PASSWORD, &password, NULL );200 getConfigInt( dict, KEY_ENCRYPTION, &encryption, TR_DEFAULT_ENCRYPTION );201 202 whitelistEnabled = whitelist && *whitelist;203 204 /***205 ****206 ***/207 197 208 /* start the session */ 209 mySession = tr_sessionInitFull( configDir, "daemon", downloadDir, 210 pexEnabled, fwdEnabled, peerPort, 211 encryption, 212 useLazyBitfield, 213 upLimited, upLimit, 214 downLimited, downLimit, 215 peers, 216 TR_MSG_INF, 0, 217 blocklistEnabled, 218 TR_DEFAULT_PEER_SOCKET_TOS, 219 TRUE, rpcPort, 220 whitelistEnabled, whitelist, 221 authRequired, username, password, 222 TR_DEFAULT_PROXY_ENABLED, 223 TR_DEFAULT_PROXY, 224 TR_DEFAULT_PROXY_PORT, 225 TR_DEFAULT_PROXY_TYPE, 226 TR_DEFAULT_PROXY_AUTH_ENABLED, 227 TR_DEFAULT_PROXY_USERNAME, 228 TR_DEFAULT_PROXY_PASSWORD ); 198 if(configDir && *configDir) { 199 replaceStr( sessionConfig, TR_PREFS_KEY_CONFIG_DIR, configDir ); 200 } 229 201 202 /* start the session */ 203 mySession = tr_sessionInitFull( sessionConfig ); 230 204 231 if( authRequired ) 205 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_RPC_AUTH_REQUIRED, &numval ) ); 206 if( numval != 0) 232 207 tr_ninf( MY_NAME, "requiring authentication" ); 233 208 234 209 /* load the torrents */ … … 237 212 tr_free( torrents ); 238 213 tr_ctorFree( ctor ); 239 214 215 tr_bencFree( sessionConfig ); 216 240 217 if( dict ) 241 218 tr_bencFree( &state ); 242 219 } -
libtransmission/session.c
diff -auBbr -xmissing -xinstall-sh -xmkinstalldirs -I '$Id:' TM-svn/libtransmission/session.c TM-2/libtransmission/session.c
old new 197 197 **** 198 198 ***/ 199 199 200 tr_benc * tr_getDefaultSettings( void ) { 201 202 tr_benc * d = tr_new0( tr_benc, 1 ); 203 204 tr_bencInitDict( d, 28 ); 205 tr_bencDictAddInt( d, TR_PREFS_KEY_MSGLEVEL, TR_DEFAULT_MSG_LEVEL ); 206 tr_bencDictAddInt( d, TR_PREFS_KEY_MSGQUEUE_ENABLED, TR_DEFAULT_MSGQUEUE_ENABLED ); 207 tr_bencDictAddInt( d, TR_PREFS_KEY_BLOCKLIST, TR_DEFAULT_BLOCKLIST_ENABLED ); 208 tr_bencDictAddStr( d, TR_PREFS_KEY_CONFIG_DIR, TR_DEFAULT_CONFIG_DIR ); 209 tr_bencDictAddStr( d, TR_PREFS_KEY_DOWNLOAD_DIR, TR_DEFAULT_DOWNLOAD_DIR ); 210 tr_bencDictAddInt( d, TR_PREFS_KEY_PEER_LIMIT, TR_DEFAULT_GLOBAL_PEER_LIMIT ); 211 tr_bencDictAddInt( d, TR_PREFS_KEY_PEER_PORT, TR_DEFAULT_PORT ); 212 tr_bencDictAddInt( d, TR_PREFS_KEY_PORT_FORWARDING, TR_DEFAULT_PORT_FORWARDING_ENABLED ); 213 tr_bencDictAddInt( d, TR_PREFS_KEY_PEER_SOCKET_TOS, TR_DEFAULT_PEER_SOCKET_TOS ); 214 tr_bencDictAddInt( d, TR_PREFS_KEY_PEX_ENABLED, TR_DEFAULT_PEX_ENABLED ); 215 tr_bencDictAddInt( d, TR_PREFS_KEY_RPC_ENABLED, TR_DEFAULT_RPC_ENABLED ); 216 tr_bencDictAddInt( d, TR_PREFS_KEY_RPC_PORT, TR_DEFAULT_RPC_PORT ); 217 tr_bencDictAddInt( d, TR_PREFS_KEY_RPC_AUTH_REQUIRED, TR_DEFAULT_RPC_AUTH_ENABLED ); 218 tr_bencDictAddStr( d, TR_PREFS_KEY_RPC_USERNAME, NULL ); 219 tr_bencDictAddStr( d, TR_PREFS_KEY_RPC_PASSWORD, NULL ); 220 tr_bencDictAddStr( d, TR_PREFS_KEY_WHITELIST, TR_DEFAULT_RPC_WHITELIST ); 221 tr_bencDictAddInt( d, TR_PREFS_KEY_DSPEED, 100 ); 222 tr_bencDictAddInt( d, TR_PREFS_KEY_DSPEED_ENABLED, 0 ); 223 tr_bencDictAddInt( d, TR_PREFS_KEY_USPEED, 100 ); 224 tr_bencDictAddInt( d, TR_PREFS_KEY_USPEED_ENABLED, 0 ); 225 tr_bencDictAddInt( d, TR_PREFS_KEY_PROXY_ENABLED, TR_DEFAULT_PROXY_ENABLED ); 226 tr_bencDictAddStr( d, TR_PREFS_KEY_PROXY, TR_DEFAULT_PROXY ); 227 tr_bencDictAddInt( d, TR_PREFS_KEY_PROXY_PORT, TR_DEFAULT_PROXY_PORT ); 228 tr_bencDictAddInt( d, TR_PREFS_KEY_PROXY_TYPE, TR_DEFAULT_PROXY_TYPE ); 229 tr_bencDictAddInt( d, TR_PREFS_KEY_PROXY_AUTH_ENABLED, TR_DEFAULT_ENCRYPTION ); 230 tr_bencDictAddStr( d, TR_PREFS_KEY_PROXY_USERNAME, TR_DEFAULT_PROXY_USERNAME ); 231 tr_bencDictAddStr( d, TR_PREFS_KEY_PROXY_PASSWORD, TR_DEFAULT_PROXY_PASSWORD ); 232 233 return d; 234 } 235 200 236 static void metainfoLookupRescan( tr_handle * h ); 201 237 202 238 tr_handle * 203 tr_sessionInitFull( const char * configDir, 204 const char * tag, 205 const char * downloadDir, 206 int isPexEnabled, 207 int isPortForwardingEnabled, 208 int publicPort, 209 tr_encryption_mode encryptionMode, 210 int useLazyBitfield, 211 int useUploadLimit, 212 int uploadLimit, 213 int useDownloadLimit, 214 int downloadLimit, 215 int globalPeerLimit, 216 int messageLevel, 217 int isMessageQueueingEnabled, 218 int isBlocklistEnabled, 219 int peerSocketTOS, 220 int rpcIsEnabled, 221 tr_port rpcPort, 222 int rpcWhitelistIsEnabled, 223 const char * rpcWhitelist, 224 int rpcAuthIsEnabled, 225 const char * rpcUsername, 226 const char * rpcPassword, 227 int proxyIsEnabled, 228 const char * proxy, 229 int proxyPort, 230 tr_proxy_type proxyType, 231 int proxyAuthIsEnabled, 232 const char * proxyUsername, 233 const char * proxyPassword ) 239 tr_sessionInitFull( tr_benc * sessionConfig ) 234 240 { 235 241 tr_handle * h; 236 242 char * filename; 243 int64_t numval, publicPort; 244 int64_t rpc_enabled, whitelist_enabled, rpc_auth_enabled, rpc_port; 245 const char * whitelist = NULL, *rpc_passwd = NULL, *rpc_username = NULL; 246 const char * str = NULL; 237 247 238 248 #ifndef WIN32 239 249 /* Don't exit when writing on a broken socket */ … … 241 251 #endif 242 252 243 253 tr_msgInit( ); 244 tr_setMessageLevel( messageLevel ); 245 tr_setMessageQueuing( isMessageQueueingEnabled ); 254 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_MSGLEVEL, &numval ) ); 255 tr_setMessageLevel( numval ); 256 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_MSGQUEUE_ENABLED, &numval ) ); 257 tr_setMessageQueuing( numval ); 246 258 247 259 h = tr_new0( tr_handle, 1 ); 248 260 h->lock = tr_lockNew( ); 249 h->isPexEnabled = isPexEnabled ? 1 : 0; 250 h->encryptionMode = encryptionMode; 251 h->peerSocketTOS = peerSocketTOS; 252 h->downloadDir = tr_strdup( downloadDir ); 253 h->isProxyEnabled = proxyIsEnabled ? 1 : 0; 254 h->proxy = tr_strdup( proxy ); 255 h->proxyPort = proxyPort; 256 h->proxyType = proxyType; 257 h->isProxyAuthEnabled = proxyAuthIsEnabled != 0; 258 h->proxyUsername = tr_strdup( proxyUsername ); 259 h->proxyPassword = tr_strdup( proxyPassword ); 261 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_PEX_ENABLED, &numval) ); 262 h->isPexEnabled = numval != 0; 263 assert(tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_ENCRYPTION, &numval ) ); 264 h->encryptionMode = numval; 265 assert(tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_PEER_SOCKET_TOS, &numval ) ); 266 h->peerSocketTOS = numval; 267 assert(tr_bencDictFindStr( sessionConfig, TR_PREFS_KEY_DOWNLOAD_DIR, &str ) ); 268 h->downloadDir = tr_strdup( str ); 269 assert(tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_PROXY_ENABLED, &numval ) ); 270 h->isProxyEnabled = numval != 0; 271 assert(tr_bencDictFindStr( sessionConfig, TR_PREFS_KEY_PROXY, &str ) ); 272 h->proxy = tr_strdup( str ); 273 assert(tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_PROXY_PORT, &numval ) ); 274 h->proxyPort = numval; 275 assert(tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_PROXY_TYPE, &numval ) ); 276 h->proxyType = numval; 277 assert(tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_PROXY_AUTH_ENABLED, &numval ) ); 278 h->isProxyAuthEnabled = numval != 0; 279 assert(tr_bencDictFindStr( sessionConfig, TR_PREFS_KEY_PROXY_USERNAME, &str ) ); 280 h->proxyUsername = tr_strdup( str ); 281 assert(tr_bencDictFindStr( sessionConfig, TR_PREFS_KEY_PROXY_PASSWORD, &str ) ); 282 h->proxyPassword = tr_strdup( str ); 283 260 284 h->so_sndbuf = 1500 * 3; /* 3x MTU for most ethernet/wireless */ 261 285 h->so_rcvbuf = 8192; 262 286 263 if( configDir == NULL ) 264 configDir = tr_getDefaultConfigDir( ); 265 tr_setConfigDir( h, configDir ); 287 assert( tr_bencDictFindStr( sessionConfig, TR_PREFS_KEY_CONFIG_DIR, &str ) ); 288 tr_setConfigDir( h, str ); 266 289 267 290 tr_netInit( ); /* must go before tr_eventInit */ 268 291 … … 270 293 while( !h->events ) 271 294 tr_wait( 50 ); 272 295 273 h->tag = tr_strdup( tag ); 296 assert( tr_bencDictFindStr( sessionConfig, "tag", &str ) ); 297 h->tag = tr_strdup( str ); 274 298 h->peerMgr = tr_peerMgrNew( h ); 275 299 276 h->useLazyBitfield = useLazyBitfield != 0; 300 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_LAZY_BITFIELD, &numval ) ); 301 h->useLazyBitfield = numval != 0; 277 302 278 303 /* Initialize rate and file descripts controls */ 279 304 280 tr_fdInit( globalPeerLimit ); 305 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_PEER_LIMIT, &numval ) ); 306 tr_fdInit( numval ); 281 307 282 308 /* random port */ 309 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_PORT_FORWARDING, &numval ) ); 310 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_PEER_PORT, &publicPort ) ); 283 311 if ( publicPort == -1 ) 284 312 publicPort = tr_cryptoWeakRandInt(PORT_RANDOM_MAX - PORT_RANDOM_MIN + 1) + PORT_RANDOM_MIN; 285 313 286 h->shared = tr_sharedInit( h, isPortForwardingEnabled, publicPort );314 h->shared = tr_sharedInit( h, numval, publicPort ); 287 315 h->isPortSet = publicPort >= 0; 288 316 289 317 h->bandwidth = tr_bandwidthNew( h, NULL ); 290 tr_bandwidthSetDesiredSpeed( h->bandwidth, TR_UP, uploadLimit ); 291 tr_bandwidthSetDesiredSpeed( h->bandwidth, TR_DOWN, downloadLimit ); 292 tr_bandwidthSetLimited( h->bandwidth, TR_UP, useUploadLimit ); 293 tr_bandwidthSetLimited( h->bandwidth, TR_DOWN, useDownloadLimit ); 318 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_USPEED, &numval) ); 319 tr_bandwidthSetDesiredSpeed( h->bandwidth, TR_UP, numval ); 320 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_DSPEED, &numval) ); 321 tr_bandwidthSetDesiredSpeed( h->bandwidth, TR_DOWN, numval ); 322 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_USPEED_ENABLED, &numval) ); 323 tr_bandwidthSetLimited( h->bandwidth, TR_UP, numval); 324 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_DSPEED_ENABLED, &numval) ); 325 tr_bandwidthSetLimited( h->bandwidth, TR_DOWN, numval); 294 326 295 327 /* first %s is the application name 296 328 second %s is the version number */ … … 300 332 filename = tr_buildPath( h->configDir, "blocklists", NULL ); 301 333 tr_mkdirp( filename, 0777 ); 302 334 tr_free( filename ); 303 h->isBlocklistEnabled = isBlocklistEnabled; 335 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_BLOCKLIST, &numval) ); 336 h->isBlocklistEnabled = numval; 304 337 loadBlocklists( h ); 305 338 306 339 tr_statsInit( h ); 307 340 308 341 h->web = tr_webInit( h ); 309 h->rpcServer = tr_rpcInit( h, rpcIsEnabled, rpcPort, 310 rpcWhitelistIsEnabled, rpcWhitelist, 311 rpcAuthIsEnabled, rpcUsername, rpcPassword ); 342 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_RPC_ENABLED, &rpc_enabled ) ); 343 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_RPC_PORT, &rpc_port ) ); 344 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_WHITELIST_ENABLED, &whitelist_enabled ) ); 345 assert( tr_bencDictFindInt( sessionConfig, TR_PREFS_KEY_RPC_AUTH_REQUIRED, &rpc_auth_enabled ) ); 346 347 assert( tr_bencDictFindStr( sessionConfig, TR_PREFS_KEY_WHITELIST, &whitelist ) ); 348 assert( tr_bencDictFindStr( sessionConfig, TR_PREFS_KEY_RPC_USERNAME, &rpc_username ) ); 349 assert( tr_bencDictFindStr( sessionConfig, TR_PREFS_KEY_RPC_PASSWORD, &rpc_passwd ) ); 350 351 h->rpcServer = tr_rpcInit( h, rpc_enabled, rpc_port, whitelist_enabled, whitelist, 352 rpc_auth_enabled, rpc_username, rpc_passwd ); 312 353 313 354 metainfoLookupRescan( h ); 314 355 315 356 return h; 316 357 } 317 358 318 tr_handle *319 tr_sessionInit( const char * configDir,320 const char * tag )321 {322 return tr_sessionInitFull( configDir,323 TR_DEFAULT_DOWNLOAD_DIR,324 tag,325 TR_DEFAULT_PEX_ENABLED,326 TR_DEFAULT_PORT_FORWARDING_ENABLED,327 -1, /* public port */328 TR_DEFAULT_ENCRYPTION, /* encryption mode */329 TR_DEFAULT_LAZY_BITFIELD_ENABLED,330 FALSE, /* use upload speed limit? */331 -1, /* upload speed limit */332 FALSE, /* use download speed limit? */333 -1, /* download speed limit */334 TR_DEFAULT_GLOBAL_PEER_LIMIT,335 TR_MSG_INF, /* message level */336 FALSE, /* is message queueing enabled? */337 FALSE, /* is the blocklist enabled? */338 TR_DEFAULT_PEER_SOCKET_TOS,339 TR_DEFAULT_RPC_ENABLED,340 TR_DEFAULT_RPC_PORT,341 TR_DEFAULT_RPC_WHITELIST_ENABLED,342 TR_DEFAULT_RPC_WHITELIST,343 FALSE,344 "fnord",345 "potzrebie",346 TR_DEFAULT_PROXY_ENABLED,347 TR_DEFAULT_PROXY,348 TR_DEFAULT_PROXY_PORT,349 TR_DEFAULT_PROXY_TYPE,350 TR_DEFAULT_PROXY_AUTH_ENABLED,351 TR_DEFAULT_PROXY_USERNAME,352 TR_DEFAULT_PROXY_PASSWORD );353 }354 355 359 /*** 356 360 **** 357 361 ***/ -
libtransmission/transmission.h
diff -auBbr -xmissing -xinstall-sh -xmkinstalldirs -I '$Id:' TM-svn/libtransmission/transmission.h TM-2/libtransmission/transmission.h
old new 59 59 typedef uint16_t tr_port; 60 60 typedef uint8_t tr_bool; 61 61 62 #include "bencode.h" 63 62 64 /** 63 65 * @brief returns Transmission's default configuration file directory. 64 66 * … … 119 121 #endif 120 122 /** @see tr_sessionInitFull */ 121 123 #define TR_DEFAULT_PEX_ENABLED 1 124 #define TR_DEFAULT_MSG_LEVEL TR_MSG_INF 125 #define TR_DEFAULT_MSGQUEUE_ENABLED 0 122 126 /** @see tr_sessionInitFull */ 123 127 #define TR_DEFAULT_PORT_FORWARDING_ENABLED 0 124 128 /** @see tr_sessionInitFull */ … … 136 140 /** @see tr_sessionInitFull */ 137 141 #define TR_DEFAULT_BLOCKLIST_ENABLED 0 138 142 /** @see tr_sessionInitFull */ 139 #define TR_DEFAULT_RPC_ENABLED 0 143 #define TR_DEFAULT_RPC_ENABLED 1 144 #define TR_DEFAULT_RPC_AUTH_ENABLED 0 140 145 /** @see tr_sessionInitFull */ 141 146 #define TR_DEFAULT_RPC_PORT 9091 142 147 /** @see tr_sessionInitFull */ … … 168 173 } 169 174 tr_encryption_mode; 170 175 176 #define TR_PREFS_KEY_MSGLEVEL "message-level" 177 #define TR_PREFS_KEY_MSGQUEUE_ENABLED "message-queue-enabled" 178 #define TR_PREFS_KEY_BLOCKLIST "blocklist-enabled" 179 #define TR_PREFS_KEY_CONFIG_DIR "config-dir" 180 #define TR_PREFS_KEY_DOWNLOAD_DIR "download-dir" 181 #define TR_PREFS_KEY_ENCRYPTION "encryption" 182 #define TR_PREFS_KEY_LAZY_BITFIELD "lazy-bitfield-enabled" 183 #define TR_PREFS_KEY_PEER_LIMIT "max-peers-global" 184 #define TR_PREFS_KEY_PEER_PORT "peer-port" 185 #define TR_PREFS_KEY_PEER_SOCKET_TOS "peer-socket-tos" 186 #define TR_PREFS_KEY_PORT_FORWARDING "port-forwarding-enabled" 187 #define TR_PREFS_KEY_PEX_ENABLED "pex-enabled" 188 #define TR_PREFS_KEY_WHITELIST "rpc-whitelist" 189 #define TR_PREFS_KEY_WHITELIST_ENABLED "rpc-whitelist-enabled" 190 #define TR_PREFS_KEY_RPC_ENABLED "rpc-enabled" 191 #define TR_PREFS_KEY_RPC_PORT "rpc-port" 192 #define TR_PREFS_KEY_RPC_AUTH_REQUIRED "rpc-authentication-required" 193 #define TR_PREFS_KEY_RPC_USERNAME "rpc-username" 194 #define TR_PREFS_KEY_RPC_PASSWORD "rpc-password" 195 #define TR_PREFS_KEY_DSPEED "download-limit" 196 #define TR_PREFS_KEY_DSPEED_ENABLED "download-limit-enabled" 197 #define TR_PREFS_KEY_USPEED "upload-limit" 198 #define TR_PREFS_KEY_USPEED_ENABLED "upload-limit-enabled" 199 #define TR_PREFS_KEY_PROXY_ENABLED "proxy-enabled" 200 #define TR_PREFS_KEY_PROXY "proxy" 201 #define TR_PREFS_KEY_PROXY_PORT "proxy-port" 202 #define TR_PREFS_KEY_PROXY_TYPE "proxy-type" 203 #define TR_PREFS_KEY_PROXY_AUTH_ENABLED "proxy-auth-enabled" 204 #define TR_PREFS_KEY_PROXY_USERNAME "proxy-auth-username" 205 #define TR_PREFS_KEY_PROXY_PASSWORD "proxy-auth-password" 206 207 tr_benc * tr_getDefaultSettings( void ); 208 171 209 /** 172 210 * @brief Start a libtransmission session. 173 211 * @return an opaque handle to the new session … … 264 302 * @see TR_DEFAULT_RPC_WHITELIST_ENABLED 265 303 * @see tr_sessionClose() 266 304 */ 267 tr_session * tr_sessionInitFull( const char * configDir, 268 const char * tag, 269 const char * downloadDir, 270 int isPexEnabled, 271 int isPortForwardingEnabled, 272 int publicPort, 273 tr_encryption_mode encryptionMode, 274 int useLazyBitfield, 275 int useUploadLimit, 276 int uploadLimit, 277 int useDownloadLimit, 278 int downloadLimit, 279 int peerLimit, 280 int messageLevel, 281 int isMessageQueueingEnabled, 282 int isBlocklistEnabled, 283 int peerSocketTOS, 284 int rpcIsEnabled, 285 tr_port rpcPort, 286 int rpcWhitelistIsEnabled, 287 const char * rpcWhitelist, 288 int rpcPasswordIsEnabled, 289 const char * rpcUsername, 290 const char * rpcPassword, 291 int proxyIsEnabled, 292 const char * proxy, 293 int proxyPort, 294 tr_proxy_type proxyType, 295 int proxyAuthIsEnabled, 296 const char * proxyUsername, 297 const char * proxyPassword ); 298 299 300 /** @brief Shorter form of tr_sessionInitFull() 301 @deprecated Use tr_sessionInitFull() instead. */ 302 tr_session * tr_sessionInit( const char * configDir, 303 const char * tag ); 305 306 tr_session * tr_sessionInitFull( tr_benc * sessionConfig ); 304 307 305 308 /** @brief End a libtransmission session 306 309 @see tr_sessionInitFull() */