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 -%} <p>{% trans -%}
Superblock format: Superblock format:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Byte Contents Byte Contents
0-5 Magic number 0x3141de493250 ("1A" 0xde "I2P") 0-5 Magic number 0x3141de493250 ("1A" 0xde "I2P")
6 Major version 0x01 6 Major version 0x01
@ -60,12 +60,12 @@ Byte Contents
20-21 Mounted flag 0x01 = yes 20-21 Mounted flag 0x01 = yes
22-23 Span size max number of key/value pairs per span (16 for hostsdb) 22-23 Span size max number of key/value pairs per span (16 for hostsdb)
24-1023 unused 24-1023 unused
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
Skip list block page format: Skip list block page format:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Byte Contents Byte Contents
0-7 Magic number 0x536b69704c697374 "SkipList" 0-7 Magic number 0x536b69704c697374 "SkipList"
8-11 First span page 8-11 First span page
@ -74,14 +74,14 @@ Byte Contents
20-23 Spans (total number of spans - may only be valid at startup) 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) 24-27 Levels (total number of levels - may only be valid at startup)
28-1023 unused 28-1023 unused
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
Skip level block page format is as follows. Skip level block page format is as follows.
All levels have a span. Not all spans have levels. All levels have a span. Not all spans have levels.
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Byte Contents Byte Contents
0-7 Magic number 0x42534c6576656c73 "BSLevels" 0-7 Magic number 0x42534c6576656c73 "BSLevels"
8-9 Max height 8-9 Max height
@ -89,7 +89,7 @@ Byte Contents
12-15 Span page 12-15 Span page
16- Next level pages ('current height' entries, 4 bytes each, lowest first) 16- Next level pages ('current height' entries, 4 bytes each, lowest first)
remaining bytes unused remaining bytes unused
</pre> {% endhighlight %}
<p>{% trans -%} <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. Key/value structures are sorted by key within each span.
Spans other than the first span may not be empty. Spans other than the first span may not be empty.
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Byte Contents Byte Contents
0-3 Magic number 0x5370616e "Span" 0-3 Magic number 0x5370616e "Span"
4-7 First continuation page or 0 4-7 First continuation page or 0
@ -107,17 +107,17 @@ Byte Contents
16-17 Max keys (16 for hostsdb) 16-17 Max keys (16 for hostsdb)
18-19 Size (current number of keys) 18-19 Size (current number of keys)
20-1023 key/value structures 20-1023 key/value structures
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
Span Continuation block page format: Span Continuation block page format:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Byte Contents Byte Contents
0-3 Magic number 0x434f4e54 "CONT" 0-3 Magic number 0x434f4e54 "CONT"
4-7 Next continuation page or 0 4-7 Next continuation page or 0
8-1023 key/value structures 8-1023 key/value structures
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
@ -128,34 +128,34 @@ be at offset 8 in the continuation page.
Key and value data may be split across pages. Key and value data may be split across pages.
Max key and value lengths are 65535 bytes. Max key and value lengths are 65535 bytes.
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Byte Contents Byte Contents
0-1 key length in bytes 0-1 key length in bytes
2-3 value length in bytes 2-3 value length in bytes
4- key data 4- key data
value data value data
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
Free list block page format: Free list block page format:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Byte Contents Byte Contents
0-7 Magic number 0x2366724c69737423 "#frList#" 0-7 Magic number 0x2366724c69737423 "#frList#"
8-11 Next free list block or 0 if none 8-11 Next free list block or 0 if none
12-15 Number of valid free pages in this block (0 - 252) 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 16-1023 Free pages (4 bytes each), only the first (valid number) are valid
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
Free page block format: Free page block format:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Byte Contents Byte Contents
0-7 Magic number 0x7e2146524545217e "~!FREE!~" 0-7 Magic number 0x7e2146524545217e "~!FREE!~"
8-1023 unused 8-1023 unused
</pre> {% endhighlight %}
<p>{% trans -%} <p>{% trans -%}
The metaindex (located at page 2) is a mapping of US-ASCII strings to 4-byte integers. 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 -%} <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. 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> {% endtrans %}</p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+--// +----+----+----+----+----+--//
|type| length | payload |type| length | payload
+----+----+----+----+----+--// +----+----+----+----+----+--//
@ -199,8 +198,7 @@ length :: Integer
payload :: data payload :: data
length -> $length bytes length -> $length bytes
{% endfilter %} {% endhighlight %}
</pre>
<h4>{% trans %}Notes{% endtrans %}</h4> <h4>{% trans %}Notes{% endtrans %}</h4>
<ul> <ul>
@ -234,8 +232,7 @@ A set of key/value mappings or properties
<p>{% trans -%} <p>{% trans -%}
A 2-byte size Integer followed by a series of String=String; pairs A 2-byte size Integer followed by a series of String=String; pairs
{% endtrans %}</p> {% endtrans %}</p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| size |key string (len + data) | = | | size |key string (len + data) | = |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
@ -255,8 +252,7 @@ val string :: String
; :: A single byte containing ';' ; :: A single byte containing ';'
{% endfilter %} {% endhighlight %}
</pre>
<h4>{% trans %}Notes{% endtrans %}</h4> <h4>{% trans %}Notes{% endtrans %}</h4>
<ul> <ul>
@ -303,8 +299,7 @@ Defines the way to uniquely identify a particular router
<p>{% trans -%} <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> <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> {% endtrans %}</p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| public_key | | public_key |
+ + + +
@ -335,8 +330,7 @@ certificate :: Certificate
length -> >= 3 bytes length -> >= 3 bytes
Total length: 387+ bytes Total length: 387+ bytes
{% endfilter %} {% endhighlight %}
</pre>
<h4>{% trans %}Notes{% endtrans %}</h4> <h4>{% trans %}Notes{% endtrans %}</h4>
<p>{% trans -%} <p>{% trans -%}
@ -354,8 +348,7 @@ A Destination defines a particular endpoint to which messages can be directed fo
<p>{% trans -%} <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> <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> {% endtrans %}</p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| public_key | | public_key |
+ + + +
@ -386,8 +379,7 @@ certificate :: Certificate
length -> >= 3 bytes length -> >= 3 bytes
Total length: 387+ bytes Total length: 387+ bytes
{% endfilter %} {% endhighlight %}
</pre>
<h4><a href="http://docs.i2p-projekt.de/javadoc/net/i2p/data/Destination.html">Javadoc</a></h4> <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 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> <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> {% endtrans %}</p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| tunnel_gw | | tunnel_gw |
+ + + +
@ -425,8 +416,7 @@ tunnel_id :: TunnelId
end_date :: Date end_date :: Date
length -> 8 bytes length -> 8 bytes
{% endfilter %} {% endhighlight %}
</pre>
<h4>{% trans %}Notes{% endtrans %}</h4> <h4>{% trans %}Notes{% endtrans %}</h4>
<ul> <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 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> bytes signed by the <a href="#struct_Destination">Destination's</a> <a href="#type_SigningPrivateKey">SigningPrivateKey</a>
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| destination | | destination |
+ + + +
@ -535,8 +524,7 @@ leases :: [Lease]
signature :: Signature signature :: Signature
length -> 40 bytes length -> 40 bytes
{% endfilter %} {% endhighlight %}
</pre>
<h4>{% trans %}Notes{% endtrans %}</h4> <h4>{% trans %}Notes{% endtrans %}</h4>
<ul> <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 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. IP address, port number, email address, URL, etc.
{% endtrans %}</p> {% endtrans %}</p>
<pre> {% highlight %}
{% filter escape %}
+----+ +----+
|cost| |cost|
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
@ -602,8 +589,7 @@ transport_style :: String
length -> 1-256 bytes length -> 1-256 bytes
options :: Mapping options :: Mapping
{% endfilter %} {% endhighlight %}
</pre>
<h4>{% trans %}Notes{% endtrans %}</h4> <h4>{% trans %}Notes{% endtrans %}</h4>
<ul> <ul>
@ -632,8 +618,7 @@ the contained <a href="#struct_RouterIdentity">RouterIdentity</a>.
<p>{% trans -%} <p>{% trans -%}
<a href="#struct_RouterIdentity">RouterIdentity</a> followed by the <a href="#type_Date">Date</a>, when the entry was published <a href="#struct_RouterIdentity">RouterIdentity</a> followed by the <a href="#type_Date">Date</a>, when the entry was published
{% endtrans %}</p> {% endtrans %}</p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| router_ident | | router_ident |
+ + + +
@ -706,8 +691,7 @@ options :: Mapping
signature :: Signature signature :: Signature
length -> 40 bytes length -> 40 bytes
{% endfilter %} {% endhighlight %}
</pre>
<h4>{% trans %}Notes{% endtrans %}</h4> <h4>{% trans %}Notes{% endtrans %}</h4>
<p>{% trans -%} <p>{% trans -%}

