update ForwardingHint format
refs #5187
Change-Id: Ib42cfca32933b63da2683d129293f92186bbb637
diff --git a/src/clients/iterative-query-controller.cpp b/src/clients/iterative-query-controller.cpp
index ccb9451..e923e77 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-2020, Regents of the University of California.
+ * Copyright (c) 2014-2022, 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.
@@ -238,7 +238,7 @@
// addLink
if (m_lastLink.hasWire()) {
- query.setDelegationListFromLink(Link(m_lastLink));
+ query.setForwardingHintFromLink(Link(m_lastLink));
}
switch (m_step) {
diff --git a/src/clients/query.cpp b/src/clients/query.cpp
index 9bc5c60..d008d3b 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-2021, Regents of the University of California.
+ * Copyright (c) 2014-2022, 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.
@@ -47,13 +47,7 @@
m_zone = zone;
- if (!interest.getForwardingHint().empty()) {
- m_delegationList = interest.getForwardingHint();
- }
- else {
- m_delegationList = DelegationList();
- }
-
+ m_forwardingHint.assign(interest.getForwardingHint().begin(), interest.getForwardingHint().end());
size_t len = zone.size();
m_queryType = interest.getName().get(len);
@@ -75,17 +69,15 @@
Interest interest(name);
interest.setCanBePrefix(true);
interest.setInterestLifetime(m_interestLifetime);
- if (!m_delegationList.empty()) {
- interest.setForwardingHint(m_delegationList);
- }
+ interest.setForwardingHint(m_forwardingHint);
return interest;
}
void
-Query::setDelegationListFromLink(const Link& link)
+Query::setForwardingHintFromLink(const Link& link)
{
- m_delegationList = link.getDelegationList();
+ m_forwardingHint.assign(link.getDelegationList().begin(), link.getDelegationList().end());
}
std::ostream&
diff --git a/src/clients/query.hpp b/src/clients/query.hpp
index bd7ff25..68f26ee 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-2020, Regents of the University of California.
+ * Copyright (c) 2014-2022, 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.
@@ -60,7 +60,7 @@
fromInterest(const Name& zone, const Interest& interest);
void
- setDelegationListFromLink(const Link& link);
+ setForwardingHintFromLink(const Link& link);
bool
operator==(const Query& other) const
@@ -170,21 +170,21 @@
}
/**
- * @brief set link object
+ * @brief set ForwardingHint
*/
void
- setDelegationList(const DelegationList& delegations)
+ setForwardingHint(std::vector<Name> forwardingHint)
{
- m_delegationList = delegations;
+ m_forwardingHint = std::move(forwardingHint);
}
/**
- * @brief get Link object
+ * @brief get ForwardingHint
*/
- const DelegationList&
- getDelegationList() const
+ span<const Name>
+ getForwardingHint() const
{
- return m_delegationList;
+ return m_forwardingHint;
}
private:
@@ -193,7 +193,7 @@
Name m_rrLabel;
name::Component m_rrType;
time::milliseconds m_interestLifetime;
- DelegationList m_delegationList;
+ std::vector<Name> m_forwardingHint;
};
std::ostream&
diff --git a/src/daemon/rrset-factory.cpp b/src/daemon/rrset-factory.cpp
index d0938a1..cded8e0 100644
--- a/src/daemon/rrset-factory.cpp
+++ b/src/daemon/rrset-factory.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2022, 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.
@@ -117,7 +117,7 @@
RrsetFactory::generateNsRrset(const Name& label,
uint64_t version,
time::seconds ttl,
- const ndn::DelegationList& delegations)
+ std::vector<Name> delegations)
{
if (!m_checked) {
NDN_THROW(Error("You have to call checkZoneKey before call generate functions"));
@@ -131,7 +131,7 @@
Rrset& rrset = rrsetAndName.first;
Link link(name);
- link.setDelegationList(delegations);
+ link.setDelegationList(std::move(delegations));
setContentType(link, NDNS_LINK, ttl);
sign(link);
diff --git a/src/daemon/rrset-factory.hpp b/src/daemon/rrset-factory.hpp
index bab99ca..bffb093 100644
--- a/src/daemon/rrset-factory.hpp
+++ b/src/daemon/rrset-factory.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2022, 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.
@@ -57,7 +57,7 @@
generateNsRrset(const Name& label,
uint64_t version,
time::seconds ttl,
- const ndn::DelegationList& delegations);
+ std::vector<Name> delegations);
Rrset
generateTxtRrset(const Name& label,
diff --git a/src/mgmt/management-tool.cpp b/src/mgmt/management-tool.cpp
index 6d34997..02299c9 100644
--- a/src/mgmt/management-tool.cpp
+++ b/src/mgmt/management-tool.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2022, 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.
@@ -475,11 +475,8 @@
}
else {
Link link(rrset.getData());
- const DelegationList& ds = link.getDelegationList();
- for (const auto& i: ds) {
- std::string str = std::to_string(i.preference);
- + "," + i.name.toUri() + ";";
- os << str;
+ for (const auto& delegation : link.getDelegationList()) {
+ os << delegation << ";";
}
}
os << std::endl;
diff --git a/src/validator/certificate-fetcher-ndns-cert.cpp b/src/validator/certificate-fetcher-ndns-cert.cpp
index a29afe0..cd4a0ce 100644
--- a/src/validator/certificate-fetcher-ndns-cert.cpp
+++ b/src/validator/certificate-fetcher-ndns-cert.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California.
+ * Copyright (c) 2014-2022, 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.
@@ -85,8 +85,9 @@
if (data.getContentType() == NDNS_LINK) {
Link link(data.wireEncode());
- if (!link.getDelegationList().empty()) {
- interest.setForwardingHint(link.getDelegationList());
+ auto delList = link.getDelegationList();
+ if (!delList.empty()) {
+ interest.setForwardingHint({delList.begin(), delList.end()});
NDNS_LOG_INFO(" [* -> *] sending interest with LINK:" << interestName);
}
else {