~ubuntu-branches/ubuntu/maverick/libtorrent-rasterbar/maverick

« back to all changes in this revision

Viewing changes to docs/extension_protocol.html

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Sauthier
  • Date: 2010-08-10 12:59:37 UTC
  • mfrom: (1.3.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810125937-jbcmmf17y8yo9hgz
Tags: 0.15.0-0ubuntu1
* New upstream version.
* debian/patches/100_fix_html_docs.patch: refreshed.
* debian/control: bump up standards-version to 3.9.1 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
4
<head>
5
5
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
 
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
 
6
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
7
7
<title></title>
8
8
<meta name="author" content="Arvid Norberg, arvid&#64;rasterbar.com Ludvig Strigeus, ludde&#64;utorrent.com" />
9
 
<link rel="stylesheet" type="text/css" href="css/base.css" />
10
 
<link rel="stylesheet" type="text/css" href="css/rst.css" />
 
9
<link rel="stylesheet" type="text/css" href="../../css/base.css" />
 
10
<link rel="stylesheet" type="text/css" href="../../css/rst.css" />
11
11
<link rel="stylesheet" href="style.css" type="text/css" />
12
12
<style type="text/css">
13
13
/* Hides from IE-mac \*/
20
20
    <div id="container">
21
21
    <div id="headerNav">
22
22
    <ul>
23
 
    <li class="first"><a href="index.html">Home</a></li>
24
 
    <li><a href="http://www.rasterbar.com/products.html">Products</a></li>
25
 
    <li><a href="http://www.rasterbar.com/contact.html">Contact</a></li>
 
23
    <li class="first"><a href="/">Home</a></li>
 
24
    <li><a href="../../products.html">Products</a></li>
 
25
    <li><a href="../../contact.html">Contact</a></li>
26
26
    </ul>
27
27
    </div>
 
28
    <div id="header">
 
29
    <h1><span>Rasterbar Software</span></h1>
 
30
    <h2><span>Software developement and consulting</span></h2>
 
31
    </div>
28
32
    <div id="main">
29
33
 
30
34
<table class="docinfo" frame="void" rules="none">
61
65
</tr>
62
66
</thead>
63
67
<tbody valign="top">
64
 
<tr><td><tt class="docutils literal">extended</tt></td>
 
68
<tr><td><tt class="docutils literal"><span class="pre">extended</span></tt></td>
65
69
<td>20</td>
66
70
</tr>
67
71
</tbody>
71
75
in this case). At the start of the payload of the message, is a single byte
72
76
message identifier. This identifier can refer to different extension messages
73
77
and only one ID is specified, 0. If the ID is 0, the message is a handshake
74
 
message which is described below. The layout of a general <tt class="docutils literal">extended</tt> message
 
78
message which is described below. The layout of a general <tt class="docutils literal"><span class="pre">extended</span></tt> message
75
79
follows (including the message headers used by the bittorrent protocol):</p>
76
80
<table border="1" class="docutils">
77
81
<colgroup>
191
195
</tr>
192
196
</thead>
193
197
<tbody valign="top">
194
 
<tr><td><tt class="docutils literal">m</tt></td>
 
198
<tr><td><tt class="docutils literal"><span class="pre">m</span></tt></td>
195
199
<td><table border="1" class="first last docutils">
196
200
<colgroup>
197
201
<col width="88%" />
202
206
</tr>
203
207
</thead>
204
208
<tbody valign="top">
205
 
<tr><td><tt class="docutils literal">LT_metadata</tt></td>
 
209
<tr><td><tt class="docutils literal"><span class="pre">LT_metadata</span></tt></td>
206
210
<td>1</td>
207
211
</tr>
208
 
<tr><td><tt class="docutils literal">ut_pex</tt></td>
 
212
<tr><td><tt class="docutils literal"><span class="pre">ut_pex</span></tt></td>
209
213
<td>2</td>
210
214
</tr>
211
215
</tbody>
212
216
</table>
213
217
</td>
214
218
</tr>
215
 
<tr><td><tt class="docutils literal">p</tt></td>
 
219
<tr><td><tt class="docutils literal"><span class="pre">p</span></tt></td>
216
220
<td>6881</td>
217
221
</tr>
218
 
<tr><td><tt class="docutils literal">v</tt></td>
 
222
<tr><td><tt class="docutils literal"><span class="pre">v</span></tt></td>
219
223
<td>&quot;µTorrent 1.2&quot;</td>
220
224
</tr>
221
225
</tbody>
222
226
</table>
223
227
<p>and in the encoded form:</p>
224
 
