Alexander Afanasyev | bd5b67a | 2014-09-02 16:06:21 -0700 | [diff] [blame] | 1 | .. _packetFormat: |
| 2 | |
| 3 | NDNS Packet format |
| 4 | ================== |
| 5 | |
| 6 | NDNS Query |
| 7 | ---------- |
| 8 | |
| 9 | Requests to the zone are made in the format of a standard NDN interest. |
| 10 | |
| 11 | See `Interest section <http://named-data.net/doc/ndn-tlv/interest.html>`_ for details. |
| 12 | |
| 13 | |
| 14 | NDNS Response |
| 15 | ------------- |
| 16 | |
| 17 | NDNS Response is an ordinary `NDN-TLV Data packet <http://named-data.net/doc/ndn-tlv/data.html>`_ |
| 18 | with specialized ``MetaInfo`` block: |
| 19 | |
| 20 | :: |
| 21 | |
| 22 | Data ::= DATA-TLV TLV-LENGTH |
| 23 | Name |
| 24 | MetaInfo (= NdnsMetaInfo) |
| 25 | Content |
| 26 | Signature |
| 27 | |
| 28 | Every response from the NDNS system comes in the same generic form. |
| 29 | Specialization of different types of NDNS responses is accomplished through |
| 30 | ``NDNS Type`` field of MetaInfo. |
| 31 | |
| 32 | See :ref `NDNS Type section` <NDNS-Type> for details |
| 33 | |
| 34 | |
| 35 | NdnsMetaInfo |
| 36 | ~~~~~~~~~~~~ |
| 37 | |
| 38 | ``NdnsMetaInfo`` specified here represents portions that are specified in `MetaInfo |
| 39 | <http://named-data.net/doc/ndn-tlv/data.html#metainfo>`_ of any NDN-TLV Data packet with |
| 40 | NDNS specific additions. |
| 41 | |
| 42 | :: |
| 43 | |
| 44 | NdnsMetaInfo ::= META-INFO-TYPE TLV-LENGTH |
| 45 | ContentType (= 0) |
| 46 | FreshnessPeriod |
| 47 | NdnsType |
| 48 | AnswerCount |
| 49 | |
| 50 | |
| 51 | ContentType |
| 52 | +++++++++++ |
| 53 | |
| 54 | :: |
| 55 | |
| 56 | ContentType ::= CONTENT-TYPE-TYPE TLV-LENGTH |
| 57 | nonNegativeInteger |
| 58 | |
| 59 | For an NDNS packet the ``ContentType`` should always be ``BLOB`` (=0), specificity is accomplished |
| 60 | by NDNS-Type. |
| 61 | |
| 62 | See :ref: `NDNS-Type` for details |
| 63 | |
| 64 | |
| 65 | FreshnessPeriod |
| 66 | +++++++++++++++ |
| 67 | |
| 68 | :: |
| 69 | |
| 70 | FreshnessPeriod ::= FRESHNESS-PERIOD-TLV TLV-LENGTH |
| 71 | nonNegativeInteger |
| 72 | |
| 73 | |
| 74 | ``FreshnessPeriod`` is required to be present in any NDNS response Data packets. As in |
| 75 | any other Data packet, it specifies how long after the arrive of the data the recieving |
| 76 | node should wait before marking it stale. |
| 77 | |
| 78 | See `NDN Packet Specification - Freshness Period <http://named-data.net/doc/ndn-tlv/data.html#freshnessperiod>`_ |
| 79 | |
| 80 | |
| 81 | .. _NDNS-Type: |
| 82 | |
| 83 | NDNS-Type |
| 84 | +++++++++ |
| 85 | |
| 86 | :: |
| 87 | |
| 88 | NdnsType ::= NDNS-TYPE-TLV TLV-LENGTH |
| 89 | nonNegativeIntegear |
| 90 | |
| 91 | There are 3 distinct types of NDNS Responses: |
| 92 | |
| 93 | +-----------+------------------------------------------------------------------+ |
| 94 | | Type | Description | |
| 95 | +===========+==================================================================+ |
| 96 | | NDNS Data | indicates an answer was found, and that contains the requested | |
| 97 | | | content | |
| 98 | +-----------+------------------------------------------------------------------+ |
| 99 | | NDNS NACK | indicates that the responding zone has no content matching the | |
| 100 | | | query. | |
| 101 | +-----------+------------------------------------------------------------------+ |
| 102 | | NDNS AUTH | indicates that the zone has content, but a more specific | |
| 103 | | | question is need to determine the correct content to server. | |
| 104 | +-----------+------------------------------------------------------------------+ |
| 105 | |
| 106 | .. _AnswerCount: |
| 107 | |
| 108 | AnswerCount |
| 109 | +++++++++++ |
| 110 | |
| 111 | :: |
| 112 | |
| 113 | AnswerCount ::= ANSWER-COUNT-TLV TLV-LENGTH |
| 114 | nonNegativeIntegear |
| 115 | |
| 116 | This field is used to specify the number of answer in a response. |
| 117 | |
| 118 | |
| 119 | Content |
| 120 | ~~~~~~~ |
| 121 | |
| 122 | :: |
| 123 | |
| 124 | Content ::= CONTENT-TYPE TLV-LENGTH BYTE* |