blob: 9850bc4d3bddcaa0270b487e4d5c04b4bebedec7 [file] [log] [blame]
Davide Pesavento23e340c2021-12-03 04:52:22 -05001.. _Data:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +00002
3Data Packet
Davide Pesaventoec288fe2022-11-26 18:28:01 -05004===========
Alexander Afanasyeveee8c252013-11-21 23:22:41 +00005
Davide Pesaventoec288fe2022-11-26 18:28:01 -05006The NDN Data packet is a TLV defined as follows::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +00007
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
Davide Pesaventoec288fe2022-11-26 18:28:01 -050021----
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000022
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
Davide Pesaventoec288fe2022-11-26 18:28:01 -050029--------
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000030
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
Davide Pesaventoec288fe2022-11-26 18:28:01 -050039^^^^^^^^^^^
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000040
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+-----------------+-----------------+--------------------------------------------------------------+
Davide Pesaventoec288fe2022-11-26 18:28:01 -050053| LINK | 1 | list of delegations (see :ref:`Link`) |
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050054+-----------------+-----------------+--------------------------------------------------------------+
Davide Pesavento3a74e132022-11-26 22:10:21 -050055| KEY | 2 | public key (see :ref:`Certificate`) |
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050056+-----------------+-----------------+--------------------------------------------------------------+
57| NACK | 3 | application-level NACK |
58+-----------------+-----------------+--------------------------------------------------------------+
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020059
Davide Pesaventoec288fe2022-11-26 18:28:01 -050060Other ContentType numbers are assigned and maintained in the `NDN Packet Specification Wiki <https://redmine.named-data.net/projects/ndn-tlv/wiki/ContentType>`__.
Alexander Afanasyev9e7af4b2016-09-13 13:14:18 -070061
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
Davide Pesaventoec288fe2022-11-26 18:28:01 -050065^^^^^^^^^^^^^^^
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000066
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".
Junxiao Shi933b86d2023-06-02 23:36:55 +000076If the Data does not have a ``FreshnessPeriod`` or if it has a ``FreshnessPeriod`` equal to zero, it MUST be marked "non-fresh" immediately after processing any pending Interests.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000077
Junxiao Shi933b86d2023-06-02 23:36:55 +000078If an Interest contains ``MustBeFresh`` element, a content store 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 content store, or, failing that, get forwarded to other nodes).
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050080When 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
Davide Pesaventoec288fe2022-11-26 18:28:01 -050083^^^^^^^^^^^^
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000084
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
Davide Pesaventoec288fe2022-11-26 18:28:01 -050097-------
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000098
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.
Davide Pesaventoec288fe2022-11-26 18:28:01 -0500104
105
106DataSignature
107-------------
108
109See :ref:`DataSignature`.