View File

@ -19,14 +19,14 @@ However, SAM and the I2PTunnel classes support "raw datagrams".
{%- endtrans %}</p> {%- endtrans %}</p>
<h4>{% trans %}Format{% endtrans %}</h4> <h4>{% trans %}Format{% endtrans %}</h4>
<pre> {% highlight %}
+----+----+----+----+----// +----+----+----+----+----//
| payload... | payload...
+----+----+----+----+----// +----+----+----+----+----//
Length: 0 - unlimited (see notes) Length: 0 - unlimited (see notes)
</pre> {% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4> <h4>{% trans %}Notes{% endtrans %}</h4>
<p>{% trans tunnelmessage=site_url('docs/spec/tunnel-message'), <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. This format is easily generated from data files available from many public sources.
For example: For example:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight lang='bash' %}
# wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip $ wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
# unzip GeoIPCountryCSV.zip $ unzip GeoIPCountryCSV.zip
# cut -d, -f5,6 < GeoIPCountryWhois.csv |sed 's/"//g' | sort | uniq > countries.txt $ cut -d, -f5,6 < GeoIPCountryWhois.csv |sed 's/"//g' | sort | uniq > countries.txt
</pre> {% endhighlight %}
<ul> <ul>
<li>Encoding is UTF-8 <li>Encoding is UTF-8
<li>'#' in column 1 specifies a comment line <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. This format is borrowed from Tor and is easily generated from data files available from many public sources.
For example: For example:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight lang='bash' %}
# wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip $ wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
# unzip GeoIPCountryCSV.zip $ unzip GeoIPCountryCSV.zip
# cut -d, -f3-5 < GeoIPCountryWhois.csv|sed 's/"//g' > geoip.txt $ cut -d, -f3-5 < GeoIPCountryWhois.csv|sed 's/"//g' > geoip.txt
# cut -d, -f5,6 < GeoIPCountryWhois.csv |sed 's/"//g' | sort | uniq > countries.txt $ cut -d, -f5,6 < GeoIPCountryWhois.csv |sed 's/"//g' | sort | uniq > countries.txt
</pre> {% endhighlight %}
<ul> <ul>
<li>Encoding is ASCII <li>Encoding is ASCII
<li>'#' in column 1 specifies a comment line <li>'#' in column 1 specifies a comment line
@ -56,7 +56,7 @@ For example:
This is a compressed binary format designed for I2P. This is a compressed binary format designed for I2P.
The file is gzipped. Ungzipped format: The file is gzipped. Ungzipped format:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
Bytes 0-9: Magic number "I2PGeoIPv6" Bytes 0-9: Magic number "I2PGeoIPv6"
Bytes 10-11: Version (0x0001) Bytes 10-11: Version (0x0001)
Bytes 12-15 Options (0x00000000) (future use) Bytes 12-15 Options (0x00000000) (future use)
@ -67,7 +67,7 @@ The file is gzipped. Ungzipped format:
8 byte from (/64) 8 byte from (/64)
8 byte to (/64) 8 byte to (/64)
2 byte ISO country code LOWER case (ASCII) 2 byte ISO country code LOWER case (ASCII)
</pre> {% endhighlight %}
<p>{% trans %}NOTES:{% endtrans %}</p> <p>{% trans %}NOTES:{% endtrans %}</p>
<ul> <ul>
<li>Data must be sorted (SIGNED long twos complement), no overlap. <li>Data must be sorted (SIGNED long twos complement), no overlap.

