Changeset 6146
- Timestamp:
- Jun 11, 2008, 8:09:36 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/daemon.c
r6120 r6146 34 34 static char myConfigFilename[MAX_PATH_LENGTH]; 35 35 36 #define KEY_BLOCKLIST "blocklist-enabled" 37 #define KEY_DOWNLOAD_DIR "download-dir" 38 #define KEY_ENCRYPTION "encryption" 39 #define KEY_PEER_LIMIT "peer-limit" 40 #define KEY_PEER_PORT "peer-port" 41 #define KEY_PORT_FORWARDING "port-forwarding-enabled" 42 #define KEY_PEX_ENABLED "pex-enabled" 43 #define KEY_AUTH_REQUIRED "rpc-auth-required" 44 #define KEY_USERNAME "rpc-username" 45 #define KEY_PASSWORD "rpc-password" 46 #define KEY_ACL "rpc-acl" 47 #define KEY_RPC_PORT "rpc-port" 48 #define KEY_DSPEED "speed-limit-down" 49 #define KEY_DSPEED_ENABLED "speed-limit-down-enabled" 50 #define KEY_USPEED "speed-limit-up" 51 #define KEY_USPEED_ENABLED "speed-limit-up-enabled" 52 53 #define CONFIG_FILE "session.json" 54 55 const char * encryption_str[3] = { "tolerated", "preferred", "required" }; 56 36 57 static void 37 saveState( tr_ handle * h)58 saveState( tr_session * s ) 38 59 { 39 60 tr_benc d; 40 const char * str; 41 char * username = tr_sessionGetRPCUsername( h ); 42 char * password = tr_sessionGetRPCPassword( h ); 43 char * auth = tr_strdup_printf( "%s:%s", username, password ); 44 45 tr_bencInitDict( &d, 14 ); 46 tr_bencDictAddStr( &d, "download-dir", tr_sessionGetDownloadDir( h ) ); 47 tr_bencDictAddInt( &d, "peer-limit", tr_sessionGetPeerLimit( h ) ); 48 tr_bencDictAddInt( &d, "pex-allowed", tr_sessionIsPexEnabled( h ) ); 49 tr_bencDictAddInt( &d, "port", tr_sessionGetPeerPort( h ) ); 50 tr_bencDictAddStr( &d, "auth", auth ); 51 tr_bencDictAddInt( &d, "auth-required", 52 tr_sessionIsRPCPasswordEnabled( h ) ); 53 tr_bencDictAddInt( &d, "port-forwarding-enabled", 54 tr_sessionIsPortForwardingEnabled( h ) ); 55 tr_bencDictAddStr( &d, "rpc-acl", tr_sessionGetRPCACL( h ) ); 56 tr_bencDictAddInt( &d, "rpc-port", tr_sessionGetRPCPort( h ) ); 57 tr_bencDictAddInt( &d, "speed-limit-down", 58 tr_sessionGetSpeedLimit( h, TR_DOWN ) ); 59 tr_bencDictAddInt( &d, "speed-limit-down-enabled", 60 tr_sessionIsSpeedLimitEnabled( h, TR_DOWN ) ); 61 tr_bencDictAddInt( &d, "speed-limit-up", 62 tr_sessionGetSpeedLimit( h, TR_UP ) ); 63 tr_bencDictAddInt( &d, "speed-limit-up-enabled", 64 tr_sessionIsSpeedLimitEnabled( h, TR_UP ) ); 65 switch( tr_sessionGetEncryption( h ) ) { 66 case TR_PLAINTEXT_PREFERRED: str = "tolerated"; break; 67 case TR_ENCRYPTION_REQUIRED: str = "required"; break; 68 default: str = "preferred"; break; 69 } 70 tr_bencDictAddStr( &d, "encryption", str ); 71 72 tr_ninf( MY_NAME, "saving \"%s\"", myConfigFilename ); 73 tr_bencSaveFile( myConfigFilename, &d ); 74 61 fprintf( stderr, "tr_sessionGetDownloadDir(s) returned [%s]\n", tr_sessionGetDownloadDir(s)); 62 tr_bencInitDict( &d, 16 ); 63 tr_bencDictAddInt( &d, KEY_BLOCKLIST, tr_blocklistIsEnabled( s ) ); 64 tr_bencDictAddStr( &d, KEY_DOWNLOAD_DIR, tr_sessionGetDownloadDir( s ) ); 65 tr_bencDictAddInt( &d, KEY_PEER_LIMIT, tr_sessionGetPeerLimit( s ) ); 66 tr_bencDictAddInt( &d, KEY_PEER_PORT, tr_sessionGetPeerPort( s ) ); 67 tr_bencDictAddInt( &d, KEY_PORT_FORWARDING, tr_sessionIsPortForwardingEnabled( s ) ); 68 tr_bencDictAddInt( &d, KEY_PEX_ENABLED, tr_sessionIsPexEnabled( s ) ); 69 tr_bencDictAddStr( &d, KEY_USERNAME, tr_sessionGetRPCUsername( s ) ); 70 tr_bencDictAddStr( &d, KEY_PASSWORD, tr_sessionGetRPCPassword( s ) ); 71 tr_bencDictAddStr( &d, KEY_ACL, tr_sessionGetRPCACL( s ) ); 72 tr_bencDictAddInt( &d, KEY_RPC_PORT, tr_sessionGetRPCPort( s ) ); 73 tr_bencDictAddInt( &d, KEY_AUTH_REQUIRED, tr_sessionIsRPCPasswordEnabled( s ) ); 74 tr_bencDictAddInt( &d, KEY_DSPEED, tr_sessionGetSpeedLimit( s, TR_DOWN ) ); 75 tr_bencDictAddInt( &d, KEY_DSPEED_ENABLED, tr_sessionIsSpeedLimitEnabled( s, TR_DOWN ) ); 76 tr_bencDictAddInt( &d, KEY_USPEED, tr_sessionGetSpeedLimit( s, TR_UP ) ); 77 tr_bencDictAddInt( &d, KEY_USPEED_ENABLED, tr_sessionIsSpeedLimitEnabled( s, TR_UP ) ); 78 tr_bencDictAddStr( &d, KEY_ENCRYPTION, encryption_str[tr_sessionGetEncryption( s )] ); 79 tr_bencSaveJSONFile( myConfigFilename, &d ); 80 fprintf( stderr, "saved:\n%s\n", tr_bencSaveAsJSON(&d,NULL) ); 75 81 tr_bencFree( &d ); 76 tr_free( auth ); 77 tr_free( password ); 78 tr_free( username ); 79 } 80 81 static int 82 parseAuth( const char * auth, char ** username, char ** password ) 83 { 84 int err = 0; 85 const char * pch = strchr( auth, ':' ); 86 if( !pch ) 87 err = -1; 88 else { 89 *username = tr_strndup( auth, pch-auth ); 90 *password = tr_strdup( pch+1 ); 91 } 92 return err; 93 } 94 82 tr_ninf( MY_NAME, "saved \"%s\"", myConfigFilename ); 83 } 84 85 /** 86 * @param port port number, or -1 if not set in the command line 87 * @param auth TRUE, FALSE, or -1 if not set on the command line 88 * @param blocklist TRUE, FALSE, or -1 if not set on the command line 89 */ 95 90 static void 96 session_init( const char * configDir, int rpc_port, 97 const char * acl, const char * auth, int noauth ) 98 { 91 session_init( const char * configDir, const char * downloadDir, 92 int rpcPort, const char * acl, 93 int authRequired, const char * username, const char * password, 94 int blocklistEnabled ) 95 { 96 char mycwd[MAX_PATH_LENGTH]; 99 97 tr_benc state; 100 98 int have_state; 99 int64_t i; 101 100 int64_t peer_port = TR_DEFAULT_PORT; 102 101 int64_t peers = TR_DEFAULT_GLOBAL_PEER_LIMIT; … … 108 107 int64_t down_limited = FALSE; 109 108 int encryption = TR_ENCRYPTION_PREFERRED; 110 char downloadDir[MAX_PATH_LENGTH] = { '\0' };111 const char * acl_fallback = TR_DEFAULT_RPC_ACL;112 int64_t rpc_port_fallback = TR_DEFAULT_RPC_PORT;113 int64_t auth_required_fallback = 0;114 const char * auth_fallback = NULL;115 109 tr_ctor * ctor; 116 110 tr_torrent ** torrents; 117 int auth_required; 118 char * user = NULL; 119 char * pass = NULL; 120 121 if(( have_state = !tr_bencLoadFile( myConfigFilename, &state ))) 111 112 if(( have_state = !tr_bencLoadJSONFile( myConfigFilename, &state ))) 122 113 { 123 114 const char * str; 124 115 tr_ninf( MY_NAME, "loading settings from \"%s\"", myConfigFilename ); 125 116 126 if( tr_bencDictFindStr( &state, "download-dir", &str ) ) 127 tr_strlcpy( downloadDir, str, sizeof( downloadDir ) ); 128 tr_bencDictFindInt( &state, "peer-limit", &peers ); 129 tr_bencDictFindInt( &state, "pex-allowed", &pex_enabled ); 130 tr_bencDictFindInt( &state, "port", &peer_port ); 131 tr_bencDictFindInt( &state, "port-forwarding-enabled", &fwd_enabled ); 132 tr_bencDictFindStr( &state, "rpc-acl", &acl_fallback ); 133 tr_bencDictFindStr( &state, "auth", &auth_fallback ); 134 tr_bencDictFindInt( &state, "auth-required", &auth_required_fallback ); 135 tr_bencDictFindInt( &state, "rpc-port", &rpc_port_fallback ); 136 tr_bencDictFindInt( &state, "speed-limit-down", &down_limit ); 137 tr_bencDictFindInt( &state, "speed-limit-down-enabled", &down_limited ); 138 tr_bencDictFindInt( &state, "speed-limit-up", &up_limit ); 139 tr_bencDictFindInt( &state, "speed-limit-up-enabled", &up_limited ); 140 if( tr_bencDictFindStr( &state, "encryption", &str ) ) { 117 tr_bencDictFindInt( &state, KEY_PEER_LIMIT, &peers ); 118 tr_bencDictFindInt( &state, KEY_PEX_ENABLED, &pex_enabled ); 119 tr_bencDictFindInt( &state, KEY_PEER_PORT, &peer_port ); 120 tr_bencDictFindInt( &state, KEY_PORT_FORWARDING, &fwd_enabled ); 121 tr_bencDictFindInt( &state, KEY_DSPEED, &down_limit ); 122 tr_bencDictFindInt( &state, KEY_DSPEED_ENABLED, &down_limited ); 123 tr_bencDictFindInt( &state, KEY_USPEED, &up_limit ); 124 tr_bencDictFindInt( &state, KEY_USPEED_ENABLED, &up_limited ); 125 if( tr_bencDictFindStr( &state, KEY_ENCRYPTION, &str ) ) { 141 126 if( !strcmp( str, "required" ) ) 142 127 encryption = TR_ENCRYPTION_REQUIRED; … … 146 131 } 147 132 148 /* fallbacks */ 149 if( !*downloadDir ) 150 getcwd( downloadDir, sizeof( downloadDir ) ); 151 if( rpc_port < 1 ) 152 rpc_port = rpc_port_fallback; 153 if( !acl || !*acl ) 154 acl = acl_fallback; 155 if( !auth || !*auth ) 156 auth = auth_fallback; 157 158 if( auth && parseAuth( auth, &user, &pass ) ) { 159 tr_nerr( MY_NAME, "Unable to parse authentication string \"%s\"", auth ); 160 abort( ); 161 } 162 163 if( noauth ) { 164 /* user has explicitly turned off authentication */ 165 user = NULL; 166 pass = NULL; 167 } 168 169 auth_required = user || pass; 133 /*** 134 **** Decide on which values to pass into tr_sessionInitFull(). 135 **** The command-line arguments are given precedence and 136 **** the state file from the previous session is used as a fallback. 137 **** If neither of those can be found, the TR_DEFAULT fields are used . 138 ***/ 139 140 /* authorization */ 141 if( authRequired < 0 ) { 142 if( have_state && tr_bencDictFindInt( &state, KEY_AUTH_REQUIRED, &i ) ) 143 authRequired = i; 144 if( authRequired < 0 ) 145 authRequired = FALSE; 146 } 147 148 /* username */ 149 if( !username ) 150 tr_bencDictFindStr( &state, KEY_USERNAME, &username ); 151 152 /* password */ 153 if( !password ) 154 tr_bencDictFindStr( &state, KEY_PASSWORD, &password ); 155 156 /* acl */ 157 if( !acl ) { 158 if( have_state ) 159 tr_bencDictFindStr( &state, KEY_ACL, &acl ); 160 if( !acl ) 161 acl = TR_DEFAULT_RPC_ACL; 162 } 163 164 /* rpc port */ 165 if( rpcPort < 0 ) { 166 if( have_state && tr_bencDictFindInt( &state, KEY_RPC_PORT, &i ) ) 167 rpcPort = i; 168 if( rpcPort < 0 ) 169 rpcPort = TR_DEFAULT_RPC_PORT; 170 } 171 172 173 /* blocklist */ 174 if( blocklistEnabled < 0 ) { 175 if( have_state && tr_bencDictFindInt( &state, KEY_BLOCKLIST, &i ) ) 176 blocklistEnabled = i; 177 if( blocklistEnabled < 0 ) 178 blocklistEnabled = TR_DEFAULT_BLOCKLIST_ENABLED; 179 } 180 181 /* download dir */ 182 if( !downloadDir ) { 183 if( have_state ) 184 tr_bencDictFindStr( &state, KEY_DOWNLOAD_DIR, &downloadDir ); 185 if( !downloadDir ) { 186 getcwd( mycwd, sizeof( mycwd ) ); 187 fprintf( stderr, "cwd is [%s]\n", mycwd ); 188 downloadDir = mycwd; 189 } 190 } 191 192 /*** 193 **** 194 ***/ 170 195 171 196 /* start the session */ … … 177 202 peers, 178 203 TR_MSG_INF, 0, 179 FALSE, /* is the blocklist enabled? */204 blocklistEnabled, 180 205 TR_DEFAULT_PEER_SOCKET_TOS, 181 TRUE, rpc_port, acl, 182 auth_required, user, pass, 206 TRUE, rpcPort, acl, authRequired, username, password, 183 207 TR_DEFAULT_PROXY_ENABLED, 184 208 TR_DEFAULT_PROXY, … … 188 212 189 213 190 if( auth _required )214 if( authRequired ) 191 215 tr_ninf( MY_NAME, "requiring authentication" ); 192 216 … … 206 230 puts( "usage: " MY_NAME " [-dfh] [-p file] [-s file]\n" 207 231 "\n" 208 "Transmission " LONG_VERSION_STRING" http://www.transmissionbt.com/\n"232 "Transmission "LONG_VERSION_STRING" http://www.transmissionbt.com/\n" 209 233 "A fast and easy BitTorrent client\n" 210 234 "\n" 211 " -a --acl <list> Access Control List. (Default: "TR_DEFAULT_RPC_ACL")\n" 212 " -f --foreground Run in the foreground and log to stderr\n" 213 " -g --config-dir <dir> Where to look for torrents and daemon-config.benc\n" 214 " -h --help Display this message and exit\n" 215 " -t --auth <user>:<pass> Username and password for authentication\n" 216 " -p --port n Port to listen to for requests (Default: "TR_DEFAULT_RPC_PORT_STR")\n" 235 " -a --acl <list> Access Control List. (Default: "TR_DEFAULT_RPC_ACL")\n" 236 " -b --blocklist Enable peer blocklists\n" 237 " -b0 --blocklist=0 Disable peer blocklists\n" 238 " -d --download-dir <dir> Where store downloaded data\n" 239 " -f --foreground Run in the foreground and log to stderr\n" 240 " -g --config-dir <dir> Where to look for torrents and "CONFIG_FILE"\n" 241 " -h --help Display this message and exit\n" 242 " -p --port=n Port to listen to for requests (Default: "TR_DEFAULT_RPC_PORT_STR")\n" 243 " -t --auth Require authentication\n" 244 " -t0 --auth=0 Don't require authentication\n" 245 " -u --username <user> Set username for authentication\n" 246 " -w --password <pass> Set password for authentication\n" 217 247 "\n" 218 248 MY_NAME" is a headless Transmission session\n" … … 223 253 static void 224 254 readargs( int argc, char ** argv, 225 int * nofork, int * port, 226 char ** configDir, 227 char ** acl, 228 char ** auth, 229 int * noauth ) 255 int * nofork, char ** configDir, char ** downloadDir, 256 int * rpcPort, char ** acl, int * authRequired, char ** username, char ** password, 257 int * blocklistEnabled ) 230 258 { 231 259 int opt; 232 char optstr[] = "a:fg:hnp:t:u:w:";260 char shortopts[] = "a:b::d:fg:hp:t::u:w:"; 233 261 struct option longopts[] = { 234 { "acl", required_argument, NULL, 'a' }, 235 { "foreground", no_argument, NULL, 'f' }, 236 { "config-dir", required_argument, NULL, 'g' }, 237 { "help", no_argument, NULL, 'h' }, 238 { "noauth", no_argument, NULL, 'n' }, 239 { "port", required_argument, NULL, 'p' }, 240 { "auth", required_argument, NULL, 't' }, 241 { NULL, 0, NULL, '\0' } 262 { "acl", required_argument, NULL, 'a' }, 263 { "blocklist", optional_argument, NULL, 'b' }, 264 { "download-dir", required_argument, NULL, 'd' }, 265 { "foreground", no_argument, NULL, 'f' }, 266 { "config-dir", required_argument, NULL, 'g' }, 267 { "help", no_argument, NULL, 'h' }, 268 { "port", required_argument, NULL, 'p' }, 269 { "auth", optional_argument, NULL, 't' }, 270 { "username", required_argument, NULL, 'u' }, 271 { "password", required_argument, NULL, 'w' }, 272 { NULL, 0, NULL, '\0' } 242 273 }; 243 while((( opt = getopt_long( argc, argv, optstr, longopts, NULL ))) != -1 ) {274 while((( opt = getopt_long( argc, argv, shortopts, longopts, NULL ))) != -1 ) { 244 275 switch( opt ) { 245 276 case 'a': *acl = tr_strdup( optarg ); break; 277 case 'b': *blocklistEnabled = optarg ? atoi(optarg)!=0 : TRUE; break; 278 case 'd': *downloadDir = tr_strdup( optarg ); break; 246 279 case 'f': *nofork = 1; break; 247 case 'n': * noauth = 1; break;280 case 'n': *authRequired = FALSE; break; 248 281 case 'g': *configDir = tr_strdup( optarg ); break; 249 case 't': *auth = tr_strdup( optarg ); break; 250 case 'p': *port = atoi( optarg ); break; 282 case 't': *authRequired = optarg ? atoi(optarg)!=0 : TRUE; break; 283 case 'u': *username = tr_strdup( optarg ); break; 284 case 'w': *password = tr_strdup( optarg ); break; 285 case 'p': *rpcPort = atoi( optarg ); break; 251 286 default: daemonUsage( ); break; 252 287 } … … 318 353 { 319 354 int nofork = 0; 320 int noauth = 0; 321 int port = TR_DEFAULT_RPC_PORT; 355 int rpcPort = -1; 356 int authRequired = -1; 357 int blocklistEnabled = -1; 322 358 char * configDir = NULL; 359 char * downloadDir = NULL; 323 360 char * acl = NULL; 324 char * auth = NULL; 361 char * username = NULL; 362 char * password = NULL; 325 363 326 364 signal( SIGINT, gotsig ); … … 330 368 signal( SIGHUP, SIG_IGN ); 331 369 332 readargs( argc, argv, &nofork, &port, &configDir, &acl, &auth, &noauth ); 370 readargs( argc, argv, &nofork, &configDir, &downloadDir, 371 &rpcPort, &acl, &authRequired, &username, &password, 372 &blocklistEnabled ); 333 373 if( configDir == NULL ) 334 374 configDir = tr_strdup_printf( "%s-daemon", tr_getDefaultConfigDir() ); 335 375 tr_buildPath( myConfigFilename, sizeof( myConfigFilename ), 336 configDir, "daemon-config.benc", NULL );376 configDir, CONFIG_FILE, NULL ); 337 377 338 378 if( !nofork ) { … … 343 383 } 344 384 345 session_init( configDir, port, acl, auth, noauth ); 385 session_init( configDir, downloadDir, 386 rpcPort, acl, authRequired, username, password, 387 blocklistEnabled ); 346 388 347 389 while( !closing ) … … 354 396 355 397 tr_free( configDir ); 398 tr_free( downloadDir ); 399 tr_free( username ); 400 tr_free( password ); 401 tr_free( acl ); 356 402 return 0; 357 403 } -
trunk/daemon/transmission-daemon.1
r6096 r6146 10 10 .Fl h 11 11 .Nm 12 .Op Fl a Ar (+|-)x.x.x.x[/x],... 13 .Op Fl b 14 .Op Fl b0 15 .Op Fl d 12 16 .Op Fl f 13 .Op Fl a Ar (+|-)x.x.x.x[/x],...14 17 .Op Fl g Ar directory 18 .Op Fl h 15 19 .Op Fl p Ar port 16 .Op Fl t Ar user:pass 20 .Op Fl t 21 .Op Fl t0 22 .Op Fl u Ar username 23 .Op Fl w Ar password 17 24 .Ek 18 25 … … 27 34 The options are as follows: 28 35 .Bl -tag -width Ds 36 29 37 .It Fl a Fl -acl Ar (+|-)x.x.x.x[/x],... 30 38 Specify access control list (ACL) to control which hosts may submit RPC requests. … … 35 43 Masks may vary from 0 to 32 inclusive. 36 44 Default: +127.0.0.1 45 46 .It Fl b Fl -blocklist 47 Enable peer blocklists. Transmission understands the bluetack blocklist file format. 48 New blocklists can be added by copying them into the config-dir's "blocklists" subdirectory. 49 50 .It Fl b0 Fl -blocklist=0 51 Disble blocklists. 52 53 .It Fl d Fl -download-dir 54 Where to store downloaded data. 55 37 56 .It Fl f Fl -foreground 38 Run in the foreground and print errors to stderr instead of forking39 and logging errors with syslog. 57 Run in the foreground and print errors to stderr. 58 40 59 .It Fl g Fl -config-dir Ar directory 41 60 Where to look for .torrent and config files on startup. 42 .It Fl t Fl -auth Ar user:pass 43 Requre 44 .Ar username 45 and 46 .Ar password 47 authentication 61 48 62 .It Fl h Fl -help 49 63 Print command-line option descriptions. 64 50 65 .It Fl p Fl -port Ar port 51 66 Port to open and listen for RPC requests on. Default: 9091 67 68 .It Fl t Fl -auth 69 Require clients to authenticate themselves. 70 This doesn't do much good unless 71 .Ar username and 72 .Ar password are also set. 73 74 .It Fl t0 Fl -auth=0 75 Don't require authentication from clients. 76 77 .It Fl u Fl -username ar username 78 Used for client authentication. 79 80 .It Fl w Fl -password ar password 81 Used for client authentication. 82 52 83 .El 53 84 -
trunk/libtransmission/bencode.c
r6073 r6146 34 34 #include "transmission.h" 35 35 #include "bencode.h" 36 #include "json.h" 36 37 #include "list.h" 37 38 #include "ptrarray.h" … … 1222 1223 ***/ 1223 1224 1224 int1225 tr_bencSaveFile( const char * filename, const tr_benc * b)1225 static int 1226 saveFile( const char * filename, const char * content, size_t len ) 1226 1227 { 1227 1228 int err = TR_OK; 1228 int len;1229 char * content = tr_bencSave( b, &len );1230 1229 FILE * out = NULL; 1231 1230 … … 1246 1245 if( !err ) 1247 1246 tr_dbg( "tr_bencSaveFile saved \"%s\"", filename ); 1248 tr_free( content );1249 1247 if( out ) 1250 1248 fclose( out ); 1249 return err; 1250 } 1251 1252 int 1253 tr_bencSaveFile( const char * filename, const tr_benc * b ) 1254 { 1255 int len; 1256 char * content = tr_bencSave( b, &len ); 1257 const int err = saveFile( filename, content, len ); 1258 tr_free( content ); 1251 1259 return err; 1252 1260 } … … 1263 1271 return ret; 1264 1272 } 1273 1274 int 1275 tr_bencSaveJSONFile( const char * filename, const tr_benc * b ) 1276 { 1277 int len; 1278 char * content = tr_bencSaveAsJSON( b, &len ); 1279 const int err = saveFile( filename, content, len ); 1280 tr_free( content ); 1281 return err; 1282 } 1283 1284 int 1285 tr_bencLoadJSONFile( const char * filename, tr_benc * b ) 1286 { 1287 int ret; 1288 size_t contentLen; 1289 uint8_t * content = tr_loadFile( filename, &contentLen ); 1290 ret = content ? tr_jsonParse( content, contentLen, b, NULL ) 1291 : TR_ERROR_IO_OTHER; 1292 tr_free( content ); 1293 return ret; 1294 } -
trunk/libtransmission/bencode.h
r5987 r6146 113 113 int tr_bencDictRemove( tr_benc * dict, const char * key ); 114 114 115 char* tr_bencSave( const tr_benc * val, int * len ); 116 char* tr_bencSaveAsJSON( const tr_benc * top, int * len ); 117 int tr_bencSaveFile( const char * filename, const tr_benc * ); 118 int tr_bencLoadFile( const char * filename, tr_benc * ); 115 char* tr_bencSave ( const tr_benc * val, int * len ); 116 char* tr_bencSaveAsJSON ( const tr_benc * top, int * len ); 117 int tr_bencSaveFile ( const char * filename, const tr_benc * ); 118 int tr_bencSaveJSONFile ( const char * filename, const tr_benc * ); 119 int tr_bencLoadFile ( const char * filename, tr_benc * ); 120 int tr_bencLoadJSONFile ( const char * filename, tr_benc * ); 119 121 120 122 int tr_bencGetInt( const tr_benc * val, int64_t * setme ); -
trunk/libtransmission/session.c
r6140 r6146 186 186 tr_handle * 187 187 tr_sessionInitFull( const char * configDir, 188 const char * tag, 188 189 const char * downloadDir, 189 const char * tag,190 190 int isPexEnabled, 191 191 int isPortForwardingEnabled, -
trunk/libtransmission/transmission.h
r6140 r6146 225 225 */ 226 226 tr_handle * tr_sessionInitFull( const char * configDir, 227 const char * tag, 227 228 const char * downloadDir, 228 const char * tag,229 229 int isPexEnabled, 230 230 int isPortForwardingEnabled,
Note: See TracChangeset
for help on using the changeset viewer.