Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 1 | .. _Name: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 2 | |
| 3 | Name |
| 4 | ---- |
| 5 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 6 | An NDN Name is a hierarchical name for NDN content, which contains a sequence of name components. |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 7 | |
| 8 | NDN Name Format |
| 9 | ~~~~~~~~~~~~~~~ |
| 10 | |
| 11 | We use a 2-level nested TLV to represent a name. |
| 12 | The Type in the outer TLV indicates this is a Name. |
Alexander Afanasyev | 7feb49c | 2014-03-14 17:06:58 -0700 | [diff] [blame^] | 13 | All inner TLVs have Type either NameComponent, NumberComponent, or ImplicitSha256DigestComponent, indicating that the name component is a generic name component, number, or implicit digest. |
| 14 | There is no restriction on the Value field in a name component, but empty value is not allowed: |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 15 | |
| 16 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 17 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 18 | Name ::= NAME-TYPE TLV-LENGTH |
| 19 | (NameComponent | NumberComponent | ImplicitSha256DigestComponent)* |
| 20 | |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 21 | NameComponent ::= NAME-COMPONENT-TYPE TLV-LENGTH BYTE+ |
| 22 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 23 | NumberComponent ::= NUMBER-COMPONENT-TYPE TLV-LENGTH |
| 24 | nonNegativeInteger |
| 25 | |
| 26 | ImplicitSha256DigestComponent ::= IMPLICIT-SHA256-DIGEST-COMPONENT TLV-LENGTH(=32) |
| 27 | BYTE{32} |
| 28 | |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 29 | .. % 0 or many name components in name |
| 30 | .. % 0 or many bytes in name component |
| 31 | |
| 32 | |
Alexander Afanasyev | 7feb49c | 2014-03-14 17:06:58 -0700 | [diff] [blame^] | 33 | ``NameComponent`` is a generic name component, containing any application defined value. |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 34 | |
Alexander Afanasyev | 7feb49c | 2014-03-14 17:06:58 -0700 | [diff] [blame^] | 35 | ``NumberComponent`` is a component that carries a non-negative integer. |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 36 | |
| 37 | ``ImplicitSha256DigestComponent`` is an implicit SHA256 digest component. |
| 38 | |
| 39 | |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 40 | NDN URI Scheme |
| 41 | ~~~~~~~~~~~~~~ |
| 42 | |
| 43 | For textual representation, it is often convenient to use URI to represent NDN names. |
| 44 | Please refer to RFC 3986 (URI Generic Syntax) for background. |
| 45 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 46 | - The scheme identifier is ``ndn``. |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 47 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 48 | - Component types have the following URI representations: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 49 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 50 | * ``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 (-). |
Alexander Afanasyev | 7feb49c | 2014-03-14 17:06:58 -0700 | [diff] [blame^] | 54 | All other characters are escaped using either the percent-encoding method of the URI Generic Syntax. |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 55 | |
Alexander Afanasyev | 7feb49c | 2014-03-14 17:06:58 -0700 | [diff] [blame^] | 56 | To unambiguously represent name components that would collide with the use of . and .. for relative URIs, any component that consists solely of one or more periods is encoded using three additional periods. |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 57 | |
| 58 | * ``NumberComponent`` |
| 59 | |
Alexander Afanasyev | 7feb49c | 2014-03-14 17:06:58 -0700 | [diff] [blame^] | 60 | Number components start with ``number=`` prefix (case sensitive), following with textual representation of the number. |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 61 | For example, ``number=10`` represents a NumberComponent with encoded value of 10. |
Alexander Afanasyev | 7feb49c | 2014-03-14 17:06:58 -0700 | [diff] [blame^] | 62 | The number must be decimal and should be without leading zeros. |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 63 | |
| 64 | * ``ImplicitSha256DigestComponent`` |
| 65 | |
Alexander Afanasyev | 7feb49c | 2014-03-14 17:06:58 -0700 | [diff] [blame^] | 66 | Implicit SHA256 digest component starts with ``sha256digest=`` prefix (case sensitive), following the digest represented as a sequence of 32 hexadecimal numbers. |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 67 | For example, ``sha256digest=893259d98aca58c451453f29ec7dc38688e690dd0b59ef4f3b9d33738bff0b8d`` |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 68 | |
| 69 | - The authority component (the part after the initial ``//`` in the familiar http and ftp URI schemes) is not relevant to NDN. |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 70 | It should not be present, and it is ignored if it is present. |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 71 | |
| 72 | Implicit Digest Component |
| 73 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 74 | |
| 75 | The Name of every piece of content includes as its final component a derived digest that ultimately makes the name unique. |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 76 | This digest may occur in an Interest Name as an ``ImplicitSha256DigestComponent`` and MUST appear as the last component in the name. |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 77 | This final component in the name is never included explicitly in the Data packet when it is transmitted on the wire. |
| 78 | It can be computed by any node based on the Data packet content. |
| 79 | |
| 80 | The **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: |
| 81 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 82 | - Identify one specific Data packet and no other. |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 83 | |
| 84 | - Exclude a specific Data packet in an Interest (independent from whether it has a valid signature). |
| 85 | |
| 86 | Canonical Order |
| 87 | ~~~~~~~~~~~~~~~ |
| 88 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 89 | In several contexts in NDN packet processing, it is useful to have a consistent ordering of names and name components. |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 90 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 91 | The order between individual name components is defined as follows: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 92 | |
Alexander Afanasyev | 7feb49c | 2014-03-14 17:06:58 -0700 | [diff] [blame^] | 93 | - Any ``ImplicitSha256DigestComponent`` is less than any ``NumberComponent``, which is less than any ``NameComponent`` |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 94 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 95 | :: |
| 96 | |
| 97 | ImplicitSha256DigestComponent < NumberComponent < NameComponent |
| 98 | |
| 99 | - The order for the same type components is such that: |
| 100 | |
| 101 | * If *a* is shorter than *b* (i.e., has fewer bytes), then *a* comes before *b*. |
| 102 | |
| 103 | * If *a* and *b* have the same length, then they are compared in ASCII lexicographic order (e.g., ordering based on memcmp() operation.) |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 104 | |
| 105 | For Names, the ordering is just based on the ordering of the first component where they differ. |
| 106 | If one name is a proper prefix of the other, then it comes first. |
| 107 | |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 108 | .. |
| 109 | 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. |
| 110 | |
| 111 | |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 112 | Changes from CCNx |
| 113 | ~~~~~~~~~~~~~~~~~ |
| 114 | |
| 115 | - The name encoding is changed from binary XML to TLV format. |
| 116 | |
| 117 | - 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 |
| 118 | |
| 119 | .. (\cite{NamingConvention}). |
| 120 | |
| 121 | - Deprecated zero-length name component. |
Alexander Afanasyev | 1ac3346 | 2014-03-14 15:27:07 -0700 | [diff] [blame] | 122 | |
| 123 | - Number and implicit digest use dedicate TLV types |