blob: 7b1e5b84749e44bb7023dce57c51f997903e7e27 [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
10 MetaInfo
11 Content
12 Signature
13
14The Data packet represents some arbitrary binary data (held in the Content element) together with its Name, some additional bits of information (MetaInfo), and a digital Signature of the other three elements. 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.
15
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
mzhang4333f2c22015-02-20 17:30:17 -060026.. [#f1] If ``ContentType``, ``FreshnessPeriod`` and ``FinalBlockId`` are optional, one may consider ``Metainfo`` itself should be optional. But would having all 4 parts of Data packet help simplify implementation? We leave this question to people who are more familiar with high speed implementations.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000027
Alexander Afanasyeve2800232013-11-27 02:24:14 +000028::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000029
30 MetaInfo ::= META-INFO-TYPE TLV-LENGTH
31 ContentType?
32 FreshnessPeriod?
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000033 FinalBlockId?
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000034
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000035ContentType
36+++++++++++
37
Alexander Afanasyeve2800232013-11-27 02:24:14 +000038::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000039
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070040 ContentType ::= CONTENT-TYPE-TYPE TLV-LENGTH
Alexander Afanasyevca58dc22013-12-28 21:04:59 +000041 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 Afanasyev6b60ddd2015-11-13 00:18:58 +020045+-----------------+----------------+--------------------------------------------------------------+
46| ContentType | Assigned value | Description of the content |
47+=================+================+==============================================================+
48| BLOB | 0 | payload identified by the data name; this is the default |
49| | | ContentType |
50+-----------------+----------------+--------------------------------------------------------------+
spirosmastorakis988e7412016-10-27 14:01:59 -070051| LINK | 1 | a list of delegations (see :ref:`link`) |
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020052+-----------------+----------------+--------------------------------------------------------------+
53| KEY | 2 | public key |
54+-----------------+----------------+--------------------------------------------------------------+
55| NACK | 3 | application-level NACK |
56+-----------------+----------------+--------------------------------------------------------------+
57
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
60
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000061FreshnessPeriod
62+++++++++++++++
63
Alexander Afanasyeve2800232013-11-27 02:24:14 +000064::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000065
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070066 FreshnessPeriod ::= FRESHNESS-PERIOD-TLV TLV-LENGTH
Alexander Afanasyevca58dc22013-12-28 21:04:59 +000067 nonNegativeInteger
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000068
Eric Newberry56519862017-02-13 13:26:19 -070069The optional FreshnessPeriod indicates how long a node should wait after the arrival of this data before marking it as stale.
70The encoded value is number of milliseconds.
71Note that the stale 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 Afanasyeveee8c252013-11-21 23:22:41 +000073Each content store associates every piece of Data with a staleness bit.
Eric Newberry56519862017-02-13 13:26:19 -070074If the Data carries a FreshnessPeriod, it will initially be considered "fresh" and, after the Data has resided in the content store for FreshnessPeriod, it will be marked as stale.
75This is per object staleness and is local to the NDN node.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000076
Eric Newberry56519862017-02-13 13:26:19 -070077If an Interest contains MustBeFresh TLV, a content store MUST NOT return Data with the staleness bit set in response to this interest.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000078The effect is the same as if that stale 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).
Eric Newberry56519862017-02-13 13:26:19 -070079When an exact duplicate of the "stale" Data packet, carrying a positive FreshnessPeriod value, is inserted into a content store, the store SHOULD remove the "stale" bit from the cached Data.
80In particular, the Data in the store is no longer stale.
81
82When a content store receives a Data packet without a FreshnessPeriod or with a FreshnessPeriod equal to 0, then it can satisfy an Interest marked MustBeFresh.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000083
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000084FinalBlockId
85++++++++++++
86
87::
88
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070089 FinalBlockId ::= FINAL-BLOCK-ID-TLV TLV-LENGTH
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000090 NameComponent
91
92The optional FinalBlockId indicates the identifier of the final block
93in a sequence of fragments.
94It 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.
95The value here should be equal to the last explicit Name Component of the final block.
96
97
Alexander Afanasyeve2800232013-11-27 02:24:14 +000098.. _Content:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000099
100Content
101~~~~~~~
102
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000103::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000104
105 Content ::= CONTENT-TYPE TLV-LENGTH BYTE*