Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 1 | .. _data: |
| 2 | |
| 3 | Data Packet |
| 4 | ----------- |
| 5 | |
| 6 | NDN Data packet is TLV defined as follows:: |
| 7 | |
| 8 | Data ::= DATA-TLV TLV-LENGTH |
| 9 | Name |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 10 | MetaInfo? |
| 11 | Content? |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 12 | Signature |
| 13 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 14 | The 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 Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 15 | |
| 16 | Name |
| 17 | ~~~~ |
| 18 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 19 | See :ref:`Name section <Name>` for details. |
| 20 | |
| 21 | .. _MetaInfo: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 22 | |
| 23 | MetaInfo |
| 24 | ~~~~~~~~ |
| 25 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 26 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 27 | |
| 28 | MetaInfo ::= META-INFO-TYPE TLV-LENGTH |
| 29 | ContentType? |
| 30 | FreshnessPeriod? |
Alexander Afanasyev | 08f39ce | 2014-02-12 19:53:50 +0000 | [diff] [blame] | 31 | FinalBlockId? |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 32 | |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 33 | ContentType |
| 34 | +++++++++++ |
| 35 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 36 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 37 | |
Alexander Afanasyev | a6fc727 | 2014-06-13 11:58:06 -0700 | [diff] [blame] | 38 | ContentType ::= CONTENT-TYPE-TYPE TLV-LENGTH |
Alexander Afanasyev | ca58dc2 | 2013-12-28 21:04:59 +0000 | [diff] [blame] | 39 | nonNegativeInteger |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 40 | |
Alexander Afanasyev | 6b60ddd | 2015-11-13 00:18:58 +0200 | [diff] [blame] | 41 | The following ContentTypes are currently defined: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 42 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 43 | +-----------------+-----------------+--------------------------------------------------------------+ |
| 44 | | ContentType | Assigned number | Description of the content | |
| 45 | +=================+=================+==============================================================+ |
| 46 | | BLOB | 0 | payload identified by the data name; this is the default | |
| 47 | | | | ContentType | |
| 48 | +-----------------+-----------------+--------------------------------------------------------------+ |
| 49 | | LINK | 1 | a list of delegations (see :ref:`link`) | |
| 50 | +-----------------+-----------------+--------------------------------------------------------------+ |
| 51 | | KEY | 2 | public key | |
| 52 | +-----------------+-----------------+--------------------------------------------------------------+ |
| 53 | | NACK | 3 | application-level NACK | |
| 54 | +-----------------+-----------------+--------------------------------------------------------------+ |
Alexander Afanasyev | 6b60ddd | 2015-11-13 00:18:58 +0200 | [diff] [blame] | 55 | |
Alexander Afanasyev | 9e7af4b | 2016-09-13 13:14:18 -0700 | [diff] [blame] | 56 | Other ContentType numbers are assigned and maintained in `NDN Packet Specification Wiki <https://redmine.named-data.net/projects/ndn-tlv/wiki/ContentType>`__. |
| 57 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 58 | .. _FreshnessPeriod: |
Alexander Afanasyev | 9e7af4b | 2016-09-13 13:14:18 -0700 | [diff] [blame] | 59 | |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 60 | FreshnessPeriod |
| 61 | +++++++++++++++ |
| 62 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 63 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 64 | |
Alexander Afanasyev | a6fc727 | 2014-06-13 11:58:06 -0700 | [diff] [blame] | 65 | FreshnessPeriod ::= FRESHNESS-PERIOD-TLV TLV-LENGTH |
Alexander Afanasyev | ca58dc2 | 2013-12-28 21:04:59 +0000 | [diff] [blame] | 66 | nonNegativeInteger |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 67 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 68 | 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] | 69 | The encoded value is number of milliseconds. |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 70 | 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] | 71 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 72 | 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". |
| 73 | 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] | 74 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 75 | If an Interest contains ``MustBeFresh`` element, a node MUST NOT return "non-fresh" Data in response to this Interest. |
| 76 | 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). |
| 77 | 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] | 78 | |
Alexander Afanasyev | 08f39ce | 2014-02-12 19:53:50 +0000 | [diff] [blame] | 79 | FinalBlockId |
| 80 | ++++++++++++ |
| 81 | |
| 82 | :: |
| 83 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 84 | FinalBlockId ::= FINAL-BLOCK-ID-TYPE TLV-LENGTH |
| 85 | NameComponent |
Alexander Afanasyev | 08f39ce | 2014-02-12 19:53:50 +0000 | [diff] [blame] | 86 | |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 87 | The optional FinalBlockId identifies the final block in a sequence of fragments. |
Alexander Afanasyev | 08f39ce | 2014-02-12 19:53:50 +0000 | [diff] [blame] | 88 | 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^] | 89 | 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] | 90 | |
| 91 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 92 | .. _Content: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 93 | |
| 94 | Content |
| 95 | ~~~~~~~ |
| 96 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 97 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 98 | |
| 99 | Content ::= CONTENT-TYPE TLV-LENGTH BYTE* |
Alexander Afanasyev | e9f4851 | 2018-01-15 23:44:50 -0500 | [diff] [blame^] | 100 | |
| 101 | The ``Content`` element can carry any arbitrary sequence of bytes. |