blob: 922bb1cdd568e90bb9e36e8b9339d6c819d2cf06 [file] [log] [blame]
Alexander Afanasyeve2800232013-11-27 02:24:14 +00001.. _Name:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +00002
3Name
4----
5
Alexander Afanasyev1ac33462014-03-14 15:27:07 -07006An NDN Name is a hierarchical name for NDN content, which contains a sequence of name components.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +00007
8NDN Name Format
9~~~~~~~~~~~~~~~
10
11We use a 2-level nested TLV to represent a name.
12The Type in the outer TLV indicates this is a Name.
13All inner TLVs have the same Type indicating that they each contain a name component.
Alexander Afanasyeve2800232013-11-27 02:24:14 +000014There is no restriction on the Value field in a name component and it may not contain any bytes:
15
16::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000017
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070018 Name ::= NAME-TYPE TLV-LENGTH
19 (NameComponent | NumberComponent | ImplicitSha256DigestComponent)*
20
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000021 NameComponent ::= NAME-COMPONENT-TYPE TLV-LENGTH BYTE+
22
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070023 NumberComponent ::= NUMBER-COMPONENT-TYPE TLV-LENGTH
24 nonNegativeInteger
25
26 ImplicitSha256DigestComponent ::= IMPLICIT-SHA256-DIGEST-COMPONENT TLV-LENGTH(=32)
27 BYTE{32}
28
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000029.. % 0 or many name components in name
30.. % 0 or many bytes in name component
31
32
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070033``NameComponent`` is a generic name component, containing any application defined data.
34
35``NumberComponent`` is a component that carries non-negative integer.
36
37``ImplicitSha256DigestComponent`` is an implicit SHA256 digest component.
38
39
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000040NDN URI Scheme
41~~~~~~~~~~~~~~
42
43For textual representation, it is often convenient to use URI to represent NDN names.
44Please refer to RFC 3986 (URI Generic Syntax) for background.
45
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070046- The scheme identifier is ``ndn``.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000047
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070048- Component types have the following URI representations:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000049
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070050 * ``NameComponent``
51
52 When producing a URI from an NDN Name, only the generic URI unreserved characters are left unescaped.
53 These are the US-ASCII upper and lower case letters (A-Z, a-z), digits (0-9), and the four specials PLUS (+), PERIOD (.), UNDERSCORE (\_), and HYPHEN (-).
54 All other characters are escaped using either the percent-encoding method of the URI Generic Syntax or a ``ndn`` scheme specific hexadecimal string escape starting with the EQUALS (=) and an even number of characters from the set of hex digits.
55 Once an EQUALS has been encountered in a component the hexadecimal encoding persists until the end of the component.
56 The hex digits in these escaped encodings should always use upper-case letters, i.e., A-Z.
57
58 To unambiguously represent name components that would collide with the use of . and .. for relative URIs, any component that consists solely of zero or more periods is encoded using three additional periods.
59
60 * ``NumberComponent``
61
62 Number components start with ``number=`` prefix, following with textual representation of the number.
63 For example, ``number=10`` represents a NumberComponent with encoded value of 10.
64
65 * ``ImplicitSha256DigestComponent``
66
67 Implicit SHA256 digest component starts with ``sha256digest=`` prefix, following the digest represented as a sequence of 32 hexadecimal numbers.
68 For example, ``sha256digest=893259d98aca58c451453f29ec7dc38688e690dd0b59ef4f3b9d33738bff0b8d``
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000069
70- The authority component (the part after the initial ``//`` in the familiar http and ftp URI schemes) is not relevant to NDN.
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070071 It should not be present, and it is ignored if it is present.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000072
73Implicit Digest Component
74~~~~~~~~~~~~~~~~~~~~~~~~~
75
76The Name of every piece of content includes as its final component a derived digest that ultimately makes the name unique.
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070077This digest may occur in an Interest Name as an ``ImplicitSha256DigestComponent`` and MUST appear as the last component in the name.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000078This final component in the name is never included explicitly in the Data packet when it is transmitted on the wire.
79It can be computed by any node based on the Data packet content.
80
81The **implicit digest component** consists of the SHA-256 digest of the entire Data packet without the signature component. Having this digest as the last name component enables us to achieve the following two goals:
82
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070083- Identify one specific Data packet and no other.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000084
85- Exclude a specific Data packet in an Interest (independent from whether it has a valid signature).
86
87Canonical Order
88~~~~~~~~~~~~~~~
89
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070090In several contexts in NDN packet processing, it is useful to have a consistent ordering of names and name components.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000091
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070092The order between individual name components is defined as follows:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000093
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070094- Any ``ImplicitSha256DigestComponent`` less than any ``NumberComponent``, which is less than any ``NameComponent``
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000095
Alexander Afanasyev1ac33462014-03-14 15:27:07 -070096::
97
98 ImplicitSha256DigestComponent < NumberComponent < NameComponent
99
100- The order for the same type components is such that:
101
102 * If *a* is shorter than *b* (i.e., has fewer bytes), then *a* comes before *b*.
103
104 * If *a* and *b* have the same length, then they are compared in ASCII lexicographic order (e.g., ordering based on memcmp() operation.)
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000105
106For Names, the ordering is just based on the ordering of the first component where they differ.
107If one name is a proper prefix of the other, then it comes first.
108
Alexander Afanasyev1ac33462014-03-14 15:27:07 -0700109..
110 While the above defines generic order of any NDN names, :ref:`Interest selector <Selectors>` ``ChildSelector`` does not take into account the implicit digest componen, unless all other components are equal.
111
112
Alexander Afanasyeveee8c252013-11-21 23:22:41 +0000113Changes from CCNx
114~~~~~~~~~~~~~~~~~
115
116- The name encoding is changed from binary XML to TLV format.
117
118- The discussions on naming conventions and the use of special markers inside NameComponents are removed from packet specification, and will be covered by a separate technical document
119
120.. (\cite{NamingConvention}).
121
122- Deprecated zero-length name component.
Alexander Afanasyev1ac33462014-03-14 15:27:07 -0700123
124- Number and implicit digest use dedicate TLV types