blob: b2251312e3acd98e20a69ff20eaf2f1ac0b206c3 [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
Junxiao Shi78ce2952019-05-07 15:34:00 -04008 Data = DATA-TYPE TLV-LENGTH
9 Name
10 [MetaInfo]
11 [Content]
12 DataSignature
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000013
Davide Pesavento3c0bc312020-05-18 22:03:09 -040014The Data packet represents some arbitrary binary data (held in the optional :ref:`Content` element) together with its ``Name``, some additional bits of optional information (:ref:`MetaInfo`), and a digital signature (:ref:`DataSignature <DataSignature>`).
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000015
Davide Pesavento3c0bc312020-05-18 22:03:09 -040016As recommended by the :ref:`TLV evolvability guidelines <evolvability>`, unrecognized non-critical TLV elements may appear in a Data packet.
Junxiao Shi707ea002018-07-17 15:42:52 -040017However, they must not appear before the ``Name`` element.
18
Davide Pesavento3c0bc312020-05-18 22:03:09 -040019
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000020Name
21~~~~
22
Davide Pesavento3c0bc312020-05-18 22:03:09 -040023See :ref:`Name`.
24
Alexander Afanasyeve2800232013-11-27 02:24:14 +000025
26.. _MetaInfo:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000027
28MetaInfo
29~~~~~~~~
30
Alexander Afanasyeve2800232013-11-27 02:24:14 +000031::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000032
Junxiao Shi78ce2952019-05-07 15:34:00 -040033 MetaInfo = META-INFO-TYPE TLV-LENGTH
34 [ContentType]
35 [FreshnessPeriod]
36 [FinalBlockId]
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000037
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000038ContentType
39+++++++++++
40
Alexander Afanasyeve2800232013-11-27 02:24:14 +000041::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000042
Davide Pesaventof9353df2020-06-21 19:19:56 -040043 ContentType = CONTENT-TYPE-TYPE TLV-LENGTH NonNegativeInteger
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000044
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020045The following ContentTypes are currently defined:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000046
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050047+-----------------+-----------------+--------------------------------------------------------------+
48| ContentType | Assigned number | Description of the content |
49+=================+=================+==============================================================+
50| BLOB | 0 | payload identified by the data name; this is the default |
51| | | ContentType |
52+-----------------+-----------------+--------------------------------------------------------------+
53| LINK | 1 | a list of delegations (see :ref:`link`) |
54+-----------------+-----------------+--------------------------------------------------------------+
55| KEY | 2 | public key |
56+-----------------+-----------------+--------------------------------------------------------------+
57| NACK | 3 | application-level NACK |
58+-----------------+-----------------+--------------------------------------------------------------+
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020059
Alexander Afanasyev9e7af4b2016-09-13 13:14:18 -070060Other ContentType numbers are assigned and maintained in `NDN Packet Specification Wiki <https://redmine.named-data.net/projects/ndn-tlv/wiki/ContentType>`__.
61
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050062.. _FreshnessPeriod:
Alexander Afanasyev9e7af4b2016-09-13 13:14:18 -070063
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000064FreshnessPeriod
65+++++++++++++++
66
Alexander Afanasyeve2800232013-11-27 02:24:14 +000067::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000068
Davide Pesaventof9353df2020-06-21 19:19:56 -040069 FreshnessPeriod = FRESHNESS-PERIOD-TYPE TLV-LENGTH 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
Junxiao Shi78ce2952019-05-07 15:34:00 -040087 FinalBlockId = FINAL-BLOCK-ID-TYPE TLV-LENGTH NameComponent
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000088
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050089The optional FinalBlockId identifies the final block in a sequence of fragments.
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000090It 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 -050091The value here should be equal to the last explicit name component of the final block.
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000092
93
Alexander Afanasyeve2800232013-11-27 02:24:14 +000094.. _Content:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000095
96Content
97~~~~~~~
98
Alexander Afanasyeve2800232013-11-27 02:24:14 +000099::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000100
Junxiao Shi78ce2952019-05-07 15:34:00 -0400101 Content = CONTENT-TYPE TLV-LENGTH *OCTET
Alexander Afanasyeve9f48512018-01-15 23:44:50 -0500102
103The ``Content`` element can carry any arbitrary sequence of bytes.