View File

@ -46,8 +46,7 @@ I2CP connection.
<h2>Example Message Sequences</h2> <h2>Example Message Sequences</h2>
<h3>Standard Session Establish</h3> <h3>Standard Session Establish</h3>
<pre> {% highlight %}
{% filter escape %}
Client Router Client Router
---------------------> Protocol Byte (0x2a) ---------------------> Protocol Byte (0x2a)
@ -57,49 +56,41 @@ I2CP connection.
Session Status Message <--------------------- Session Status Message <---------------------
Request LeaseSet Message <--------------------- Request LeaseSet Message <---------------------
---------------------> Create LeaseSet Message ---------------------> Create LeaseSet Message
{% endfilter %} {% endhighlight %}
</pre>
<h3>Get Bandwidth Limits (Simple Session)</h3> <h3>Get Bandwidth Limits (Simple Session)</h3>
<pre> {% highlight %}
{% filter escape %}
Client Router Client Router
---------------------> Protocol Byte (0x2a) ---------------------> Protocol Byte (0x2a)
---------------------> Get Bandwidth Limits Message ---------------------> Get Bandwidth Limits Message
Bandwidth Limits Message <--------------------- Bandwidth Limits Message <---------------------
{% endfilter %} {% endhighlight %}
</pre>
<h3>Destination Lookup (Simple Session)</h3> <h3>Destination Lookup (Simple Session)</h3>
<pre> {% highlight %}
{% filter escape %}
Client Router Client Router
---------------------> Protocol Byte (0x2a) ---------------------> Protocol Byte (0x2a)
---------------------> Dest Lookup Message ---------------------> Dest Lookup Message
Dest Reply Message <--------------------- Dest Reply Message <---------------------
{% endfilter %} {% endhighlight %}
</pre>
<h3>Outgoing Message</h3> <h3>Outgoing Message</h3>
<p>Existing session, with i2cp.messageReliability=none</p> <p>Existing session, with i2cp.messageReliability=none</p>
<pre> {% highlight %}
{% filter escape %}
Client Router Client Router
---------------------> Send Message Message ---------------------> Send Message Message
{% endfilter %} {% endhighlight %}
</pre>
<p>Existing session, with i2cp.messageReliability=BestEffort</p> <p>Existing session, with i2cp.messageReliability=BestEffort</p>
<pre> {% highlight %}
{% filter escape %}
Client Router Client Router
---------------------> Send Message Message ---------------------> Send Message Message
@ -107,24 +98,20 @@ Bandwidth Limits Message <---------------------
(accepted) (accepted)
Message Status Message <--------------------- Message Status Message <---------------------
(succeeded) (succeeded)
{% endfilter %} {% endhighlight %}
</pre>
<h3>Incoming Message</h3> <h3>Incoming Message</h3>
<p>Existing session, with i2cp.fastReceive=true (as of 0.9.4)</p> <p>Existing session, with i2cp.fastReceive=true (as of 0.9.4)</p>
<pre> {% highlight %}
{% filter escape %}
Client Router Client Router
Message Payload Message <--------------------- Message Payload Message <---------------------
{% endfilter %} {% endhighlight %}
</pre>
<p>Existing session, with i2cp.fastReceive=false</p> <p>Existing session, with i2cp.fastReceive=false</p>
<pre> {% highlight %}
{% filter escape %}
Client Router Client Router
Message Status Message <--------------------- Message Status Message <---------------------
@ -132,8 +119,7 @@ Bandwidth Limits Message <---------------------
---------------------> Receive Message Begin Message ---------------------> Receive Message Begin Message
Message Payload Message <--------------------- Message Payload Message <---------------------
---------------------> Receive Message End Message ---------------------> Receive Message End Message
{% endfilter %} {% endhighlight %}
</pre>
<h2 id="notes">Version Notes</h2> <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>, 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. which is truncated to the first byte. After that the actual message data follows.
</p> </p>
<pre> {% highlight %}
{% filter escape %}
Standard (16 bytes): Standard (16 bytes):
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
@ -46,12 +45,10 @@ Short (SSU, 5 bytes):
|type| short expiration | |type| short expiration |
+----+----+----+----+----+ +----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
type :: Integer type :: Integer
length -> 1 byte length -> 1 byte
@ -85,8 +82,7 @@ data :: Data
length -> $size bytes length -> $size bytes
purpose -> actual message contents purpose -> actual message contents
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<ul><li> <ul><li>
When transmitted over <a href="{{ site_url('docs/transport/ssu') }}">SSU</a>, 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. <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> </p>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
Cleartext: Cleartext:
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| receive_tunnel | our_ident | | receive_tunnel | our_ident |
@ -198,12 +193,10 @@ ElGamal and AES encrypted:
~ ~ ~ ~
| | | |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
unencrypted: unencrypted:
receive_tunnel :: TunnelId receive_tunnel :: TunnelId
@ -264,8 +257,7 @@ encrypted_data :: ElGamal and AES encrypted data
total length: 528 total length: 528
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<ul><li> <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> <h3 id="struct_BuildResponseRecord">BuildResponseRecord</h3>
<pre> {% highlight %}
{% filter escape %}
unencrypted: unencrypted:
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| random data... | | random data... |
@ -290,11 +281,9 @@ unencrypted:
+ +----+ + +----+
| |ret | | |ret |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
unencrypted: unencrypted:
bytes 0-526: random data bytes 0-526: random data
byte 527 : reply byte 527 : reply
@ -304,8 +293,7 @@ bytes 0-527: AES-encrypted record(note: same size as BuildRequestRecord)
total length: 528 total length: 528
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<ul><li> <ul><li>
@ -317,8 +305,7 @@ total length: 528
<h3 id="struct_GarlicClove">GarlicClove</h3> <h3 id="struct_GarlicClove">GarlicClove</h3>
<pre> {% highlight %}
{% filter escape %}
unencrypted: unencrypted:
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| Delivery Instructions | | Delivery Instructions |
@ -335,8 +322,7 @@ unencrypted:
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| Certificate | | Certificate |
+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> <pre>
unencrypted: unencrypted:
@ -448,7 +434,7 @@ Defined in the <a href="{{ site_url('docs/spec/tunnel-message') }}#delivery">Tun
<p> <p>
An uncompressed LeaseSet or a compressed RouterInfo An uncompressed LeaseSet or a compressed RouterInfo
</p> </p>
<pre> {% highlight %}
with reply token: with reply token:
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| SHA256 Hash as key | | SHA256 Hash as key |
@ -484,7 +470,7 @@ with reply token == 0:
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
|type| 0 | data ... |type| 0 | data ...
+----+-------------------+---------\\ +----+-------------------+---------\\
</pre> {% endhighlight %}
<h4>Definition</h4> <h4>Definition</h4>
<pre> <pre>
key: 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> <h3 id="msg_DatabaseLookup">DatabaseLookup</h3>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| SHA256 hash as the key to look up | | 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 %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
key: key:
32 bytes 32 bytes
SHA256 hash of the object to lookup SHA256 hash of the object to lookup
@ -642,8 +625,7 @@ reply tags:
One or more 32 byte SessionTags (typically one) One or more 32 byte SessionTags (typically one)
Only included if encryptionFlag == 1 Only included if encryptionFlag == 1
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<ul><li> <ul><li>
@ -665,8 +647,7 @@ The number of included tags could be greater than one if alternative DHT lookup
<p> <p>
A list of router hashes closest to the requested key A list of router hashes closest to the requested key
</p> </p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| SHA256 hash as query key | | SHA256 hash as query key |
+ + + +
@ -700,12 +681,10 @@ The number of included tags could be greater than one if alternative DHT lookup
+----+ +----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
key: key:
32 bytes 32 bytes
SHA256 of the object being searched SHA256 of the object being searched
@ -722,8 +701,7 @@ peer hash:
from: from:
32 bytes 32 bytes
SHA256 of the RouterInfo of the router this reply was sent from SHA256 of the RouterInfo of the router this reply was sent from
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<p> <p>
@ -740,17 +718,14 @@ from:
<p> <p>
The ID of the delivered message, and the creation or arrival time. The ID of the delivered message, and the creation or arrival time.
</p> </p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+----+----+----+----+
|msg-id | time stamp | |msg-id | time stamp |
+----+----+----+----+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
msg-id: msg-id:
4 bytes 4 bytes
unique ID of the message we deliver the DeliveryStatus for (see common I2NP header for details) 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 time stamp: Date
8 bytes 8 bytes
time the message was successfully created or delivered time the message was successfully created or delivered
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<ul><li> <ul><li>
@ -781,8 +755,7 @@ time stamp: Date
<p> <p>
When decrypted, a series of <a href="#struct_GarlicClove">Garlic Cloves</a>. When decrypted, a series of <a href="#struct_GarlicClove">Garlic Cloves</a>.
</p> </p>
<pre> {% highlight %}
{% filter escape %}
encrypted: encrypted:
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| length | data | | length | data |
@ -812,12 +785,10 @@ unencrypted data:
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
Expiration | Expiration |
+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
Encrypted: Encrypted:
length: length:
@ -842,8 +813,7 @@ Message ID :: 4 byte Integer
Expiration :: Date (8 bytes) Expiration :: Date (8 bytes)
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<ul> <ul>
@ -873,8 +843,7 @@ Expiration :: Date (8 bytes)
<h3 id="msg_TunnelData">TunnelData</h3> <h3 id="msg_TunnelData">TunnelData</h3>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| tunnnelID | data | | tunnnelID | data |
+----+----+----+----+ | +----+----+----+----+ |
@ -885,12 +854,10 @@ Expiration :: Date (8 bytes)
+ +----+----+----+----+ + +----+----+----+----+
| | | |
+----+----+----+----+ +----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
tunnelId: tunnelId:
4 byte Tunnel ID 4 byte Tunnel ID
identifies the tunnel this message is directed at identifies the tunnel this message is directed at
@ -898,8 +865,7 @@ tunnelId:
data: data:
1024 bytes 1024 bytes
payload data.. fixed to 1024 bytes payload data.. fixed to 1024 bytes
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<ul> <ul>
@ -909,17 +875,14 @@ data:
<h3 id="msg_TunnelGateway">TunnelGateway</h3> <h3 id="msg_TunnelGateway">TunnelGateway</h3>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+--\\----+ +----+----+----+----+----+----+--\\----+
| tunnelId | length | data...| | tunnelId | length | data...|
+----+----+----+----+----+----+--\\----+ +----+----+----+----+----+----+--\\----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
tunnelId: tunnelId:
4 byte Tunnel ID 4 byte Tunnel ID
identifies the tunnel this message is directed at identifies the tunnel this message is directed at
@ -931,8 +894,7 @@ length:
data: data:
$length bytes $length bytes
actual payload of this message actual payload of this message
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<ul> <ul>
@ -951,17 +913,14 @@ data:
<p> <p>
A length Integer, followed by opaque data. A length Integer, followed by opaque data.
</p> </p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+---//--+ +----+----+----+----+----+---//--+
| length | data... | | length | data... |
+----+----+----+----+----+---//--+ +----+----+----+----+----+---//--+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
length: length:
4 bytes 4 bytes
length of the payload length of the payload
@ -969,12 +928,10 @@ length:
data: data:
$length bytes $length bytes
actual payload of this message actual payload of this message
{% endfilter %} {% endhighlight %}
</pre>
<h3 id="msg_TunnelBuild">TunnelBuild</h3> <h3 id="msg_TunnelBuild">TunnelBuild</h3>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| Record 0 ... | | Record 0 ... |
@ -988,17 +945,14 @@ data:
| | | |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
Just 8 Build Request Records attached together Just 8 Build Request Records attached together
Record size: 528 bytes Record size: 528 bytes
Total size: 8*528 = 4224 bytes Total size: 8*528 = 4224 bytes
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<p> <p>
@ -1007,11 +961,9 @@ Total size: 8*528 = 4224 bytes
<h3 id="msg_TunnelBuildReply">TunnelBuildReply</h3> <h3 id="msg_TunnelBuildReply">TunnelBuildReply</h3>
<pre> {% highlight %}
{% filter escape %}
same format as TunnelBuild message, with Build Response Records same format as TunnelBuild message, with Build Response Records
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<p> <p>
@ -1019,17 +971,14 @@ same format as TunnelBuild message, with Build Response Records
</p> </p>
<h3 id="msg_VariableTunnelBuild">VariableTunnelBuild</h3> <h3 id="msg_VariableTunnelBuild">VariableTunnelBuild</h3>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
|num | BuildRequestRecords... |num | BuildRequestRecords...
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
Same format as TunnelBuildMessage, except for the addition of an "num" field in front and $num number of Build Request Records instead of 8 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: num:
@ -1038,8 +987,7 @@ num:
Record size: 528 bytes Record size: 528 bytes
Total size: 1 + $num*528 Total size: 1 + $num*528
{% endfilter %} {% endhighlight %}
</pre>
<h4>Notes</h4> <h4>Notes</h4>
<ul> <ul>
@ -1050,13 +998,11 @@ Total size: 1 + $num*528
</ul> </ul>
<h3 id="msg_VariableTunnelBuildReply">VariableTunnelBuildReply</h3> <h3 id="msg_VariableTunnelBuildReply">VariableTunnelBuildReply</h3>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
|num | BuildResponseRecords... |num | BuildResponseRecords...
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
Same format as VariableTunnelBuild message, with Build Response Records. 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 to the various messages - a one byte flag and a four byte sending
timestamp (seconds since the unix epoch). The flag byte contains timestamp (seconds since the unix epoch). The flag byte contains
the following bitfields:</p> the following bitfields:</p>
<pre> {% highlight %}
Bit order: 76543210 (bit 7 is MSB) Bit order: 76543210 (bit 7 is MSB)
bits 7-4: payload type bits 7-4: payload type
bit 3: rekey? bit 3: rekey?
bit 2: extended options included bit 2: extended options included
bits 1-0: reserved bits 1-0: reserved
</pre> {% endhighlight %}
<pre> {% highlight %}
Header: 37+ bytes Header: 37+ bytes
Encryption starts with the flag byte. Encryption starts with the flag byte.
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
@ -81,7 +81,7 @@ the following bitfields:</p>
| this may have 64 byte keying material | | this may have 64 byte keying material |
| and/or a one+N byte extended options) | | and/or a one+N byte extended options) |
+---------------------------------------| +---------------------------------------|
</pre> {% endhighlight %}
<h3 id="rekey">Rekeying</h3> <h3 id="rekey">Rekeying</h3>
@ -192,7 +192,7 @@ This is the first message sent to establish a session.
<td>introKey</td></tr> <td>introKey</td></tr>
</table> </table>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| X, as calculated from DH | | X, as calculated from DH |
| | | |
@ -206,7 +206,7 @@ This is the first message sent to establish a session.
. . . . . .
| | | |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
<p> <p>
Typical size including header, in current implementation: 304 (IPv4) or 320 (IPv6) bytes 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> signature and the following 8 bytes padding.</td></tr>
</table> </table>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| Y, as calculated from DH | | Y, as calculated from DH |
| | | |
@ -282,7 +282,7 @@ This is the response to a Session Request.
. . . . . .
| | | |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
<p> <p>
Typical size including header, in current implementation: 368 bytes (IPv4 or IPv6) 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> <td>sessionKey</td></tr>
</table> </table>
<pre> {% highlight %}
<b>Fragment 0 through F-2</b> <b>Fragment 0 through F-2</b>
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
|info| cursize | | |info| cursize | |
@ -382,7 +382,7 @@ bits 3-0: total identity fragments (F) 1-15</pre></li>
+ + + +
| | | |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
<p> <p>
Typical size including header, in current implementation: 480 bytes 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> <td>sessionKey or introKey</td></tr>
</table> </table>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| no data | | no data |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
<p> <p>
Typical size including header, in current implementation: 48 bytes 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> <td>introKey (or sessionKey, if Alice/Bob is established)</td></tr>
</table> </table>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| relay tag |size| Alice IP addr | 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| | arbitrary amount of uninterpreted data|
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
<p> <p>
Typical size including header, in current implementation: 96 bytes (no Alice IP included) or 112 bytes (4-byte Alice IP included) 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> <td>introKey (or sessionKey, if Alice/Bob is established)</td></tr>
</table> </table>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
|size| Charlie IP | Port (C)|size| |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 | | uninterpreted data |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
<p> <p>
Typical size including header, in current implementation: 64 (Alice IPv4) or 80 (Alice IPv6) bytes 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> <td>sessionKey</td></tr>
</table> </table>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
|size| Alice IP | Port (A)|size| |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| | arbitrary amount of uninterpreted data|
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
<p> <p>
Typical size including header, in current implementation: 48 bytes Typical size including header, in current implementation: 48 bytes
@ -680,7 +680,7 @@ byte 1
<td>sessionKey</td></tr> <td>sessionKey</td></tr>
</table> </table>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
|flag| (additional headers, determined | |flag| (additional headers, determined |
+----+ | +----+ |
@ -707,7 +707,7 @@ byte 1
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| arbitrary amount of uninterpreted data| | arbitrary amount of uninterpreted data|
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
<h4>Notes</h4> <h4>Notes</h4>
<ul><li> <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> <td>introKey (or sessionKey if the connection has already been established)</td></tr>
</table> </table>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| test nonce |size| Alice IP addr | test nonce |size| Alice IP addr
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
@ -791,7 +791,7 @@ See <a href="{{ site_url('docs/transport/ssu') }}#peerTesting">the SSU overview
|----+----+----+ | |----+----+----+ |
| uninterpreted data | | uninterpreted data |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
<p> <p>
Typical size including header, in current implementation: 80 bytes 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 /> <b>Minimal data message (no fragments, no ACKs, no NACKs, etc)</b><br />
<i>(Size: 39 bytes)</i> <i>(Size: 39 bytes)</i>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| MAC | | 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 | | padding to fit a full AES256 block |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
<b>Minimal data message with payload</b><br /> <b>Minimal data message with payload</b><br />
<i>(Size: 46+fragmentSize bytes)</i> <i>(Size: 46+fragmentSize bytes)</i>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| MAC | | MAC |
+ + + +
@ -866,7 +866,7 @@ It is sent from Charlie to Alice as a part of the Introduction sequence.
. . . . . .
| | | |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
</pre> {% endhighlight %}
{% endblock %} {% endblock %}

View File

@ -12,7 +12,7 @@ See the Streaming page for an overview of the Streaming Library.
<p>{% trans -%} <p>{% trans -%}
The format of a single packet in the streaming protocol is: The format of a single packet in the streaming protocol is:
{%- endtrans %}</p> {%- endtrans %}</p>
<pre> {% highlight %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| send Stream ID | rcv Stream ID | | send Stream ID | rcv Stream ID |
@ -29,7 +29,7 @@ The format of a single packet in the streaming protocol is:
+----+----+----+----// +----+----+----+----//
</pre> {% endhighlight %}
<table> <table>
<tr><th>{{ _('Field') }}<th>{{ _('Length') }}<th>{{ _('Contents') }} <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> <h2 id="msg_Data">Tunnel Message (Encrypted)</h2>
These are the contents of a tunnel data message after encryption. These are the contents of a tunnel data message after encryption.
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| Tunnel ID | IV | | Tunnel ID | IV |
+----+----+----+----+ + +----+----+----+----+ +
@ -48,12 +47,10 @@ These are the contents of a tunnel data message after encryption.
+ +-------------------+ + +-------------------+
| | | |
+----+----+----+----+ +----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
Tunnel ID: Tunnel ID:
4 bytes 4 bytes
The ID of the next hop The ID of the next hop
@ -68,14 +65,12 @@ Encrypted Data
Total Size: 1028 Bytes Total Size: 1028 Bytes
{% endfilter %} {% endhighlight %}
</pre>
<h2 id="msg_Data">Tunnel Message (Decrypted)</h2> <h2 id="msg_Data">Tunnel Message (Decrypted)</h2>
These are the contents of a tunnel data message when decrypted. These are the contents of a tunnel data message when decrypted.
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| Tunnel ID | IV | | Tunnel ID | IV |
+----+----+----+----+ + +----+----+----+----+ +
@ -113,8 +108,7 @@ These are the contents of a tunnel data message when decrypted.
+ +-------------------+ + +-------------------+
| | | |
+----+----+----+----+ +----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> <pre>
@ -176,8 +170,7 @@ for more details.
<h3>First Fragment Delivery Instructions</h3> <h3>First Fragment Delivery Instructions</h3>
<p>If the MSB of the first byte is 0, this is an initial I2NP message fragment, <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> or a complete I2NP message, and the instructions are:</p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
|flag| Tunnel ID (opt) | | |flag| Tunnel ID (opt) | |
+----+----+----+----+----+ + +----+----+----+----+----+ +
@ -191,8 +184,7 @@ or a complete I2NP message, and the instructions are:</p>
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
|..ID(opt)| ext opts... (opt) | size | |..ID(opt)| ext opts... (opt) | size |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> <pre>
@ -259,17 +251,14 @@ Total length: Typical length is:
<h3>Follow-on Fragment Delivery Instructions</h3> <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> <p>If the MSB of the first byte is 1, this is a follow-on fragment, and the instructions are:</p>
<pre> {% highlight %}
{% filter escape %}
+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+
|frag| Message ID | size | |frag| Message ID | size |
+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+
{% endfilter %} {% endhighlight %}
</pre>
<h4>Definition</h4> <h4>Definition</h4>
<pre> {% highlight %}
{% filter escape %}
frag: frag:
1 byte 1 byte
Binary 1nnnnnnd Binary 1nnnnnnd
@ -288,8 +277,7 @@ size:
Total length: 7 bytes Total length: 7 bytes
{% endfilter %} {% endhighlight %}
</pre>
<h3><a href="http://docs.i2p-projekt.de/javadoc/net/i2p/data/i2np/DeliveryInstructions.html">Delivery Instructions Javadoc</a></h3> <h3><a href="http://docs.i2p-projekt.de/javadoc/net/i2p/data/i2np/DeliveryInstructions.html">Delivery Instructions Javadoc</a></h3>