Remove hints
Change-Id: I537619fefad6ffb6b46c5dc618f0fdcc15884d6e
diff --git a/src/clients/iterative-query-controller.cpp b/src/clients/iterative-query-controller.cpp
index be3f9f8..3c25505 100644
--- a/src/clients/iterative-query-controller.cpp
+++ b/src/clients/iterative-query-controller.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, 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.
@@ -177,7 +177,7 @@
{
Response re;
Name zone = m_dstLabel.getPrefix(m_nFinishedComps);
- re.fromData("", zone, data);
+ re.fromData(zone, data);
return re;
}
diff --git a/src/clients/iterative-query-controller.hpp b/src/clients/iterative-query-controller.hpp
index 714a504..dba1635 100644
--- a/src/clients/iterative-query-controller.hpp
+++ b/src/clients/iterative-query-controller.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, 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.
diff --git a/src/clients/query.cpp b/src/clients/query.cpp
index f890ad1..4e7621b 100644
--- a/src/clients/query.cpp
+++ b/src/clients/query.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, 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.
@@ -27,9 +27,8 @@
{
}
-Query::Query(const Name& hint, const Name& zone, const name::Component& queryType)
- : m_hint(hint)
- , m_zone(zone)
+Query::Query(const Name& zone, const name::Component& queryType)
+ : m_zone(zone)
, m_queryType(queryType)
, m_interestLifetime(ndn::DEFAULT_INTEREST_LIFETIME)
{
@@ -37,21 +36,18 @@
bool
-Query::fromInterest(const Name& hint, const Name& zone, const Interest& interest)
+Query::fromInterest(const Name& zone, const Interest& interest)
{
label::MatchResult re;
- if (!matchName(interest, hint, zone, re))
+ if (!matchName(interest, zone, re))
return false;
m_rrLabel = re.rrLabel;
m_rrType = re.rrType;
- m_hint = hint;
m_zone = zone;
size_t len = zone.size();
- if (!hint.empty())
- len += hint.size() + 1;
m_queryType = interest.getName().get(len);
return true;
@@ -60,12 +56,8 @@
Interest
Query::toInterest() const
{
- // <hint> /xF0. <zone> [<KEY>|<NDNS>|<NDNS-R>] <rrLabel> <rrType>
+ // <zone> [<KEY>|<NDNS>|<NDNS-R>] <rrLabel> <rrType>
Name name;
- if (!m_hint.empty()) {
- name.append(m_hint)
- .append(ndn::ndns::label::FORWARDING_HINT_LABEL);
- }
name.append(this->m_zone)
.append(this->m_queryType)
@@ -79,7 +71,6 @@
operator<<(std::ostream& os, const Query& query)
{
os << "Query: zone=" << query.getZone()
- << " hint=" << query.getHint()
<< " queryType=" << query.getQueryType()
<< " rrLabel=" << query.getRrLabel()
<< " rrType=" << query.getRrType()
diff --git a/src/clients/query.hpp b/src/clients/query.hpp
index d1bba0b..bf76684 100644
--- a/src/clients/query.hpp
+++ b/src/clients/query.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, 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.
@@ -33,14 +33,14 @@
*
* Query is an Interest whose name follows the format:
*
- * <hint> /xF0. <zone> [<KEY>|<NDNS>|<NDNS-R>] <rrLabel> <rrType>
+ * <zone> [<KEY>|<NDNS>|<NDNS-R>] <rrLabel> <rrType>
*/
class Query : noncopyable
{
public:
Query();
- Query(const Name& hint, const Name& zone, const name::Component& queryType);
+ Query(const Name& zone, const name::Component& queryType);
/**
* @brief construct an Interest according to the query abstraction
@@ -51,18 +51,17 @@
/**
* @brief extract the query information (rrLabel, rrType) from a Interest
*
- * @param hint Forwarding hint
* @param zone NDNS zone
- * @param interest The Interest to parse; the Interest must have correct hint and zone,
+ * @param interest The Interest to parse; the Interest must have correct zone,
* otherwise it's undefined behavior
*/
bool
- fromInterest(const Name& hint, const Name& zone, const Interest& interest);
+ fromInterest(const Name& zone, const Interest& interest);
bool
operator==(const Query& other) const
{
- return (getHint() == other.getHint() && getZone() == other.getZone() &&
+ return (getZone() == other.getZone() &&
getQueryType() == other.getQueryType() && getRrLabel() == other.getRrLabel() &&
getRrType() == other.getRrType());
}
@@ -76,27 +75,6 @@
public:
/**
- * @brief get forwarding hint. default empty hint (empty() == True),
- * hint won't add to the name
- */
- const Name&
- getHint() const
- {
- return m_hint;
- }
-
- /**
- * @brief set forwarding hint. default empty hint (empty() == True),
- * hint won't add to the name
- */
- void
- setHint(const Name& hint)
- {
- m_hint = hint;
- }
-
-
- /**
* @brief get name of authoritative zone
*/
const Name&
@@ -188,7 +166,6 @@
}
private:
- Name m_hint;
Name m_zone;
name::Component m_queryType;
Name m_rrLabel;
diff --git a/src/clients/response.cpp b/src/clients/response.cpp
index 3cc719b..fc14346 100644
--- a/src/clients/response.cpp
+++ b/src/clients/response.cpp
@@ -94,10 +94,10 @@
}
bool
-Response::fromData(const Name& hint, const Name& zone, const Data& data)
+Response::fromData(const Name& zone, const Data& data)
{
label::MatchResult re;
- if (!matchName(data, hint, zone, re))
+ if (!matchName(data, zone, re))
return false;
m_rrLabel = re.rrLabel;
@@ -106,8 +106,6 @@
m_zone = zone;
size_t len = zone.size();
- if (!hint.empty())
- len += hint.size() + 1;
m_queryType = data.getName().get(len);
MetaInfo info = data.getMetaInfo();
diff --git a/src/clients/response.hpp b/src/clients/response.hpp
index 63f90e7..c6a2779 100644
--- a/src/clients/response.hpp
+++ b/src/clients/response.hpp
@@ -57,15 +57,14 @@
/**
* @brief fill the attributes from Data packet.
*
- * @param hint Forwarding hint
* @param zone NDNS zone name
- * @param data Data.getName() must the same hint (if has) and zone as its prefix,
+ * @param data Data.getName() must the same zone as its prefix,
* otherwise it's undefined behavior
* @return false if Data.getName() does not follow the structure of NDNS Response without
* changing any attributes, otherwise return true and fill the attributes
*/
bool
- fromData(const Name& hint, const Name& zone, const Data& data);
+ fromData(const Name& zone, const Data& data);
shared_ptr<Data>
toData();
diff --git a/src/daemon/name-server.cpp b/src/daemon/name-server.cpp
index 3170f79..15f77c3 100644
--- a/src/daemon/name-server.cpp
+++ b/src/daemon/name-server.cpp
@@ -75,7 +75,7 @@
NameServer::onInterest(const Name& prefix, const Interest& interest)
{
label::MatchResult re;
- if (!label::matchName(interest, "", m_zone.getName(), re))
+ if (!label::matchName(interest, m_zone.getName(), re))
return;
if (re.rrType == ndns::label::NDNS_UPDATE_LABEL) {
@@ -158,7 +158,7 @@
{
label::MatchResult re;
try {
- if (!label::matchName(*data, "", m_zone.getName(), re))
+ if (!label::matchName(*data, m_zone.getName(), re))
return;
}
catch (std::exception& e) {
diff --git a/src/daemon/name-server.hpp b/src/daemon/name-server.hpp
index 09c3101..aa75ade 100644
--- a/src/daemon/name-server.hpp
+++ b/src/daemon/name-server.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, 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.
@@ -122,8 +122,6 @@
Zone m_zone;
DbMgr& m_dbMgr;
- // Name m_hint;
-
Name m_ndnsPrefix;
Name m_keyPrefix;
Name m_certName;
diff --git a/src/mgmt/management-tool.cpp b/src/mgmt/management-tool.cpp
index 9ade73f..6dd2cb9 100644
--- a/src/mgmt/management-tool.cpp
+++ b/src/mgmt/management-tool.cpp
@@ -376,8 +376,7 @@
// create response for the input data
Response re;
- Name hint;
- re.fromData(hint, zoneName, *data);
+ re.fromData(zoneName, *data);
Name label = re.getRrLabel();
name::Component type = re.getRrType();
@@ -417,8 +416,7 @@
for (Rrset& rrset : rrsets) {
Data data(rrset.getData());
Response re;
- Name hint;
- re.fromData(hint, zoneName, data);
+ re.fromData(zoneName, data);
if (rrset.getLabel().toUri().size() > labelWidth)
labelWidth = rrset.getLabel().toUri().size();
@@ -436,8 +434,7 @@
for (Rrset& rrset : rrsets) {
Data data(rrset.getData());
Response re;
- Name hint;
- re.fromData(hint, zoneName, data);
+ re.fromData(zoneName, data);
int iteration = re.getNdnsType() == NDNS_RAW || re.getNdnsType() == NDNS_AUTH ?
1 : re.getRrs().size();
const std::vector<Block> &rrs = re.getRrs();
diff --git a/src/ndns-label.cpp b/src/ndns-label.cpp
index 1b1cc80..9386452 100644
--- a/src/ndns-label.cpp
+++ b/src/ndns-label.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, 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.
@@ -28,25 +28,13 @@
inline size_t
calculateSkip(const Name& name,
- const Name& hint, const Name& zone)
+ const Name& zone)
{
size_t skip = 0;
- if (!hint.empty()) {
- // These are only asserts. The caller should supply the right parameters
- skip = hint.size() + 1 + zone.size();
- BOOST_ASSERT(name.size() > skip);
-
- BOOST_ASSERT(name.getPrefix(hint.size()) == hint);
- BOOST_ASSERT(name.get(hint.size()) == FORWARDING_HINT_LABEL);
- BOOST_ASSERT(name.getSubName(hint.size() + 1, zone.size()) == zone);
-
- }
- else {
- skip = zone.size();
- BOOST_ASSERT(name.size() > skip);
- BOOST_ASSERT(name.getPrefix(zone.size()) == zone);
- }
+ skip = zone.size();
+ BOOST_ASSERT(name.size() > skip);
+ BOOST_ASSERT(name.getPrefix(zone.size()) == zone);
BOOST_ASSERT(name.get(skip) == NDNS_ITERATIVE_QUERY ||
name.get(skip) == NDNS_CERT_QUERY);
@@ -57,13 +45,13 @@
bool
matchName(const Interest& interest,
- const Name& hint, const Name& zone,
+ const Name& zone,
MatchResult& result)
{
- // [hint / FHLabel] / zoneName / <Update>|rrLabel / UPDATE|rrType / [VERSION]
+ // zoneName / <Update>|rrLabel / UPDATE|rrType / [VERSION]
const Name& name = interest.getName();
- size_t skip = calculateSkip(name, hint, zone);
+ size_t skip = calculateSkip(name, zone);
if (name.size() - skip < 1)
return false;
@@ -85,13 +73,13 @@
bool
matchName(const Data& data,
- const Name& hint, const Name& zone,
+ const Name& zone,
MatchResult& result)
{
- // [hint / FHLabel] / zoneName / <Update>|rrLabel / UPDATE|rrType
+ // zoneName / <Update>|rrLabel / UPDATE|rrType
const Name& name = data.getName();
- size_t skip = calculateSkip(name, hint, zone);
+ size_t skip = calculateSkip(name, zone);
if (name.size() - skip < 2)
return false;
diff --git a/src/ndns-label.hpp b/src/ndns-label.hpp
index 6641eca..63df2ad 100644
--- a/src/ndns-label.hpp
+++ b/src/ndns-label.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2016, 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.
@@ -41,7 +41,8 @@
/**
* @brief NDNS recursive query type
*/
-const name::Component NDNS_RECURSIVE_QUERY("NDNS-R");
+// it is not supported now
+// const name::Component NDNS_RECURSIVE_QUERY("NDNS-R");
/**
* @brief NDNS ID-CERT query type
@@ -51,12 +52,6 @@
/////////////////////////////////////////////
/**
- * @brief label of forwarding hint
- * @todo not support forwarding hint yet, for future use
- */
-const name::Component FORWARDING_HINT_LABEL("\xF0.");
-
-/**
* @brief label of update message, located at the last component in Interest name
*/
const name::Component NDNS_UPDATE_LABEL("UPDATE");
@@ -96,8 +91,6 @@
* @brief match the Interest (NDNS query, NDNS update) name
*
* @param[in] interest Interest to parse
- * @param[in] hint Forwarding hint that is part of the Interest
- * (only the length will be taken into account)
* @param[in] zone Zone that the Interest is related to
* (only the length will be taken into account)
* @param[out] result The matching result
@@ -105,15 +98,13 @@
*/
bool
matchName(const Interest& interest,
- const Name& hint, const Name& zone,
+ const Name& zone,
MatchResult& result);
/**
* @brief match the Data (NDNS query response, NDNS update response) name
*
* @param[in] data Data to parse
- * @param[in] hint Forwarding hint that is part of the Data
- * (only the length will be taken into account)
* @param[in] zone Zone that the Data is related to
* (only the length will be taken into account)
* @param[out] result The matching result
@@ -121,7 +112,7 @@
*/
bool
matchName(const Data& data,
- const Name& hint, const Name& zone,
+ const Name& zone,
MatchResult& result);