<p><tt class="docutils literal"><span class="pre">d1:md11:LT_metadatai1e6:µT_PEXi2ee1:pi6881e1:v13:\xc2\xb5Torrent</span> 1.2e</tt></p>
 
228
<p><tt class="docutils literal"><span class="pre">d1:md11:LT_metadatai1e6:µT_PEXi2ee1:pi6881e1:v13:\xc2\xb5Torrent</span> <span class="pre">1.2e</span></tt></p>
225
229
<p>To make sure the extension names do not collide by mistake, they should be
226
230
prefixed with the two (or one) character code that is used to identify the
227
231
client that introduced the extension. This applies for both the names of
235
239
to ignore the subsequent handshake messages (or parts of them).</p>
236
240
<p>Subsequent handshake messages can be used to enable/disable extensions
237
241
without restarting the connection. If a peer supports changing extensions
238
 
at run time, it should note that the <tt class="docutils literal">m</tt> dictionary is additive.
 
242
at run time, it should note that the <tt class="docutils literal"><span class="pre">m</span></tt> dictionary is additive.
239
243
It's enough that it contains the actual <em>CHANGES</em> to the extension list.
240
 
To disable the support for <tt class="docutils literal">LT_metadata</tt> at run-time, without affecting
 
244
To disable the support for <tt class="docutils literal"><span class="pre">LT_metadata</span></tt> at run-time, without affecting
241
245
any other extensions, this message should be sent:
242
 
<tt class="docutils literal">d11:LT_metadatai0ee</tt>.
 
246
<tt class="docutils literal"><span class="pre">d11:LT_metadatai0ee</span></tt>.
243
247
As specified above, the value 0 is used to turn off an extension.</p>
244
248
<p>The extension IDs must be stored for every peer, becuase every peer may have
245
249
different IDs for the same extension.</p>
246
250
<p>This specification, deliberately, does not specify any extensions such as
247
251
peer-exchange or metadata exchange. This protocol is merely a transport
248
252
for the actual extensions to the bittorrent protocol and the extensions
249
 
named in the example above (such as <tt class="docutils literal">p</tt>) are just examples of possible
 
253
named in the example above (such as <tt class="docutils literal"><span class="pre">p</span></tt>) are just examples of possible
250
254
extensions.</p>
251
255
</div>
252
256
<div class="section" id="rationale">
256
260
extension messages requires unique names, which is much easier to do without
257
261
a global registry. The convention is to use a two letter prefix on the
258
262
extension message names, the prefix would identify the client first
259
 
implementing the extension message. e.g. <tt class="docutils literal">LT_metadata</tt> is implemented by
260
 
libtorrent, and hence it has the <tt class="docutils literal">LT</tt> prefix.</p>
 
263
implementing the extension message. e.g. <tt class="docutils literal"><span class="pre">LT_metadata</span></tt> is implemented by
 
264
libtorrent, and hence it has the <tt class="docutils literal"><span class="pre">LT</span></tt> prefix.</p>
261
265
<p>If the client supporting the extensions can decide which numbers the messages
262
266
it receives will have, it means they are constants within that client. i.e.
263
 
they can be used in <tt class="docutils literal">switch</tt> statements. It's easy for the other end to
 
267
they can be used in <tt class="docutils literal"><span class="pre">switch</span></tt> statements. It's easy for the other end to
264
268
store an array with the ID's we expect for each message and use that for
265
269
lookups each time it sends an extension message.</p>
266
270
<p>The reason for having a dictionary instead of having an array (using
267
271
implicitly assigned index numbers to the extensions) is that if a client
268
272
want to disable some extensions, the ID numbers would change, and it wouldn't
269
 
be able to use constants (and hence, not use them in a <tt class="docutils literal">switch</tt>). If the
 
273
be able to use constants (and hence, not use them in a <tt class="docutils literal"><span class="pre">switch</span></tt>). If the
270
274
messages IDs would map directly to bittorrent message IDs, It would also make
271
275
it possible to map extensions in the handshake to existing extensions with
272
276
fixed message IDs.</p>
286
290
    <span>Copyright &copy; 2005 Rasterbar Software.</span>
287
291
    </div>
288
292
    </div>
 
293
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
 
294
    </script>
 
295
    <script type="text/javascript">
 
296
    _uacct = "UA-1599045-1";
 
297
    urchinTracker();
 
298
    </script>
289
299
</div>
290
300
</body>
291
301
</html>