blob: eba092c9591d1425104d838aa05689d6164cca34 [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
8 Data ::= DATA-TLV TLV-LENGTH
9 Name
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050010 MetaInfo?
11 Content?
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000012 Signature
13
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
16Name
17~~~~
18
Alexander Afanasyeve2800232013-11-27 02:24:14 +000019See :ref:`Name section <Name>` for details.
20
21.. _MetaInfo:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000022
23MetaInfo
24~~~~~~~~
25
Alexander Afanasyeve2800232013-11-27 02:24:14 +000026::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000027
28 MetaInfo ::= META-INFO-TYPE TLV-LENGTH
29 ContentType?
30 FreshnessPeriod?
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000031 FinalBlockId?
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000032
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000033ContentType
34+++++++++++
35
Alexander Afanasyeve2800232013-11-27 02:24:14 +000036::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000037
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070038 ContentType ::= CONTENT-TYPE-TYPE TLV-LENGTH
Alexander Afanasyevca58dc22013-12-28 21:04:59 +000039 nonNegativeInteger
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000040
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020041The following ContentTypes are currently defined:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000042
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050043+-----------------+-----------------+--------------------------------------------------------------+
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 Afanasyev6b60ddd2015-11-13 00:18:58 +020055
Alexander Afanasyev9e7af4b2016-09-13 13:14:18 -070056Other ContentType numbers are assigned and maintained in `NDN Packet Specification Wiki <https://redmine.named-data.net/projects/ndn-tlv/wiki/ContentType>`__.
57
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050058.. _FreshnessPeriod:
Alexander Afanasyev9e7af4b2016-09-13 13:14:18 -070059
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000060FreshnessPeriod
61+++++++++++++++
62
Alexander Afanasyeve2800232013-11-27 02:24:14 +000063::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000064
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070065 FreshnessPeriod ::= FRESHNESS-PERIOD-TLV TLV-LENGTH
Alexander Afanasyevca58dc22013-12-28 21:04:59 +000066 nonNegativeInteger
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000067
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050068The 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 -070069The encoded value is number of milliseconds.
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050070Note 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 -070071
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050072If 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".
73If 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 +000074
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050075If an Interest contains ``MustBeFresh`` element, a node MUST NOT return "non-fresh" Data in response to this Interest.
76The 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).
77When 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 +000078
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000079FinalBlockId
80++++++++++++
81
82::
83
Alexander Afanasyeve9f48512018-01-15 23:44:50 -050084 FinalBlockId ::= FINAL-BLOCK-ID-TYPE TLV-LENGTH
85 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
99 Content ::= CONTENT-TYPE TLV-LENGTH BYTE*
Alexander Afanasyeve9f48512018-01-15 23:44:50 -0500100
101The ``Content`` element can carry any arbitrary sequence of bytes.