Tag datastructure definitions in docs/spec/* for highlighting

Currently the language used for highlighting is auto-detected and not ideal.
A datastructure-definition lexer should be created to optimize highlighting.

Some specifications have links to other parts of the documentation; currently
these would get escaped and highlighted (and so these specifications have not
been tagged). The HighlightExtension needs extending so that sections of text
to not highlight (or escape) can be marked. Alternatively, the HTML formatter
supports adding links using a ctags file, but this would require formalizing
the datastructure-definition format enough to be able to identify names
properly.
This commit is contained in:
str4d
2013-06-10 07:23:39 +00:00
parent aaa5d03bd1
commit 6a1d9daa57
9 changed files with 157 additions and 253 deletions

View File

@ -50,7 +50,7 @@ The BlockfileNamingService provides synchronization.
<p>{% trans -%}
Superblock format:
{%- endtrans %}</p>
<pre>
{% highlight %}
Byte Contents
0-5 Magic number 0x3141de493250 ("1A" 0xde "I2P")
6 Major version 0x01
@ -60,12 +60,12 @@ Byte Contents
20-21 Mounted flag 0x01 = yes
22-23 Span size max number of key/value pairs per span (16 for hostsdb)
24-1023 unused
</pre>
{% endhighlight %}
<p>{% trans -%}
Skip list block page format:
{%- endtrans %}</p>
<pre>
{% highlight %}
Byte Contents
0-7 Magic number 0x536b69704c697374 "SkipList"
8-11 First span page
@ -74,14 +74,14 @@ Byte Contents
20-23 Spans (total number of spans - may only be valid at startup)
24-27 Levels (total number of levels - may only be valid at startup)
28-1023 unused
</pre>
{% endhighlight %}
<p>{% trans -%}
Skip level block page format is as follows.
All levels have a span. Not all spans have levels.
{%- endtrans %}</p>
<pre>
{% highlight %}
Byte Contents
0-7 Magic number 0x42534c6576656c73 "BSLevels"
8-9 Max height
@ -89,7 +89,7 @@ Byte Contents
12-15 Span page
16- Next level pages ('current height' entries, 4 bytes each, lowest first)
remaining bytes unused
</pre>
{% endhighlight %}
<p>{% trans -%}
@ -98,7 +98,7 @@ Key/value structures are sorted by key within each span and across all spans.
Key/value structures are sorted by key within each span.
Spans other than the first span may not be empty.
{%- endtrans %}</p>
<pre>
{% highlight %}
Byte Contents
0-3 Magic number 0x5370616e "Span"
4-7 First continuation page or 0
@ -107,17 +107,17 @@ Byte Contents
16-17 Max keys (16 for hostsdb)
18-19 Size (current number of keys)
20-1023 key/value structures
</pre>
{% endhighlight %}
<p>{% trans -%}
Span Continuation block page format:
{%- endtrans %}</p>
<pre>
{% highlight %}
Byte Contents
0-3 Magic number 0x434f4e54 "CONT"
4-7 Next continuation page or 0
8-1023 key/value structures
</pre>
{% endhighlight %}
<p>{% trans -%}
@ -128,34 +128,34 @@ be at offset 8 in the continuation page.
Key and value data may be split across pages.
Max key and value lengths are 65535 bytes.
{%- endtrans %}</p>
<pre>
{% highlight %}
Byte Contents
0-1 key length in bytes
2-3 value length in bytes
4- key data
value data
</pre>
{% endhighlight %}
<p>{% trans -%}
Free list block page format:
{%- endtrans %}</p>
<pre>
{% highlight %}
Byte Contents
0-7 Magic number 0x2366724c69737423 "#frList#"
8-11 Next free list block or 0 if none
12-15 Number of valid free pages in this block (0 - 252)
16-1023 Free pages (4 bytes each), only the first (valid number) are valid
</pre>
{% endhighlight %}
<p>{% trans -%}
Free page block format:
{%- endtrans %}</p>
<pre>
{% highlight %}
Byte Contents
0-7 Magic number 0x7e2146524545217e "~!FREE!~"
8-1023 unused
</pre>
{% endhighlight %}
<p>{% trans -%}
The metaindex (located at page 2) is a mapping of US-ASCII strings to 4-byte integers.

View File

@ -179,8 +179,7 @@ A certificate is a container for various receipts or proof of works used through
<p>{% trans -%}
1 byte <a href="#type_Integer">Integer</a> specifying certificate type, followed by a 2 <a href="#type_Integer">Integer</a> specifying the size of the certificate payload, then that many bytes.
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+--//
|type| length | payload
+----+----+----+----+----+--//
@ -199,8 +198,7 @@ length :: Integer
payload :: data
length -> $length bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<ul>
@ -234,8 +232,7 @@ A set of key/value mappings or properties
<p>{% trans -%}
A 2-byte size Integer followed by a series of String=String; pairs
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| size |key string (len + data) | = |
+----+----+----+----+----+----+----+----+
@ -255,8 +252,7 @@ val string :: String
; :: A single byte containing ';'
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<ul>
@ -303,8 +299,7 @@ Defines the way to uniquely identify a particular router
<p>{% trans -%}
<a href="#type_PublicKey">PublicKey</a> followed by <a href="#type_SigningPublicKey">SigningPublicKey</a> and then a <a href="#type_Certificate">Certificate</a>
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| public_key |
+ +
@ -335,8 +330,7 @@ certificate :: Certificate
length -> >= 3 bytes
Total length: 387+ bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<p>{% trans -%}
@ -354,8 +348,7 @@ A Destination defines a particular endpoint to which messages can be directed fo
<p>{% trans -%}
<a href="#type_PublicKey">PublicKey</a> followed by a <a href="#type_SigningPublicKey">SigningPublicKey</a> and then a <a href="#type_Certificate">Certificate</a>
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| public_key |
+ +
@ -386,8 +379,7 @@ certificate :: Certificate
length -> >= 3 bytes
Total length: 387+ bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4><a href="http://docs.i2p-projekt.de/javadoc/net/i2p/data/Destination.html">Javadoc</a></h4>
@ -401,8 +393,7 @@ Defines the authorization for a particular tunnel to receive messages targeting
SHA256 <a href="#type_Hash">Hash</a> of the
<a href="#struct_RouterIdentity">RouterIdentity</a> of the gateway router, then the <a href="#type_TunnelId">TunnelId</a>, and finally an end <a href="#type_Date">Date</a>
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| tunnel_gw |
+ +
@ -425,8 +416,7 @@ tunnel_id :: TunnelId
end_date :: Date
length -> 8 bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<ul>
@ -451,8 +441,7 @@ the other being <a href="#struct_RouterInfo">RouterInfo</a>), and is keyed under
then a 1 byte <a href="#type_Integer">Integer</a> specifying how many <a href="#struct_Lease">Lease</a> structures are in the set, followed by the actual <a href="#struct_Lease">Lease</a> structures and finally a <a href="#type_Signature">Signature</a> of the previous
bytes signed by the <a href="#struct_Destination">Destination's</a> <a href="#type_SigningPrivateKey">SigningPrivateKey</a>
{%- endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| destination |
+ +
@ -535,8 +524,7 @@ leases :: [Lease]
signature :: Signature
length -> 40 bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<ul>
@ -575,8 +563,7 @@ This structure defines the means to contact a router through a transport protoco
After that comes a <a href="#type_String">String</a> defining the transport protocol this router address uses. Finally there is a <a href="#type_Mapping">Mapping</a> containing all of the transport specific options necessary to establish the connection, such as
IP address, port number, email address, URL, etc.
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+
|cost|
+----+----+----+----+----+----+----+----+
@ -602,8 +589,7 @@ transport_style :: String
length -> 1-256 bytes
options :: Mapping
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<ul>
@ -632,8 +618,7 @@ the contained <a href="#struct_RouterIdentity">RouterIdentity</a>.
<p>{% trans -%}
<a href="#struct_RouterIdentity">RouterIdentity</a> followed by the <a href="#type_Date">Date</a>, when the entry was published
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| router_ident |
+ +
@ -706,8 +691,7 @@ options :: Mapping
signature :: Signature
length -> 40 bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<p>{% trans -%}

View File

@ -19,14 +19,14 @@ However, SAM and the I2PTunnel classes support "raw datagrams".
{%- endtrans %}</p>
<h4>{% trans %}Format{% endtrans %}</h4>
<pre>
{% highlight %}
+----+----+----+----+----//
| payload...
+----+----+----+----+----//
Length: 0 - unlimited (see notes)
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<p>{% trans tunnelmessage=site_url('docs/spec/tunnel-message'),

View File

@ -16,11 +16,11 @@ used by the router to look up a country for an IP.
This format is easily generated from data files available from many public sources.
For example:
{%- endtrans %}</p>
<pre>
# wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
# unzip GeoIPCountryCSV.zip
# cut -d, -f5,6 < GeoIPCountryWhois.csv |sed 's/"//g' | sort | uniq > countries.txt
</pre>
{% highlight lang='bash' %}
$ wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
$ unzip GeoIPCountryCSV.zip
$ cut -d, -f5,6 < GeoIPCountryWhois.csv |sed 's/"//g' | sort | uniq > countries.txt
{% endhighlight %}
<ul>
<li>Encoding is UTF-8
<li>'#' in column 1 specifies a comment line
@ -35,12 +35,12 @@ For example:
This format is borrowed from Tor and is easily generated from data files available from many public sources.
For example:
{%- endtrans %}</p>
<pre>
# wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
# unzip GeoIPCountryCSV.zip
# cut -d, -f3-5 < GeoIPCountryWhois.csv|sed 's/"//g' > geoip.txt
# cut -d, -f5,6 < GeoIPCountryWhois.csv |sed 's/"//g' | sort | uniq > countries.txt
</pre>
{% highlight lang='bash' %}
$ wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
$ unzip GeoIPCountryCSV.zip
$ cut -d, -f3-5 < GeoIPCountryWhois.csv|sed 's/"//g' > geoip.txt
$ cut -d, -f5,6 < GeoIPCountryWhois.csv |sed 's/"//g' | sort | uniq > countries.txt
{% endhighlight %}
<ul>
<li>Encoding is ASCII
<li>'#' in column 1 specifies a comment line
@ -56,7 +56,7 @@ For example:
This is a compressed binary format designed for I2P.
The file is gzipped. Ungzipped format:
{%- endtrans %}</p>
<pre>
{% highlight %}
Bytes 0-9: Magic number "I2PGeoIPv6"
Bytes 10-11: Version (0x0001)
Bytes 12-15 Options (0x00000000) (future use)
@ -67,7 +67,7 @@ The file is gzipped. Ungzipped format:
8 byte from (/64)
8 byte to (/64)
2 byte ISO country code LOWER case (ASCII)
</pre>
{% endhighlight %}
<p>{% trans %}NOTES:{% endtrans %}</p>
<ul>
<li>Data must be sorted (SIGNED long twos complement), no overlap.

View File

@ -46,8 +46,7 @@ I2CP connection.
<h2>Example Message Sequences</h2>
<h3>Standard Session Establish</h3>
<pre>
{% filter escape %}
{% highlight %}
Client Router
---------------------> Protocol Byte (0x2a)
@ -57,49 +56,41 @@ I2CP connection.
Session Status Message <---------------------
Request LeaseSet Message <---------------------
---------------------> Create LeaseSet Message
{% endfilter %}
</pre>
{% endhighlight %}
<h3>Get Bandwidth Limits (Simple Session)</h3>
<pre>
{% filter escape %}
{% highlight %}
Client Router
---------------------> Protocol Byte (0x2a)
---------------------> Get Bandwidth Limits Message
Bandwidth Limits Message <---------------------
{% endfilter %}
</pre>
{% endhighlight %}
<h3>Destination Lookup (Simple Session)</h3>
<pre>
{% filter escape %}
{% highlight %}
Client Router
---------------------> Protocol Byte (0x2a)
---------------------> Dest Lookup Message
Dest Reply Message <---------------------
{% endfilter %}
</pre>
{% endhighlight %}
<h3>Outgoing Message</h3>
<p>Existing session, with i2cp.messageReliability=none</p>
<pre>
{% filter escape %}
{% highlight %}
Client Router
---------------------> Send Message Message
{% endfilter %}
</pre>
{% endhighlight %}
<p>Existing session, with i2cp.messageReliability=BestEffort</p>
<pre>
{% filter escape %}
{% highlight %}
Client Router
---------------------> Send Message Message
@ -107,24 +98,20 @@ Bandwidth Limits Message <---------------------
(accepted)
Message Status Message <---------------------
(succeeded)
{% endfilter %}
</pre>
{% endhighlight %}
<h3>Incoming Message</h3>
<p>Existing session, with i2cp.fastReceive=true (as of 0.9.4)</p>
<pre>
{% filter escape %}
{% highlight %}
Client Router
Message Payload Message <---------------------
{% endfilter %}
</pre>
{% endhighlight %}
<p>Existing session, with i2cp.fastReceive=false</p>
<pre>
{% filter escape %}
{% highlight %}
Client Router
Message Status Message <---------------------
@ -132,8 +119,7 @@ Bandwidth Limits Message <---------------------
---------------------> Receive Message Begin Message
Message Payload Message <---------------------
---------------------> Receive Message End Message
{% endfilter %}
</pre>
{% endhighlight %}
<h2 id="notes">Version Notes</h2>

View File

@ -30,8 +30,7 @@ They are not complete messages.
the length of the message payload, followed by a <a href="{{ site_url('docs/spec/common-structures') }}#type_Hash">Hash</a>,
which is truncated to the first byte. After that the actual message data follows.
</p>
<pre>
{% filter escape %}
{% highlight %}
Standard (16 bytes):
+----+----+----+----+----+----+----+----+
@ -46,12 +45,10 @@ Short (SSU, 5 bytes):
|type| short expiration |
+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
type :: Integer
length -> 1 byte
@ -85,8 +82,7 @@ data :: Data
length -> $size bytes
purpose -> actual message contents
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<ul><li>
When transmitted over <a href="{{ site_url('docs/transport/ssu') }}">SSU</a>,
@ -118,8 +114,7 @@ where the far-end router's version is known and checksum generation can be disab
<a href="{{ site_url('docs/spec/common-structures') }}#type_TunnelId">TunnelId</a> to receive messages on, followed by the <a href="{{ site_url('docs/spec/common-structures') }}#type_Hash">Hash</a> of our <a href="{{ site_url('docs/spec/common-structures') }}#struct_RouterIdentity">RouterIdentity</a>. After that the <a href="{{ site_url('docs/spec/common-structures') }}#type_TunnelId">TunnelId</a> and the <a href="{{ site_url('docs/spec/common-structures') }}#type_Hash">Hash</a> of the next router's <a href="{{ site_url('docs/spec/common-structures') }}#struct_RouterIdentity">RouterIdentity</a> follow.
</p>
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
Cleartext:
+----+----+----+----+----+----+----+----+
| receive_tunnel | our_ident |
@ -198,12 +193,10 @@ ElGamal and AES encrypted:
~ ~
| |
+----+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
unencrypted:
receive_tunnel :: TunnelId
@ -264,8 +257,7 @@ encrypted_data :: ElGamal and AES encrypted data
total length: 528
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<ul><li>
@ -280,8 +272,7 @@ The two padding bytes from the block (the zero bytes at locations 0 and 257) are
<h3 id="struct_BuildResponseRecord">BuildResponseRecord</h3>
<pre>
{% filter escape %}
{% highlight %}
unencrypted:
+----+----+----+----+----+----+----+----+
| random data... |
@ -290,11 +281,9 @@ unencrypted:
+ +----+
| |ret |
+----+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
unencrypted:
bytes 0-526: random data
byte 527 : reply
@ -304,8 +293,7 @@ bytes 0-527: AES-encrypted record(note: same size as BuildRequestRecord)
total length: 528
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<ul><li>
@ -317,8 +305,7 @@ total length: 528
<h3 id="struct_GarlicClove">GarlicClove</h3>
<pre>
{% filter escape %}
{% highlight %}
unencrypted:
+----+----+----+----+----+----+----+----+
| Delivery Instructions |
@ -335,8 +322,7 @@ unencrypted:
+----+----+----+----+----+----+----+----+
| Certificate |
+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
unencrypted:
@ -448,7 +434,7 @@ Defined in the <a href="{{ site_url('docs/spec/tunnel-message') }}#delivery">Tun
<p>
An uncompressed LeaseSet or a compressed RouterInfo
</p>
<pre>
{% highlight %}
with reply token:
+----+----+----+----+----+----+----+----+
| SHA256 Hash as key |
@ -484,7 +470,7 @@ with reply token == 0:
+----+----+----+----+----+----+----+----+
|type| 0 | data ...
+----+-------------------+---------\\
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
key:
@ -529,8 +515,7 @@ For security, the reply fields are ignored if the message is received down a tun
<h3 id="msg_DatabaseLookup">DatabaseLookup</h3>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| SHA256 hash as the key to look up |
+ +
@ -580,12 +565,10 @@ For security, the reply fields are ignored if the message is received down a tun
+ +
| |
+----+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
key:
32 bytes
SHA256 hash of the object to lookup
@ -642,8 +625,7 @@ reply tags:
One or more 32 byte SessionTags (typically one)
Only included if encryptionFlag == 1
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<ul><li>
@ -665,8 +647,7 @@ The number of included tags could be greater than one if alternative DHT lookup
<p>
A list of router hashes closest to the requested key
</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| SHA256 hash as query key |
+ +
@ -700,12 +681,10 @@ The number of included tags could be greater than one if alternative DHT lookup
+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
key:
32 bytes
SHA256 of the object being searched
@ -722,8 +701,7 @@ peer hash:
from:
32 bytes
SHA256 of the RouterInfo of the router this reply was sent from
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<p>
@ -740,17 +718,14 @@ from:
<p>
The ID of the delivered message, and the creation or arrival time.
</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+----+----+----+----+
|msg-id | time stamp |
+----+----+----+----+----+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
msg-id:
4 bytes
unique ID of the message we deliver the DeliveryStatus for (see common I2NP header for details)
@ -758,8 +733,7 @@ msg-id:
time stamp: Date
8 bytes
time the message was successfully created or delivered
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<ul><li>
@ -781,8 +755,7 @@ time stamp: Date
<p>
When decrypted, a series of <a href="#struct_GarlicClove">Garlic Cloves</a>.
</p>
<pre>
{% filter escape %}
{% highlight %}
encrypted:
+----+----+----+----+----+----+----+----+
| length | data |
@ -812,12 +785,10 @@ unencrypted data:
+----+----+----+----+----+----+----+----+
Expiration |
+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
Encrypted:
length:
@ -842,8 +813,7 @@ Message ID :: 4 byte Integer
Expiration :: Date (8 bytes)
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<ul>
@ -873,8 +843,7 @@ Expiration :: Date (8 bytes)
<h3 id="msg_TunnelData">TunnelData</h3>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| tunnnelID | data |
+----+----+----+----+ |
@ -885,12 +854,10 @@ Expiration :: Date (8 bytes)
+ +----+----+----+----+
| |
+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
tunnelId:
4 byte Tunnel ID
identifies the tunnel this message is directed at
@ -898,8 +865,7 @@ tunnelId:
data:
1024 bytes
payload data.. fixed to 1024 bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<ul>
@ -909,17 +875,14 @@ data:
<h3 id="msg_TunnelGateway">TunnelGateway</h3>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+--\\----+
| tunnelId | length | data...|
+----+----+----+----+----+----+--\\----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
tunnelId:
4 byte Tunnel ID
identifies the tunnel this message is directed at
@ -931,8 +894,7 @@ length:
data:
$length bytes
actual payload of this message
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<ul>
@ -951,17 +913,14 @@ data:
<p>
A length Integer, followed by opaque data.
</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+---//--+
| length | data... |
+----+----+----+----+----+---//--+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
length:
4 bytes
length of the payload
@ -969,12 +928,10 @@ length:
data:
$length bytes
actual payload of this message
{% endfilter %}
</pre>
{% endhighlight %}
<h3 id="msg_TunnelBuild">TunnelBuild</h3>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| Record 0 ... |
@ -988,17 +945,14 @@ data:
| |
+----+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
Just 8 Build Request Records attached together
Record size: 528 bytes
Total size: 8*528 = 4224 bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<p>
@ -1007,11 +961,9 @@ Total size: 8*528 = 4224 bytes
<h3 id="msg_TunnelBuildReply">TunnelBuildReply</h3>
<pre>
{% filter escape %}
{% highlight %}
same format as TunnelBuild message, with Build Response Records
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<p>
@ -1019,17 +971,14 @@ same format as TunnelBuild message, with Build Response Records
</p>
<h3 id="msg_VariableTunnelBuild">VariableTunnelBuild</h3>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
|num | BuildRequestRecords...
+----+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
Same format as TunnelBuildMessage, except for the addition of an "num" field in front and $num number of Build Request Records instead of 8
num:
@ -1038,8 +987,7 @@ num:
Record size: 528 bytes
Total size: 1 + $num*528
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Notes</h4>
<ul>
@ -1050,13 +998,11 @@ Total size: 1 + $num*528
</ul>
<h3 id="msg_VariableTunnelBuildReply">VariableTunnelBuildReply</h3>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
|num | BuildResponseRecords...
+----+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
Same format as VariableTunnelBuild message, with Build Response Records.

View File

@ -56,15 +56,15 @@ using this flag are.</p>
to the various messages - a one byte flag and a four byte sending
timestamp (seconds since the unix epoch). The flag byte contains
the following bitfields:</p>
<pre>
{% highlight %}
Bit order: 76543210 (bit 7 is MSB)
bits 7-4: payload type
bit 3: rekey?
bit 2: extended options included
bits 1-0: reserved
</pre>
<pre>
{% endhighlight %}
{% highlight %}
Header: 37+ bytes
Encryption starts with the flag byte.
+----+----+----+----+----+----+----+----+
@ -81,7 +81,7 @@ the following bitfields:</p>
| this may have 64 byte keying material |
| and/or a one+N byte extended options) |
+---------------------------------------|
</pre>
{% endhighlight %}
<h3 id="rekey">Rekeying</h3>
@ -192,7 +192,7 @@ This is the first message sent to establish a session.
<td>introKey</td></tr>
</table>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
| X, as calculated from DH |
| |
@ -206,7 +206,7 @@ This is the first message sent to establish a session.
. . .
| |
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
<p>
Typical size including header, in current implementation: 304 (IPv4) or 320 (IPv6) bytes
@ -252,7 +252,7 @@ This is the response to a Session Request.
signature and the following 8 bytes padding.</td></tr>
</table>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
| Y, as calculated from DH |
| |
@ -282,7 +282,7 @@ This is the response to a Session Request.
. . .
| |
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
<p>
Typical size including header, in current implementation: 368 bytes (IPv4 or IPv6)
@ -343,7 +343,7 @@ bits 3-0: total identity fragments (F) 1-15</pre></li>
<td>sessionKey</td></tr>
</table>
<pre>
{% highlight %}
<b>Fragment 0 through F-2</b>
+----+----+----+----+----+----+----+----+
|info| cursize | |
@ -382,7 +382,7 @@ bits 3-0: total identity fragments (F) 1-15</pre></li>
+ +
| |
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
<p>
Typical size including header, in current implementation: 480 bytes
@ -423,11 +423,11 @@ and is never sent. Transmission implemented as of release 0.8.9.
<td>sessionKey or introKey</td></tr>
</table>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
| no data |
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
<p>
Typical size including header, in current implementation: 48 bytes
@ -457,7 +457,7 @@ This is the first message sent from Alice to Bob to request an introduction to C
<td>introKey (or sessionKey, if Alice/Bob is established)</td></tr>
</table>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
| relay tag |size| Alice IP addr
+----+----+----+----+----+--- +----+----|
@ -477,7 +477,7 @@ This is the first message sent from Alice to Bob to request an introduction to C
+----+----+----+----+ |
| arbitrary amount of uninterpreted data|
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
<p>
Typical size including header, in current implementation: 96 bytes (no Alice IP included) or 112 bytes (4-byte Alice IP included)
@ -523,7 +523,7 @@ This is the response to a Relay Request and is sent from Bob to Alice.
<td>introKey (or sessionKey, if Alice/Bob is established)</td></tr>
</table>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
|size| Charlie IP | Port (C)|size|
+----+----+----+----+----+----+----+----+
@ -533,7 +533,7 @@ This is the response to a Relay Request and is sent from Bob to Alice.
+----+----+ |
| uninterpreted data |
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
<p>
Typical size including header, in current implementation: 64 (Alice IPv4) or 80 (Alice IPv6) bytes
@ -576,7 +576,7 @@ This is the introduction for Alice, which is sent from Bob to Charlie.
<td>sessionKey</td></tr>
</table>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
|size| Alice IP | Port (A)|size|
+----+----+----+----+----+----+----+----+
@ -586,7 +586,7 @@ This is the introduction for Alice, which is sent from Bob to Charlie.
+----+----+----+----+----+----+----+----+
| arbitrary amount of uninterpreted data|
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
<p>
Typical size including header, in current implementation: 48 bytes
@ -680,7 +680,7 @@ byte 1
<td>sessionKey</td></tr>
</table>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
|flag| (additional headers, determined |
+----+ |
@ -707,7 +707,7 @@ byte 1
+----+----+----+----+----+----+----+----+
| arbitrary amount of uninterpreted data|
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
<h4>Notes</h4>
<ul><li>
@ -775,7 +775,7 @@ See <a href="{{ site_url('docs/transport/ssu') }}#peerTesting">the SSU overview
<td>introKey (or sessionKey if the connection has already been established)</td></tr>
</table>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
| test nonce |size| Alice IP addr
+----+----+----+----+----+----+----+----+
@ -791,7 +791,7 @@ See <a href="{{ site_url('docs/transport/ssu') }}#peerTesting">the SSU overview
|----+----+----+ |
| uninterpreted data |
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
<p>
Typical size including header, in current implementation: 80 bytes
@ -829,7 +829,7 @@ It is sent from Charlie to Alice as a part of the Introduction sequence.
<b>Minimal data message (no fragments, no ACKs, no NACKs, etc)</b><br />
<i>(Size: 39 bytes)</i>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
| MAC |
+ +
@ -843,12 +843,12 @@ It is sent from Charlie to Alice as a part of the Introduction sequence.
+----+----+----+----+----+----+----+ |
| padding to fit a full AES256 block |
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
<b>Minimal data message with payload</b><br />
<i>(Size: 46+fragmentSize bytes)</i>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
| MAC |
+ +
@ -866,7 +866,7 @@ It is sent from Charlie to Alice as a part of the Introduction sequence.
. . .
| |
+----+----+----+----+----+----+----+----+
</pre>
{% endhighlight %}
{% endblock %}

View File

@ -12,7 +12,7 @@ See the Streaming page for an overview of the Streaming Library.
<p>{% trans -%}
The format of a single packet in the streaming protocol is:
{%- endtrans %}</p>
<pre>
{% highlight %}
+----+----+----+----+----+----+----+----+
| send Stream ID | rcv Stream ID |
@ -29,7 +29,7 @@ The format of a single packet in the streaming protocol is:
+----+----+----+----//
</pre>
{% endhighlight %}
<table>
<tr><th>{{ _('Field') }}<th>{{ _('Length') }}<th>{{ _('Contents') }}

View File

@ -32,8 +32,7 @@ After the tunnel messages are created, they are encrypted as described in
<h2 id="msg_Data">Tunnel Message (Encrypted)</h2>
These are the contents of a tunnel data message after encryption.
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| Tunnel ID | IV |
+----+----+----+----+ +
@ -48,12 +47,10 @@ These are the contents of a tunnel data message after encryption.
+ +-------------------+
| |
+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
Tunnel ID:
4 bytes
The ID of the next hop
@ -68,14 +65,12 @@ Encrypted Data
Total Size: 1028 Bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h2 id="msg_Data">Tunnel Message (Decrypted)</h2>
These are the contents of a tunnel data message when decrypted.
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| Tunnel ID | IV |
+----+----+----+----+ +
@ -113,8 +108,7 @@ These are the contents of a tunnel data message when decrypted.
+ +-------------------+
| |
+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
@ -176,8 +170,7 @@ for more details.
<h3>First Fragment Delivery Instructions</h3>
<p>If the MSB of the first byte is 0, this is an initial I2NP message fragment,
or a complete I2NP message, and the instructions are:</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
|flag| Tunnel ID (opt) | |
+----+----+----+----+----+ +
@ -191,8 +184,7 @@ or a complete I2NP message, and the instructions are:</p>
+----+----+----+----+----+----+----+----+
|..ID(opt)| ext opts... (opt) | size |
+----+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
@ -259,17 +251,14 @@ Total length: Typical length is:
<h3>Follow-on Fragment Delivery Instructions</h3>
<p>If the MSB of the first byte is 1, this is a follow-on fragment, and the instructions are:</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+
|frag| Message ID | size |
+----+----+----+----+----+----+----+
{% endfilter %}
</pre>
{% endhighlight %}
<h4>Definition</h4>
<pre>
{% filter escape %}
{% highlight %}
frag:
1 byte
Binary 1nnnnnnd
@ -288,8 +277,7 @@ size:
Total length: 7 bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h3><a href="http://docs.i2p-projekt.de/javadoc/net/i2p/data/i2np/DeliveryInstructions.html">Delivery Instructions Javadoc</a></h3>