blob: b06d4f13aab7f0b5c76007792d4613b6f30a5c90 [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
mzhang4333f2c22015-02-20 17:30:17 -060035Compared with CCNx, three fields are removed: PublisherPublicKeyDigest, ExtOpt, and Timestamp for the following reasons.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000036
37
38- PublisherPublicKeyDigest is supposed to be used in selecting data packets signed by a particular key.
Alexander Afanasyeve2800232013-11-27 02:24:14 +000039 We replace PublisherPublicKeyDigest with KeyLocator, which is part of the Signature block (see :ref:`Signature Section <Signature>`), due to the following consideration.
Alexander Afanasyev7455e9b2014-06-25 09:41:08 -070040 First, PublisherPublicKeyDigest requires data consumer to acquire a *valid* public key, as opposed to the key locator, before sending the Interest out.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000041 Second, if a router is to verify the content objects, it must have other means to locate the keys first.
Alexander Afanasyev7455e9b2014-06-25 09:41:08 -070042 Further, PublisherPublicKeyDigest may require publishers to maintain their public keys and certificates by their public key digests instead of names.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000043
44- ExtOpt was intended for extending XML-based ccnb format. Since we are now using TLV, ExtOpt is no longer needed.
45
mzhang4333f2c22015-02-20 17:30:17 -060046- Timestamp can be useful meta information for applications, but does not need to be processed at the network layer.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000047 Therefore, if desired, applications should encode such meta information as part of the content.
48
49
50ContentType
51+++++++++++
52
Alexander Afanasyeve2800232013-11-27 02:24:14 +000053::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000054
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070055 ContentType ::= CONTENT-TYPE-TYPE TLV-LENGTH
Alexander Afanasyevca58dc22013-12-28 21:04:59 +000056 nonNegativeInteger
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000057
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020058The following ContentTypes are currently defined:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000059
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020060+-----------------+----------------+--------------------------------------------------------------+
61| ContentType | Assigned value | Description of the content |
62+=================+================+==============================================================+
63| BLOB | 0 | payload identified by the data name; this is the default |
64| | | ContentType |
65+-----------------+----------------+--------------------------------------------------------------+
66| LINK | 1 | another name which identifies the actual data content |
67+-----------------+----------------+--------------------------------------------------------------+
68| KEY | 2 | public key |
69+-----------------+----------------+--------------------------------------------------------------+
70| NACK | 3 | application-level NACK |
71+-----------------+----------------+--------------------------------------------------------------+
72
73Compared with CCNx, ENCR and GONE types are removed.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000074ENCR means the content is encrypted, and since the network layer should not care whether content is encrypted or not, this type is not needed.
Alexander Afanasyev6b60ddd2015-11-13 00:18:58 +020075GONE was a placeholder for implementing cache purging, however the research is yet to be carried out on how to accomplish this goal, if it is feasible to achieve, it is not included in this version of NDN specification.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000076
77
78FreshnessPeriod
79+++++++++++++++
80
Alexander Afanasyeve2800232013-11-27 02:24:14 +000081::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000082
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070083 FreshnessPeriod ::= FRESHNESS-PERIOD-TLV TLV-LENGTH
Alexander Afanasyevca58dc22013-12-28 21:04:59 +000084 nonNegativeInteger
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000085
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070086The optional FreshnessPeriod indicates how long a node should wait after the arrival of this data before marking it as stale. The encoded value is number of milliseconds. Note that the stale data is still valid data; the expiration of FreshnessPeriod only means that the producer may have produced newer data.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000087
Alexander Afanasyev7455e9b2014-06-25 09:41:08 -070088When FreshnessPeriod is omitted, the Data packet cannot be marked stale.
89
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000090Each content store associates every piece of Data with a staleness bit.
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070091The initial setting of this bit for newly-arrived content is "not stale". If the Data carries FreshnessPeriod, then after the Data has been residing in the content store for FreshnessPeriod, it will be marked as stale. This is per object staleness and local to the NDN node. Another possible way to set the staleness bit of a local content is for a local client to send a command to the local NDN daemon.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000092
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -070093If an Interest contains MustBeFresh TLV, a Data that has the staleness bit set is not eligible to be sent in response to that Interest.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000094The 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).
95If an exact duplicate of a stale Data arrives, the effect is the same as if the stale Data had not been present. In particular, the Data in the store is no longer stale. As a practical matter, a stale Data should be ranked high on the list of things to discard from the store when a storage quota has been reached.
96
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +000097FinalBlockId
98++++++++++++
99
100::
101
Alexander Afanasyeva6fc7272014-06-13 11:58:06 -0700102 FinalBlockId ::= FINAL-BLOCK-ID-TLV TLV-LENGTH
Alexander Afanasyev08f39ce2014-02-12 19:53:50 +0000103 NameComponent
104
105The optional FinalBlockId indicates the identifier of the final block
106in a sequence of fragments.
107It 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.
108The value here should be equal to the last explicit Name Component of the final block.
109
110
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000111.. _Content:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000112
113Content
114~~~~~~~
115
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000116::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000117
118 Content ::= CONTENT-TYPE TLV-LENGTH BYTE*