blob: 66a00c5f28b7f814fd09a73047e0b27e2c7cb280 [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
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
Junxiao Shi78ce2952019-05-07 15:34:00 -040031 MetaInfo = META-INFO-TYPE TLV-LENGTH
32 [ContentType]
33 [FreshnessPeriod]
34 [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
Junxiao Shi78ce2952019-05-07 15:34:00 -040041 ContentType = CONTENT-TYPE-TYPE TLV-LENGTH nonNegativeInteger
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000042
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020043The following ContentTypes are currently defined:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000044
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050045+-----------------+-----------------+--------------------------------------------------------------+
46| ContentType | Assigned number | Description of the content |
47+=================+=================+==============================================================+
48| BLOB | 0 | payload identified by the data name; this is the default |
49| | | ContentType |
50+-----------------+-----------------+--------------------------------------------------------------+
51| LINK | 1 | a list of delegations (see :ref:`link`) |
52+-----------------+-----------------+--------------------------------------------------------------+
53| KEY | 2 | public key |
54+-----------------+-----------------+--------------------------------------------------------------+
55| NACK | 3 | application-level NACK |
56+-----------------+-----------------+--------------------------------------------------------------+
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020057
Alexander Afanasyev9e7af4b2016-09-13 13:14:18 -070058Other ContentType numbers are assigned and maintained in `NDN Packet Specification Wiki <https://redmine.named-data.net/projects/ndn-tlv/wiki/ContentType>`__.
59
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050060.. _FreshnessPeriod:
Alexander Afanasyev9e7af4b2016-09-13 13:14:18 -070061
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000062FreshnessPeriod
63+++++++++++++++
64
Alexander Afanasyeve2800232013-11-27 02:24:14 +000065::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000066
Junxiao Shi78ce2952019-05-07 15:34:00 -040067 FreshnessPeriod = FRESHNESS-PERIOD-TYPE TLV-LENGTH nonNegativeInteger
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000068
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050069The 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 -070070The encoded value is number of milliseconds.
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050071Note 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 -070072
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050073If 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".
74If 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 +000075
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050076If an Interest contains ``MustBeFresh`` element, a node MUST NOT return "non-fresh" Data in response to this Interest.
77The 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).
78When 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 +000079
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000080FinalBlockId
81++++++++++++
82
83::
84
Junxiao Shi78ce2952019-05-07 15:34:00 -040085 FinalBlockId = FINAL-BLOCK-ID-TYPE TLV-LENGTH NameComponent
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000086
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050087The optional FinalBlockId identifies the final block in a sequence of fragments.
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000088It 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 -050089The value here should be equal to the last explicit name component of the final block.
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000090
91
Alexander Afanasyeve2800232013-11-27 02:24:14 +000092.. _Content:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000093
94Content
95~~~~~~~
96
Alexander Afanasyeve2800232013-11-27 02:24:14 +000097::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000098
Junxiao Shi78ce2952019-05-07 15:34:00 -040099 Content = CONTENT-TYPE TLV-LENGTH *OCTET
Alexander Afanasyeve9f48512018-01-15 23:44:50 -0500100
101The ``Content`` element can carry any arbitrary sequence of bytes.