blob: 93713d7b93ceb6970516e93c23f9c5b68a5126ae [file] [log] [blame]
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2017, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
*
* NDNS is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* NDNS, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NDNS_NDNS_LABEL_HPP
#define NDNS_NDNS_LABEL_HPP
#include "ndns-enum.hpp"
#include <ndn-cxx/name.hpp>
#include <ndn-cxx/interest.hpp>
#include <string>
namespace ndn {
namespace ndns {
namespace label {
/**
* @brief NDNS iterative query type
*/
const name::Component NDNS_ITERATIVE_QUERY("NDNS");
/**
* @brief NDNS recursive query type
*/
// it is not supported now
// const name::Component NDNS_RECURSIVE_QUERY("NDNS-R");
/**
* @brief NDNS CERT query type
*/
const name::Component NDNS_CERT_QUERY("NDNS");
/////////////////////////////////////////////
/**
* @brief label of update message, located at the last component in Interest name
*/
const name::Component NDNS_UPDATE_LABEL("UPDATE");
//////////////////////////////////////////////
/**
* @brief NS resource record type
*/
const name::Component NS_RR_TYPE("NS");
/**
* @brief CERT resource record type
*/
const name::Component CERT_RR_TYPE("CERT");
/**
* @brief TXT resource record type
*/
const name::Component TXT_RR_TYPE("TXT");
//////////////////////////////////////////
/**
* @brief result of Matching. version only works when matching a Interest Name
*/
struct MatchResult
{
Name rrLabel;
name::Component rrType;
name::Component version;
};
/**
* @brief match the Interest (NDNS query, NDNS update) name
*
* @param[in] interest Interest to parse
* @param[in] zone Zone that the Interest is related to
* (only the length will be taken into account)
* @param[out] result The matching result
* @return true if match succeeds, or false
*/
bool
matchName(const Interest& interest,
const Name& zone,
MatchResult& result);
/**
* @brief match the Data (NDNS query response, NDNS update response) name
*
* @param[in] data Data to parse
* @param[in] zone Zone that the Data is related to
* (only the length will be taken into account)
* @param[out] result The matching result
* @return true if match succeeds, or false
*/
bool
matchName(const Data& data,
const Name& zone,
MatchResult& result);
} // namespace label
} // namespace ndns
} // namespace ndn
#endif // NDNS_NDNS_LABEL_HPP