BEP:4
Title:Assigned Numbers
Version: 48dfdcb0b1c4c6bbc8eea0b76a81ade0ef5a5f9a
Last-Modified:Sun Mar 26 01:08:47 2017 +0100
Author: David Harrison <dave@bittorrent.com>
Status: Active
Type:Process
Created:10-Jan-2008
Post-History:

This document describes the known bit allocations and message IDs for the BitTorrent protocol. To request a bit allocation contact editor@bittorrent.org. Contact the same address if you are aware of any omissions.

Reserved Bit Allocations

reserved[0]
0x80  Azureus Messaging Protocol

reserved[2]
0x08  BitTorrent Location-aware Protocol (no known implementations)

reserved[5]
0x10  LTEP (Libtorrent Extension Protocol)
0x02  Extension Negotiation Protocol
0x01  Extension Negotiation Protocol

reserved[7]
0x01  BitTorrent DHT
0x02  XBT Peer Exchange
0x04  suggest, haveall, havenone, reject request, and allow fast extensions
0x08  NAT Traversal
0x10  hybrid torrent legacy to v2 upgrade

There are known collisions:

reserved[0]
0xFF  BitComet Extension Protocol

reserved[1]
0xFF  BitComet Extension Protocol

reserved[7]
0x01  XBT Metadata Exchange (implemented only in XBT)

It is recommended that further extensions use the Extension Protocol [1], a.k.a., LibTorrent Extension Protocol (LTEP). With LTEP, extension bit collisions become impossible since no new extension bits are allocated. With LTEP, message ID collisions also become impossible because message IDs are allocated on demand at the beginning of the connection. Extension name collisions become possible, but the probability is much less likely.

Reserved Message IDs

Core Protocol:
0x00   choke
0x01   unchoke
0x02   interested
0x03   not interested
0x04   have
0x05   bitfield
0x06   request
0x07   piece
0x08   cancel

DHT Extension:
0x09   port

Fast Extensions:
0x0D   suggest
0x0E   have all
0x0F   have none
0x10   reject request
0x11   allowed fast

Additional IDs used in deployed clients:
0x14   LTEP Handshake (implemented in libtorrent, uTorrent,...)

Hash Transfer Protocol:
0x15   hash request
0x16   hashes
0x17   hash reject

References

[1]BEP_0010. Extension Protocol. Norberg, Strigeus, Hazel. http://www.bittorrent.org/beps/bep_0010.html