blob: 8ce7d34b8bd37d4680df42257daa1ada61d7e922 [file] [log] [blame]
Shock Jiang6cce21a2014-09-07 10:14:12 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Yumin Xia2c509c22017-02-09 14:37:36 -08002/*
3 * Copyright (c) 2014-2017, Regents of the University of California.
Shock Jiang6cce21a2014-09-07 10:14:12 -07004 *
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
28#include <string>
29
30namespace ndn {
31namespace ndns {
32namespace label {
33
Shock Jiang895bc1b2014-10-01 20:00:58 -070034
Shock Jiang6cce21a2014-09-07 10:14:12 -070035/**
36 * @brief NDNS iterative query type
37 */
38
Shock Jiang895bc1b2014-10-01 20:00:58 -070039const name::Component NDNS_ITERATIVE_QUERY("NDNS");
Shock Jiang6cce21a2014-09-07 10:14:12 -070040
41/**
42 * @brief NDNS recursive query type
43 */
Yumin Xia6343c5b2016-10-20 15:45:50 -070044// it is not supported now
45// const name::Component NDNS_RECURSIVE_QUERY("NDNS-R");
Shock Jiang6cce21a2014-09-07 10:14:12 -070046
Shock Jiang6cce21a2014-09-07 10:14:12 -070047/////////////////////////////////////////////
48
49/**
Shock Jiang6cce21a2014-09-07 10:14:12 -070050 * @brief label of update message, located at the last component in Interest name
51 */
Shock Jiang895bc1b2014-10-01 20:00:58 -070052const name::Component NDNS_UPDATE_LABEL("UPDATE");
53
Shock Jiang6cce21a2014-09-07 10:14:12 -070054
55//////////////////////////////////////////////
56
57/**
58 * @brief NS resource record type
59 */
Shock Jiang895bc1b2014-10-01 20:00:58 -070060const name::Component NS_RR_TYPE("NS");
Shock Jiang6cce21a2014-09-07 10:14:12 -070061
62/**
Yumin Xia53f31672017-03-17 19:18:10 -070063 * @brief ndns related certificate resource record type
Shock Jiang6cce21a2014-09-07 10:14:12 -070064 */
Yumin Xia2c509c22017-02-09 14:37:36 -080065const name::Component CERT_RR_TYPE("CERT");
Shock Jiang895bc1b2014-10-01 20:00:58 -070066
67/**
Yumin Xia53f31672017-03-17 19:18:10 -070068 * @brief application stored certificate resource record type
69 */
70const name::Component APPCERT_RR_TYPE("APPCERT");
71
72/**
Shock Jiang895bc1b2014-10-01 20:00:58 -070073 * @brief TXT resource record type
74 */
75const name::Component TXT_RR_TYPE("TXT");
76
Shock Jiang6cce21a2014-09-07 10:14:12 -070077
78//////////////////////////////////////////
79
80/**
81 * @brief result of Matching. version only works when matching a Interest Name
82 */
83struct MatchResult
84{
85 Name rrLabel;
86 name::Component rrType;
87 name::Component version;
88};
89
90/**
91 * @brief match the Interest (NDNS query, NDNS update) name
92 *
93 * @param[in] interest Interest to parse
Shock Jiang6cce21a2014-09-07 10:14:12 -070094 * @param[in] zone Zone that the Interest is related to
95 * (only the length will be taken into account)
96 * @param[out] result The matching result
97 * @return true if match succeeds, or false
98 */
99bool
100matchName(const Interest& interest,
Yumin Xia6343c5b2016-10-20 15:45:50 -0700101 const Name& zone,
Shock Jiang895bc1b2014-10-01 20:00:58 -0700102 MatchResult& result);
Shock Jiang6cce21a2014-09-07 10:14:12 -0700103
104/**
105 * @brief match the Data (NDNS query response, NDNS update response) name
106 *
107 * @param[in] data Data to parse
Shock Jiang6cce21a2014-09-07 10:14:12 -0700108 * @param[in] zone Zone that the Data is related to
109 * (only the length will be taken into account)
110 * @param[out] result The matching result
111 * @return true if match succeeds, or false
112 */
113bool
114matchName(const Data& data,
Yumin Xia6343c5b2016-10-20 15:45:50 -0700115 const Name& zone,
Shock Jiang6cce21a2014-09-07 10:14:12 -0700116 MatchResult& result);
117
Shock Jiang895bc1b2014-10-01 20:00:58 -0700118
Shock Jiang6cce21a2014-09-07 10:14:12 -0700119} // namespace label
120} // namespace ndns
121} // namespace ndn
122
123#endif // NDNS_NDNS_LABEL_HPP