blob: 7444730b570df489628c10ac2f3c5f20a6161d7c [file] [log] [blame]
Alexander Afanasyeveee8c252013-11-21 23:22:41 +00001.. _data:
2
3Data Packet
4-----------
5
6NDN Data packet is TLV defined as follows::
7
8 Data ::= DATA-TLV TLV-LENGTH
9 Name
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050010 MetaInfo?
11 Content?
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000012 Signature
13
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050014The Data packet represents some arbitrary binary data (held in the optional ``Content`` element) together with its ``Name``, some additional bits of optional information (``MetaInfo``), and a digital ``Signature`` of the other element(s). The Name is the first element since all NDN packet processing starts with the name. Signature is put at the end of the packet to ease the implementation because signature computation covers all the elements before Signature.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000015
Junxiao Shi707ea002018-07-17 15:42:52 -040016As recommended by :ref:`TLV evolvability guidelines <evolvability>`, unrecognized non-critical TLV elements may appear in the Data packet.
17However, they must not appear before the ``Name`` element.
18
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000019Name
20~~~~
21
Alexander Afanasyeve2800232013-11-27 02:24:14 +000022See :ref:`Name section <Name>` for details.
23
24.. _MetaInfo:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000025
26MetaInfo
27~~~~~~~~
28
Alexander Afanasyeve2800232013-11-27 02:24:14 +000029::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000030
31 MetaInfo ::= META-INFO-TYPE TLV-LENGTH
32 ContentType?
33 FreshnessPeriod?
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000034 FinalBlockId?
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000035
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000036ContentType
37+++++++++++
38
Alexander Afanasyeve2800232013-11-27 02:24:14 +000039::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000040
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070041 ContentType ::= CONTENT-TYPE-TYPE TLV-LENGTH
Alexander Afanasyevca58dc22013-12-28 21:04:59 +000042 nonNegativeInteger
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000043
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020044The following ContentTypes are currently defined:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000045
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050046+-----------------+-----------------+--------------------------------------------------------------+
47| ContentType | Assigned number | Description of the content |
48+=================+=================+==============================================================+
49| BLOB | 0 | payload identified by the data name; this is the default |
50| | | ContentType |
51+-----------------+-----------------+--------------------------------------------------------------+
52| LINK | 1 | a list of delegations (see :ref:`link`) |
53+-----------------+-----------------+--------------------------------------------------------------+
54| KEY | 2 | public key |
55+-----------------+-----------------+--------------------------------------------------------------+
56| NACK | 3 | application-level NACK |
57+-----------------+-----------------+--------------------------------------------------------------+
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020058
Alexander Afanasyev9e7af4b2016-09-13 13:14:18 -070059Other ContentType numbers are assigned and maintained in `NDN Packet Specification Wiki <https://redmine.named-data.net/projects/ndn-tlv/wiki/ContentType>`__.
60
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050061.. _FreshnessPeriod:
Alexander Afanasyev9e7af4b2016-09-13 13:14:18 -070062
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000063FreshnessPeriod
64+++++++++++++++
65
Alexander Afanasyeve2800232013-11-27 02:24:14 +000066::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000067
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070068 FreshnessPeriod ::= FRESHNESS-PERIOD-TLV TLV-LENGTH
Alexander Afanasyevca58dc22013-12-28 21:04:59 +000069 nonNegativeInteger
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000070
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050071The optional ``FreshnessPeriod`` indicates how long a node should wait after the arrival of this data before marking it "non-fresh".
Eric Newberry56519862017-02-13 13:26:19 -070072The encoded value is number of milliseconds.
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050073Note that the "non-fresh" data is still valid data; the expiration of ``FreshnessPeriod`` only means that the producer may have produced newer data.
Alexander Afanasyev7455e9b2014-06-25 09:41:08 -070074
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050075If the Data packet carries a ``FreshnessPeriod`` greater than zero, a node should initially consider it "fresh". After the Data has resided in the node for ``FreshnessPeriod`` milliseconds, it will be marked as "non-fresh".
76If the Data does not have a ``FreshnessPeriod`` or if it has a ``FreshnessPeriod`` equal to zero, it MUST be immediately marked "non-fresh".
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000077
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050078If an Interest contains ``MustBeFresh`` element, a node MUST NOT return "non-fresh" Data in response to this Interest.
79The effect is the same as if that "non-fresh" Data did not exist (i.e., the Interest might be matched by some other Data in the store, or, failing that, get forwarded to other nodes).
80When an exact duplicate of the "non-fresh" Data packet with a positive ``FreshnessPeriod`` value arrives at the node, the node SHOULD re-mark it as "fresh" for the specified duration.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000081
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000082FinalBlockId
83++++++++++++
84
85::
86
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050087 FinalBlockId ::= FINAL-BLOCK-ID-TYPE TLV-LENGTH
88 NameComponent
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000089
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050090The optional FinalBlockId identifies the final block in a sequence of fragments.
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000091It should be present in the final block itself, and may also be present in other fragments to provide advanced warning of the end to consumers.
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050092The value here should be equal to the last explicit name component of the final block.
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000093
94
Alexander Afanasyeve2800232013-11-27 02:24:14 +000095.. _Content:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000096
97Content
98~~~~~~~
99
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000100::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000101
102 Content ::= CONTENT-TYPE TLV-LENGTH BYTE*
Alexander Afanasyeve9f48512018-01-15 23:44:50 -0500103
104The ``Content`` element can carry any arbitrary sequence of bytes.