{% extends "global/layout.html" %} {% block title %}{% trans %}Datagram Specification{% endtrans %}{% endblock %} {% block lastupdated %}{% trans %}July 2014{% endtrans %}{% endblock %} {% block accuratefor %}0.9.14{% endblock %} {% block content %}

{% trans -%} See the Datagrams page for an overview of the Datagrams API. {%- endtrans %}

{% trans %}Specification{% endtrans %}

{% trans %}Non-Repliable Datagrams{% endtrans %}

{% trans -%} Non-repliable datagrams have no 'from' address and are not authenticated. They are also called "raw" datagrams. Strictly speaking, they are not "datagrams" at all, they are just raw data. They are not handled by the datagram API. However, SAM and the I2PTunnel classes support "raw datagrams". {%- endtrans %}

{% trans %}Format{% endtrans %}

{% highlight lang='dataspec' %} +----+----+----+----+----// | payload... +----+----+----+----+----// length: 0 - unlimited (see notes) {% endhighlight %}

{% trans %}Notes{% endtrans %}

{% trans tunnelmessage=site_url('docs/spec/tunnel-message'), transports=site_url('docs/transport') -%} The practical length is limited by lower layers of protocols - the tunnel message spec limits messages to about 61.2 KB and the transports currently limit messages to about 32 KB, although this may be raised in the future. {%- endtrans %}

{% trans %}Repliable Datagrams{% endtrans %}

{% trans -%} Repliable datagrams contain a 'from' address and a signature. These add at least 427 bytes of overhead. {%- endtrans %}

Format

+----+----+----+----+----+----+----+----+
| from                                  |
+                                       +
|                                       |
~                                       ~
~                                       ~
|                                       |
+                                       +
|                                       |
|                                       |
+----+----+----+----+----+----+----+----+
| signature                             |
+                                       +
|                                       |
+                                       +
|                                       |
+                                       +
|                                       |
+                                       +
|                                       |
+----+----+----+----+----+----+----+----+
| payload...
+----+----+----+----//



from      :: a Destination
             length: 387+ bytes
             The originator and signer of the datagram

signature :: a Signature
             Signature type must match the signing public key type in the 'from' Destination.
             length: 40+ bytes, as implied by the Signature type.
             For the default DSA_SHA1 key type:
                The DSA signature of the SHA-256 hash of the payload.
             For other key types:
                The signature of the payload.
             The signature may be verified by the signing public key of the 'from' Destination.

payload ::  The data
            Length: 0 to ~31.5 KB (see notes)

Total length: Payload length + 427+


{% trans %}Notes{% endtrans %}

{% endblock %}