Show
Ignore:
Timestamp:
02/04/2008 04:10:30 PM (10 months ago)
Author:
dave
Message:

Change revision number to automatically updated $Revision$ in all .rst files.
Change last-modified date to automatically updated $Date$ in all .rst files.
Add "Local Variables" to the end of all .rst files.
Fix BEP numbers.
Make header formatting in all .rst files conform to PEP-style rst formatting requirements.

Remove some HTML markup from the bep_0003.rst, the BitTorrent? protocol standard.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dotorg/trunk_fixed/html/beps/bep_0003.rst

    r10524 r10528  
    1 BEP: 2 
     1BEP: 3 
    22Title: The BitTorrent Protocol Specification 
    3 Version: 2 
    4 Last-Modified: 11-Jan-2008 
     3Version: $Revision$ 
     4Last-Modified: $Date$ 
    55Author:  Bram Cohen <bram@bittorrent.com> 
    66Status:  Final 
     
    5252------------------------------- 
    5353 
    54 - Strings are length-prefixed base ten followed by a colon and the string. For example <code>4:spam</code> corresponds to 'spam'. 
     54- Strings are length-prefixed base ten followed by a colon and the string. For example ``4:spam`` corresponds to 'spam'. 
    5555 
    5656- Integers are represented by an 'i' followed by the number in base 10 
    57   followed by an 'e'. For example <code>i3e</code> corresponds to 3 and 
    58   <code>i-3e </code>corresponds to -3. Integers have no size 
    59   limitation. <code>i-0e</code> is invalid. All encodings with a leading 
    60   zero, such as <code>i03e</code>, are invalid, other than 
    61   <code>i0e</code>, which of course corresponds to 0. 
     57  followed by an 'e'. For example ``i3e`` corresponds to 3 and 
     58  ``i-3e`` corresponds to -3. Integers have no size 
     59  limitation. ``i-0e`` is invalid. All encodings with a leading 
     60  zero, such as ``i03e``, are invalid, other than 
     61  ``i0e``, which of course corresponds to 0. 
    6262 
    6363- Lists are encoded as an 'l' followed by their elements (also 
    64   bencoded) followed by an 'e'. For example <code>l4:spam4:eggse</code> 
     64  bencoded) followed by an 'e'. For example ``l4:spam4:eggse`` 
    6565  corresponds to ['spam', 'eggs']. 
    6666 
    6767- Dictionaries are encoded as a 'd' followed by a list of alternating 
    6868  keys and their corresponding values followed by an 'e'. For example, 
    69   <code>d3:cow3:moo4:spam4:eggse</code> corresponds to {'cow': 'moo', 
    70   'spam': 'eggs'} and <code>d4:spaml1:a1:bee</code> corresponds to 
     69  ``d3:cow3:moo4:spam4:eggse`` corresponds to {'cow': 'moo', 
     70  'spam': 'eggs'} and ``d4:spaml1:a1:bee`` corresponds to 
    7171  {'spam': ['a', 'b']}. Keys must be strings and appear in sorted order 
    7272  (sorted as raw strings, not alphanumerics). 
     
    8282  This maps to a dictionary, with keys described below. 
    8383 
    84   The <code>name</code> key maps to a string which is the suggested name  
     84  The ``name`` key maps to a string which is the suggested name  
    8585  to save the file (or directory) as. It is purely advisory. 
    8686 
    87   <code>piece length</code> maps to the number of bytes in each piece 
     87  ``piece length`` maps to the number of bytes in each piece 
    8888  the file is split into. For the purposes of transfer, files are 
    8989  split into fixed-size pieces which are all the same length except for 
    90   possibly the last one which may be truncated. <code>piece 
    91   length</code> is almost always a power of two, most commonly 2 18 = 
     90  possibly the last one which may be truncated. ``piece 
     91  length`` is almost always a power of two, most commonly 2 18 = 
    9292  256 K (BitTorrent prior to version 3.2 uses 2 20 = 1 M as 
    9393  default). 
    9494 
    95   <code>pieces</code> maps to a string whose length is a multiple of 
     95  ``pieces`` maps to a string whose length is a multiple of 
    9696  20. It is to be subdivided into strings of length 20, each of which is 
    9797  the SHA1 hash of the piece at the corresponding index. 
    9898 
    99   There is also a key <code>length</code> or a key <code>files</code>, 
    100   but not both or neither. If <code>length</code> is present then the 
     99  There is also a key ``length`` or a key ``files``, 
     100  but not both or neither. If ``length`` is present then the 
    101101  download represents a single file, otherwise it represents a set of 
    102102  files which go in a directory structure. 
    103103 
    104   In the single file case, <code>length</code> maps to the length of 
     104  In the single file case, ``length`` maps to the length of 
    105105  the file in bytes. 
    106106 
     
    108108  only having a single file by concatenating the files in the order they 
    109109  appear in the files list. The files list is the value 
    110   <code>files</code> maps to, and is a list of dictionaries containing 
     110  ``files`` maps to, and is a list of dictionaries containing 
    111111  the following keys: 
    112112   
    113   <code>length</code> - The length of the file, in bytes. 
    114  
    115   <code>path</code> - A list of strings corresponding to subdirectory 
     113  ``length`` - The length of the file, in bytes. 
     114 
     115  ``path`` - A list of strings corresponding to subdirectory 
    116116  names, the last of which is the actual file name (a zero length list 
    117117  is an error case). 
     
    157157 
    158158event 
    159   This is an optional key which maps to <code>started</code>, 
    160   <code>completed</code>, or <code>stopped</code> (or 
    161   <code>empty</code>, which is the same as not being present). If not 
     159  This is an optional key which maps to ``started``, 
     160  ``completed``, or ``stopped`` (or 
     161  ``empty``, which is the same as not being present). If not 
    162162  present, this is one of the announcements done at regular 
    163   intervals. An announcement using <code>started</code> is sent when a 
    164   download first begins, and one using <code>completed</code> is sent 
    165   when the download is complete. No <code>completed</code> is sent if 
     163  intervals. An announcement using ``started`` is sent when a 
     164  download first begins, and one using ``completed`` is sent 
     165  when the download is complete. No ``completed`` is sent if 
    166166  the file was complete when started. Downloaders send an announcement 
    167   using <code>stopped</code> when they cease downloading. 
     167  using ``stopped`` when they cease downloading. 
    168168 
    169169Tracker responses are bencoded dictionaries. If a tracker response 
    170 has a key <code>failure reason</code>, then that maps to a human 
     170has a key ``failure reason``, then that maps to a human 
    171171readable string which explains why the query failed, and no other keys 
    172 are required. Otherwise, it must have two keys: <code>interval</code>, 
     172are required. Otherwise, it must have two keys: ``interval``, 
    173173which maps to the number of seconds the downloader should wait between 
    174 regular rerequests, and <code>peers</code>. <code>peers</code> maps to 
    175 a list of dictionaries corresponding to <code>peers</code>, each of 
    176 which contains the keys <code>peer id</code>, <code>ip</code>, and 
    177 <code>port</code>, which map to the peer's self-selected ID, IP 
     174regular rerequests, and ``peers``. ``peers`` maps to 
     175a list of dictionaries corresponding to ``peers``, each of 
     176which contains the keys ``peer id``, ``ip``, and 
     177``port``, which map to the peer's self-selected ID, IP 
    178178address or dns name as a string, and port number, respectively. Note 
    179179that downloaders may rerequest on nonscheduled times if an event 
     
    234234Next comes the 20 byte sha1 hash of the bencoded form of the info 
    235235value from the metainfo file. (This is the same value which is 
    236 announced as <code>info_hash</code> to the tracker, only here it's raw 
     236announced as ``info_hash`` to the tracker, only here it's raw 
    237237instead of quoted here). If both sides don't send the same value, they 
    238238sever the connection. The one possible exception is if a downloader 
     
    341341are three times as likely to start as the current optimistic unchoke 
    342342as anywhere else in the rotation. 
    343  
     343  
     344.. 
     345   Local Variables: 
     346   mode: indented-text 
     347   indent-tabs-mode: nil 
     348   sentence-end-double-space: t 
     349   fill-column: 70 
     350   coding: utf-8 
     351   End: 
     352