Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Yumin Xia | 2c509c2 | 2017-02-09 14:37:36 -0800 | [diff] [blame] | 2 | /* |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 3 | * Copyright (c) 2014-2022, Regents of the University of California. |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of NDNS (Named Data Networking Domain Name Service). |
| 6 | * See AUTHORS.md for complete list of NDNS authors and contributors. |
| 7 | * |
| 8 | * NDNS is free software: you can redistribute it and/or modify it under the terms |
| 9 | * of the GNU General Public License as published by the Free Software Foundation, |
| 10 | * either version 3 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 13 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 | * PURPOSE. See the GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * NDNS, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef NDNS_NDNS_LABEL_HPP |
| 21 | #define NDNS_NDNS_LABEL_HPP |
| 22 | |
| 23 | #include "ndns-enum.hpp" |
| 24 | |
| 25 | #include <ndn-cxx/name.hpp> |
| 26 | #include <ndn-cxx/interest.hpp> |
| 27 | |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 28 | namespace ndn::ndns::label { |
Shock Jiang | 895bc1b | 2014-10-01 20:00:58 -0700 | [diff] [blame] | 29 | |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 30 | /** |
| 31 | * @brief NDNS iterative query type |
| 32 | */ |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 33 | inline const name::Component NDNS_ITERATIVE_QUERY{"NDNS"}; |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * @brief NDNS recursive query type |
| 37 | */ |
Yumin Xia | 6343c5b | 2016-10-20 15:45:50 -0700 | [diff] [blame] | 38 | // it is not supported now |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 39 | // inline const name::Component NDNS_RECURSIVE_QUERY{"NDNS-R"}; |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 40 | |
| 41 | /** |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 42 | * @brief Label of update message, located at the last component in Interest name |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 43 | */ |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 44 | inline const name::Component NDNS_UPDATE_LABEL{"UPDATE"}; |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * @brief NS resource record type |
| 48 | */ |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 49 | inline const name::Component NS_RR_TYPE{"NS"}; |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 50 | |
| 51 | /** |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 52 | * @brief NDNS related certificate resource record type |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 53 | */ |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 54 | inline const name::Component CERT_RR_TYPE{"CERT"}; |
Shock Jiang | 895bc1b | 2014-10-01 20:00:58 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 57 | * @brief Application stored certificate resource record type |
Yumin Xia | 53f3167 | 2017-03-17 19:18:10 -0700 | [diff] [blame] | 58 | */ |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 59 | inline const name::Component APPCERT_RR_TYPE{"APPCERT"}; |
Yumin Xia | 53f3167 | 2017-03-17 19:18:10 -0700 | [diff] [blame] | 60 | |
| 61 | /** |
Shock Jiang | 895bc1b | 2014-10-01 20:00:58 -0700 | [diff] [blame] | 62 | * @brief TXT resource record type |
| 63 | */ |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 64 | inline const name::Component TXT_RR_TYPE{"TXT"}; |
Shock Jiang | 895bc1b | 2014-10-01 20:00:58 -0700 | [diff] [blame] | 65 | |
Yumin Xia | 55a7cc4 | 2017-05-14 18:43:34 -0700 | [diff] [blame] | 66 | /** |
| 67 | * @brief Denial of Existance record type |
| 68 | */ |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 69 | inline const name::Component DOE_RR_TYPE{"DOE"}; |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 70 | |
| 71 | ////////////////////////////////////////// |
| 72 | |
| 73 | /** |
| 74 | * @brief result of Matching. version only works when matching a Interest Name |
| 75 | */ |
| 76 | struct MatchResult |
| 77 | { |
| 78 | Name rrLabel; |
| 79 | name::Component rrType; |
| 80 | name::Component version; |
| 81 | }; |
| 82 | |
| 83 | /** |
| 84 | * @brief match the Interest (NDNS query, NDNS update) name |
| 85 | * |
| 86 | * @param[in] interest Interest to parse |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 87 | * @param[in] zone Zone that the Interest is related to |
| 88 | * (only the length will be taken into account) |
| 89 | * @param[out] result The matching result |
| 90 | * @return true if match succeeds, or false |
| 91 | */ |
| 92 | bool |
| 93 | matchName(const Interest& interest, |
Yumin Xia | 6343c5b | 2016-10-20 15:45:50 -0700 | [diff] [blame] | 94 | const Name& zone, |
Shock Jiang | 895bc1b | 2014-10-01 20:00:58 -0700 | [diff] [blame] | 95 | MatchResult& result); |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 96 | |
| 97 | /** |
| 98 | * @brief match the Data (NDNS query response, NDNS update response) name |
| 99 | * |
| 100 | * @param[in] data Data to parse |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 101 | * @param[in] zone Zone that the Data is related to |
| 102 | * (only the length will be taken into account) |
| 103 | * @param[out] result The matching result |
| 104 | * @return true if match succeeds, or false |
| 105 | */ |
| 106 | bool |
| 107 | matchName(const Data& data, |
Yumin Xia | 6343c5b | 2016-10-20 15:45:50 -0700 | [diff] [blame] | 108 | const Name& zone, |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 109 | MatchResult& result); |
| 110 | |
Davide Pesavento | 872f18e | 2022-09-20 17:03:22 -0400 | [diff] [blame] | 111 | } // namespace ndn::ndns::label |
Shock Jiang | 6cce21a | 2014-09-07 10:14:12 -0700 | [diff] [blame] | 112 | |
| 113 | #endif // NDNS_NDNS_LABEL_HPP |