Changeset 5813
- Timestamp:
- May 12, 2008, 12:41:55 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/ipc-json-spec.txt
r5807 r5813 13 13 2. Message Format 14 14 15 The entire protocol isformatted in a subset of JSON that understands15 Messages are formatted in a subset of JSON that understands 16 16 arrays, maps, strings, and whole numbers with no exponentials -- 17 17 in short, the subset of JSON easily represented in benc. … … 21 21 There are only two message types: request and response. Both 22 22 are JSON objects with two members: "headers" (described in 2.1) 23 and "body" (described in 2.2 -2.3).23 and "body" (described in 2.2 - 2.3). 24 24 25 25 2.1. Headers … … 46 46 3. Torrent Requests 47 47 48 3.1. Common Arguments 49 50 Most torrent requests support an "ids" argument, which is a list 51 containing unique torrent ids, or torrent sha1 hash strings, or both. 52 These are the torrents that the request will be applied to. 53 If "ids" is omitted, the request is applied to all torrents. 54 55 3.2. Torrent Action Requests 48 3.1. Torrent Action Requests 56 49 57 50 Request names: "torrent-start", "torrent-stop", 58 51 "torrent-remove", "torrent-verify" 59 Request arguments: 3.1's optional "ids" argument. 52 Request arguments: "ids", a list of unique torrent ids, sha1 hash strings, 53 or both. These are the torrents that the request will 54 be applied to. If "ids" is ommitted, the request is 55 applied to all torrents. 60 56 Response arguments: none. 61 57 62 3. 3. Torrent Info Requests58 3.2. Torrent Info Requests 63 59 64 60 Request name: "torrent-info". … … 119 115 } 120 116 121 3. 4. Torrent Status Requests117 3.3. Torrent Status Requests 122 118 123 119 Request name is "torrent-status". … … 131 127 (3) a new string, "scrape-url", is added 132 128 133 3. 5. Adding a Torrent129 3.4. Adding a Torrent 134 130 135 131 Request name: "torrent-add" … … 147 143 The "filename" argument is required; all others are optional. 148 144 149 Response arguments: 3.1's "error" if the request failed.150 151 3. 6. Other torrent settings145 Response arguments: none. 146 147 3.5. Other torrent settings 152 148 153 149 Common arguments: … … 155 151 string | value type & description 156 152 -------------------+------------------------------------------------- 157 "id" | int or string torrent id or hash string158 153 "max-peers" | int maximum number of peers 159 154 "speed-limit-down" | int maximum download speed (in KiB/s) 160 155 "speed-limit-up" | int maximum upload speed (in KiB/s) 161 156 162 3. 6.1. Mutators157 3.5.1. Mutators 163 158 164 159 Request name: "torrent-set" 165 Request arguments: "id" from 3.6, plus one or more of 3.6's otherarguments160 Request arguments: 3.1's "ids", plus one or more of 3.5's arguments 166 161 Response arguments: none 167 162 168 3. 6.2. Accessors163 3.5.2. Accessors 169 164 170 165 Request name: "torrent-get" 171 166 Request arguments: none 172 Response arguments: all of 3.6's arguments 173 174 3.7 File Priorities 167 Response arguments: "torrents", a list of torrent objects containing 168 all of 3.5's arguments plus the id passed in 169 by "torrent-set". 170 171 172 3.6 File Priorities 175 173 176 174 Common arguments: … … 178 176 string | value type & description 179 177 -------------------+------------------------------------------------- 180 "id" | int or string torrent id or hash string181 178 "priority-high" | array indices of one or more high-priority files 182 179 "priority-low" | array indices of one or more low-priority files … … 185 182 "no-download" | array indices of one or more file to not download 186 183 187 3. 7.1. Mutators184 3.6.1. Mutators 188 185 189 186 Request name: "torrent-set-file" 190 Request arguments: "id" from 3.7, plus one or more of 3.7's otherarguments187 Request arguments: 3.1's "ids", plus one or more of 3.6's arguments 191 188 Response arguments: none 192 189 193 3. 7.2. Accessors190 3.6.2. Accessors 194 191 195 192 Request name: "torrent-get-file" 196 193 Request arguments: none 197 Response arguments: all of 3.7's arguments 194 Response arguments: list of objects, one per torrent, containing 195 all of 3.6's arguments plus the id passed in 196 by "torrent-set". 198 197 199 198 4. Session Status Requests -
trunk/libtransmission/Makefile.am
r5812 r5813 17 17 handshake.c \ 18 18 inout.c \ 19 ipc.c \ 19 20 ipcparse.c \ 20 21 json.c \ … … 57 58 handshake.h \ 58 59 inout.h \ 60 ipc.h \ 59 61 ipcparse.h \ 60 62 list.h \ -
trunk/libtransmission/torrent.c
r5796 r5813 54 54 ***/ 55 55 56 tr_torrent* 57 tr_torrentFindFromId( tr_handle * handle, int id ) 58 { 59 tr_torrent * tor = NULL; 60 61 while(( tor = tr_torrentNext( handle, tor ))) 62 if( tor->uniqueId == id ) 63 return tor; 64 65 return NULL; 66 } 67 68 tr_torrent* 69 tr_torrentFindFromHashString( tr_handle * handle, const char * str ) 70 { 71 tr_torrent * tor = NULL; 72 73 while(( tor = tr_torrentNext( handle, tor ))) 74 if( !strcmp( str, tor->info.hashString ) ) 75 return tor; 76 77 return NULL; 78 } 79 56 80 int 57 81 tr_torrentExists( const tr_handle * handle, … … 369 393 uint64_t t; 370 394 tr_info * info = &tor->info; 395 static int nextUniqueId = 1; 371 396 372 397 tr_globalLock( h ); 373 398 374 399 tor->handle = h; 400 tor->uniqueId = nextUniqueId++; 375 401 376 402 randomizeTiers( info ); -
trunk/libtransmission/torrent.h
r5796 r5813 50 50 51 51 int tr_torrentExists( const tr_handle *, const uint8_t * ); 52 tr_torrent* tr_torrentFindFromId( tr_handle *, int id ); 52 53 tr_torrent* tr_torrentFindFromHash( tr_handle *, const uint8_t * ); 54 tr_torrent* tr_torrentFindFromHashString( tr_handle *, const char * ); 53 55 tr_torrent* tr_torrentFindFromObfuscatedHash( tr_handle *, const uint8_t* ); 54 56 … … 179 181 180 182 tr_torrent * next; 183 184 int uniqueId; 181 185 }; 182 186
Note: See TracChangeset
for help on using the changeset viewer.