blob: 7ebd49ebe84d667257405ddd21f34c0b95931a86 [file] [log] [blame]
Alexander Afanasyeve2800232013-11-27 02:24:14 +00001.. _Interest:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +00002
3Interest Packet
4---------------
5
Alexander Afanasyeve2800232013-11-27 02:24:14 +00006NDN Interest packet is TLV defined as follows:
7
8::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +00009
10 Interest ::= INTEREST-TYPE TLV-LENGTH
11 Name
12 Selectors?
13 Nonce
14 Scope?
15 InterestLifetime?
16
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000017``Name`` and ``Nonce`` are the only two two required elements in an Interest packet.
18Selectors are optional elements that further qualify Data that may match the Interest.
19They are used for discovering and selecting the Data that matches best to what the application wants. Selectors are placed right after the Name to facilitate implementations that may use continuous memory block of Name and Selectors TLVs together as the index for PIT lookup. By using a TLV to group all the Selectors, an implementation can easily skip them to find Nonce, which is used together with Name to identify looping Interests.
20If Selectors TLV is present in the Interest, it MUST contain at least one selector.
21
22The two other optional elements, Scope and InterestLifetime, are referred to as *Guiders*.
23They affect Interest forwarding behavior, e.g., how far the Interest may be forwarded, and how long an Interest may be kept in the PIT. They are not grouped.
24
25
26Name
27~~~~
28
Alexander Afanasyeve2800232013-11-27 02:24:14 +000029The Name element in an Interest is synonymous with the term *prefix*.
30See :ref:`Name section <Name>` for details.
31
Alexander Afanasyeve2800232013-11-27 02:24:14 +000032.. _Selectors:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000033
34Selectors
35~~~~~~~~~
Alexander Afanasyeve2800232013-11-27 02:24:14 +000036
37::
38
39 Selectors ::= SELECTORS-TYPE TLV-LENGTH
40 MinSuffixComponents?
41 MaxSuffixComponents?
42 PublisherPublicKeyLocator?
43 Exclude?
44 ChildSelector?
45 MustBeFresh?
46
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000047MinSuffixComponents, MaxSuffixComponents
48++++++++++++++++++++++++++++++++++++++++
49
Alexander Afanasyeve2800232013-11-27 02:24:14 +000050::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000051
52 MinSuffixComponents ::= MIN-SUFFIX-COMPONENTS-TYPE TLV-LENGTH
53 nonNegativeInteger
54
55 MaxSuffixComponents ::= MAX-SUFFIX-COMPONENTS-TYPE TLV-LENGTH
56 nonNegativeInteger
57
58When needed, ``MinSuffixComponents`` and ``MaxSuffixComponents`` allow a data consumer to indicate whether the Name in the Interest is the full name including the digest, or the full name except for the digest, or the content it is seeking has a known range of legitimate component counts.
59These two parameters refer to the number of name components beyond those in the prefix, and counting the implicit digest, that may occur in the matching Data.
60The default for ``MinSuffixComponents`` is 0 and for ``MaxSuffixComponents`` is effectively infinite, meaning that any Data whose name starts with the prefix is a match. Often only one of these will be needed to get the desired effect.
61
62
63PublisherPublicKeyLocator
64+++++++++++++++++++++++++
65
Alexander Afanasyeve2800232013-11-27 02:24:14 +000066::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000067
Alexander Afanasyev23c2e412014-02-12 19:53:48 +000068 PublisherPublicKeyLocator ::= KeyLocator
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000069
70This element specifies the name of the key which is used to sign the Data packet that the consumer is requesting.
71This is a way for the Interest to select answers from a particular publisher.
72
Alexander Afanasyev23c2e412014-02-12 19:53:48 +000073See :ref:`KeyLocator` section for more detail.
74
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000075Exclude
76+++++++
77
Alexander Afanasyeve2800232013-11-27 02:24:14 +000078::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000079
80 Exclude ::= EXCLUDE-TYPE TLV-LENGTH Any? (NameComponent (Any)?)+
81 Any ::= ANY-TYPE TLV-LENGTH(=0)
82
83The ``Exclude`` selectors allows requester to specify list and/or ranges of names components that MUST NOT appear as a continuation of the Name prefix in the responding Data packet to the Interest.
84For example, if Interest is expressed for ``/ndn/edu`` and Exclude specifies one name component ``ucla``, then nor data producer nor conforming NDN routers are allowed to return any Data packet that has prefix ``/ndn/edu/ucla``.
85
86Exclude filter applies only to a name component of the Data packet name that is located at a position that numerically equals to the number of name components in the Interest packet, assuming 0 is the first name component.
87
88The Components in the exclusion list MUST occur in strictly increasing order according to the canonical NDN name component ordering (:ref:`Name Section<name>`), with optional leading, trailing, and interleaved ``Any`` components. The following defines processing of ``Any`` components:
89
90- If none of the ``Any`` components are specified, the filter excludes only to the names specified in the Exclude list.
91
92- If a leading ``Any`` component is specified, then the filter excludes all names that are smaller or equal (in NDN name component canonical ordering) to the first NameComponent in the Exclude list.
93
94- If a trailing ``Any`` component is specified, then the filter excludes all names that are larger or equal (in NDN name component canonical ordering) to the last NameComponent in the Exclude list.
95
96- If ``Any`` component is specified between two NameComponents in the list, then the filter excludes all names from the range from the right NameComponent to the left NameComponent, including both ends.
97
98
Alexander Afanasyeve2800232013-11-27 02:24:14 +000099Exclude filter MUST not consist of a single ``Any`` component or one NameComponent with leading and trailing ``Any`` components.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000100
101
102ChildSelector
103+++++++++++++
104
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000105::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000106
107 ChildSelector ::= CHILD-SELECTOR-TYPE TLV-LENGTH
108 nonNegativeInteger
109
110Often a given Interest can match more than one Data within a given content store.
111The ``ChildSelector`` provides a way of expressing a preference for which of these should be returned.
112If the value is 0, the leftmost child is preferred.
113If 1, the rightmost child is preferred.
114Here leftmost and rightmost refer to the least and greatest components according to the canonical NDN name component ordering (:ref:`Name Section<name>`).
115This ordering is only done at the level of the name hierarchy one past the name prefix.
116
117For example, assuming in the name hierarchy the component immediately after the name prefix is the version number, whose next level is the segment number, then setting ChildSelector to be 1 will retrieve the rightmost version number (i.e., the latest version) and the leftmost segment number (i.e., the first segment). However, this selection is only done with respect to a single content store, not globally. Additional rounds that exclude the earlier versions may be used to explore other content stores for newer versions.
118In this case, the use of ChildSelector does not change the multi-round outcome, but it decreases the number of rounds needed to converge to an answer.
119
120MustBeFresh
121+++++++++++
122
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000123::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000124
125 MustBeFresh ::= MUST-BE-FRESH-TYPE TLV-LENGTH(=0)
126
127This selector is encoded with Type and Length but no Value part.
128When it is absent from an Interest packet, the router can respond with a Data packet from its content store whose FreshnessPeriod is either still valid or expired.
129When it is present in an Interest packet, the router should not return Data packet from its content store whose FreshnessPeriod has expired.
130
131The FreshnessPeriod carried in each Data packet (:ref:`Data Section<data>`) is set by the original producer. It starts counting down when the Data packet arrives at a node. Consequently if a node is N hops away from the original producer, it may not consider the Data stale until N *X* FreshnessPeriod after the Data is produced.
132
Alexander Afanasyevfffabfb2013-12-11 21:29:05 +0000133.. _Nonce:
134
135Nonce
136~~~~~
137
138Nonce defined as follows:
139
140::
141
142 Nonce ::= NONCE-TYPE TLV-LENGTH(=4) BYTE{4}
143
144The Nonce carries a randomly-genenerated 4-octet long byte-string.
145The combination of Name and Nonce should uniquely identify an Interest packet.
146This is used to detect looping Interests.
147
148.. _Guiders:
149
150Guiders
151~~~~~~~
152
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000153Scope
154+++++
155
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000156::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000157
158 Scope ::= SCOPE-TYPE TLV-LENGTH nonNegativeInteger
159
160This value limits how far the Interest may propagate.
161Scope 0 prevents propagation beyond the local NDN daemon (even to other applications on the same host). Scope 1 limits propagation to the applications on the originating host.
162Scope 2 limits propagation to no further than the next node.
163Other values are not defined at this time, and will cause the Interest packet to be dropped.
164
165Note that Scope is not a hop count---the value is not decremented as the Interest is forwarded.
166
167InterestLifetime
168++++++++++++++++
169
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000170::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000171
172 InterestLifetime ::= INTEREST-LIFETIME-TYPE TLV-LENGTH nonNegativeInteger
173
174``InterestLifetime`` indicates the (approximate) time remaining before the Interest times out.
175The value is the number of milliseconds. The timeout is relative to the arrival time of the Interest at the current node.
176
177Nodes that forward Interests may decrease the lifetime to account for the time spent in the node before forwarding, but are not required to do so. It is recommended that these adjustments be done only for relatively large delays (measured in seconds).
178
179It is the application that sets the value for ``InterestLifetime``.
180If the ``InterestLifetime`` element is omitted, a default value of 4 seconds is used (4000).
181The missing element may be added before forwarding.
182
183Changes from CCNx
184~~~~~~~~~~~~~~~~~
185
186- ``Nonce`` is changed from optional to required.
187
188- ``PublisherPublicKeyDigest`` is replaced by ``PublisherPublicKeyLocator``.
189
190- ``AnswerOriginKind`` is simplified from 4bits to a 1-bit ``MustBeFresh``.
191
192- ``FaceID`` has been removed.
193
194- ``InterestLifetime`` changes the unit to the number of milliseconds.
195
196- Removed Bloom Filter from Exclude.
Alexander Afanasyev899585e2014-03-07 10:19:07 +0000197
198- Changed default semantics of staleness.
199
200 Specifically, NDN-TLV Interest without any selectors will bring any data that matches the name, and only when ``MustBeFresh`` selector is enabled it will try to honor freshness, specified in Data packets.
201 With Binary XML encoded Interests, the default behavior was to bring "fresh" data and return "stale" data only when ``AnswerOriginKind`` was set to 3.
202
203 Application developers must be aware of this change, reexamine the Interest expression code, and enable ``MustBeFresh`` selector when necessary.