Davide Pesavento | 23e340c | 2021-12-03 04:52:22 -0500 | [diff] [blame] | 1 | .. _Data: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 2 | |
| 3 | Data Packet |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 4 | =========== |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 5 | |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 6 | The NDN Data packet is a TLV defined as follows:: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 7 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 8 | Data = DATA-TYPE TLV-LENGTH |
| 9 | Name |
| 10 | [MetaInfo] |
| 11 | [Content] |
| 12 | DataSignature |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 13 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 14 | The 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 Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 15 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 16 | As recommended by the :ref:`TLV evolvability guidelines <evolvability>`, unrecognized non-critical TLV elements may appear in a Data packet. |
Junxiao Shi | 707ea00 | 2018-07-17 15:42:52 -0400 | [diff] [blame] | 17 | However, they must not appear before the ``Name`` element. |
| 18 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 19 | |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 20 | Name |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 21 | ---- |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 22 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 23 | See :ref:`Name`. |
| 24 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 25 | |
| 26 | .. _MetaInfo: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 27 | |
| 28 | MetaInfo |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 29 | -------- |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 30 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 31 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 32 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 33 | MetaInfo = META-INFO-TYPE TLV-LENGTH |
| 34 | [ContentType] |
| 35 | [FreshnessPeriod] |
| 36 | [FinalBlockId] |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 37 | |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 38 | ContentType |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 39 | ^^^^^^^^^^^ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 40 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 41 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 42 | |
Davide Pesavento | f9353df | 2020-06-21 19:19:56 -0400 | [diff] [blame] | 43 | ContentType = CONTENT-TYPE-TYPE TLV-LENGTH NonNegativeInteger |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 44 | |
Alexander Afanasyev | 6b60ddd | 2015-11-13 00:18:58 +0200 | [diff] [blame] | 45 | The following ContentTypes are currently defined: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 46 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 47 | +-----------------+-----------------+--------------------------------------------------------------+ |
| 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 Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 53 | | LINK | 1 | list of delegations (see :ref:`Link`) | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 54 | +-----------------+-----------------+--------------------------------------------------------------+ |
Davide Pesavento | 3a74e13 | 2022-11-26 22:10:21 -0500 | [diff] [blame] | 55 | | KEY | 2 | public key (see :ref:`Certificate`) | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 56 | +-----------------+-----------------+--------------------------------------------------------------+ |
| 57 | | NACK | 3 | application-level NACK | |
| 58 | +-----------------+-----------------+--------------------------------------------------------------+ |
Alexander Afanasyev | 6b60ddd | 2015-11-13 00:18:58 +0200 | [diff] [blame] | 59 | |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 60 | Other ContentType numbers are assigned and maintained in the `NDN Packet Specification Wiki <https://redmine.named-data.net/projects/ndn-tlv/wiki/ContentType>`__. |
Alexander Afanasyev | 9e7af4b | 2016-09-13 13:14:18 -0700 | [diff] [blame] | 61 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 62 | .. _FreshnessPeriod: |
Alexander Afanasyev | 9e7af4b | 2016-09-13 13:14:18 -0700 | [diff] [blame] | 63 | |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 64 | FreshnessPeriod |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 65 | ^^^^^^^^^^^^^^^ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 66 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 67 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 68 | |
Davide Pesavento | f9353df | 2020-06-21 19:19:56 -0400 | [diff] [blame] | 69 | FreshnessPeriod = FRESHNESS-PERIOD-TYPE TLV-LENGTH NonNegativeInteger |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 70 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 71 | The optional ``FreshnessPeriod`` indicates how long a node should wait after the arrival of this data before marking it "non-fresh". |
Eric Newberry | 5651986 | 2017-02-13 13:26:19 -0700 | [diff] [blame] | 72 | The encoded value is number of milliseconds. |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 73 | Note that the "non-fresh" data is still valid data; the expiration of ``FreshnessPeriod`` only means that the producer may have produced newer data. |
Alexander Afanasyev | 7455e9b | 2014-06-25 09:41:08 -0700 | [diff] [blame] | 74 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 75 | If 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". |
| 76 | If the Data does not have a ``FreshnessPeriod`` or if it has a ``FreshnessPeriod`` equal to zero, it MUST be immediately marked "non-fresh". |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 77 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 78 | If an Interest contains ``MustBeFresh`` element, a node MUST NOT return "non-fresh" Data in response to this Interest. |
| 79 | The 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). |
| 80 | When 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 Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 81 | |
Alexander Afanasyev | 08f39ce | 2014-02-12 19:53:50 +0000 | [diff] [blame] | 82 | FinalBlockId |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 83 | ^^^^^^^^^^^^ |
Alexander Afanasyev | 08f39ce | 2014-02-12 19:53:50 +0000 | [diff] [blame] | 84 | |
| 85 | :: |
| 86 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 87 | FinalBlockId = FINAL-BLOCK-ID-TYPE TLV-LENGTH NameComponent |
Alexander Afanasyev | 08f39ce | 2014-02-12 19:53:50 +0000 | [diff] [blame] | 88 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 89 | The optional FinalBlockId identifies the final block in a sequence of fragments. |
Alexander Afanasyev | 08f39ce | 2014-02-12 19:53:50 +0000 | [diff] [blame] | 90 | It 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 Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 91 | The value here should be equal to the last explicit name component of the final block. |
Alexander Afanasyev | 08f39ce | 2014-02-12 19:53:50 +0000 | [diff] [blame] | 92 | |
| 93 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 94 | .. _Content: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 95 | |
| 96 | Content |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 97 | ------- |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 98 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 99 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 100 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 101 | Content = CONTENT-TYPE TLV-LENGTH *OCTET |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame] | 102 | |
| 103 | The ``Content`` element can carry any arbitrary sequence of bytes. |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 104 | |
| 105 | |
| 106 | DataSignature |
| 107 | ------------- |
| 108 | |
| 109 | See :ref:`DataSignature`. |