src: Update info message name
Changed "info" component to "INFO" and added "NLSR" component
so now info interest is of form /<neighbor>/NLSR/INFO/<router>
Change-Id: I8458fd7f911d660ffeee7e8e928d25ce3259c01b
diff --git a/nlsr.conf b/nlsr.conf
index b3dbd2f..6632d4b 100644
--- a/nlsr.conf
+++ b/nlsr.conf
@@ -5,8 +5,8 @@
; mandatory configuration command section network, site and router
network /ndn/ ; name of the network the router belongs to in ndn URI format
- site /memphis.edu/ ; name of the site the router belongs to in ndn URI format
- router /cs/pollux/ ; name of the network the router belongs to in ndn URI format
+ site /edu/memphis ; name of the site the router belongs to in ndn URI format
+ router /%C1.O.R./cs/pollux ; name of the router in ndn URI format
; lsa-refresh-time is the time in seconds, after which router will refresh its LSAs
@@ -39,7 +39,7 @@
neighbor
{
- name /ndn/memphis.edu/cs/castor ; name prefix of the neighbor router consists
+ name /ndn/edu/memphis/%C1.O.R./cs/castor ; name prefix of the neighbor router consists
; of network, site-name and router-name
face-uri udp://castor.cs.memphis.edu ; face id of the face connected to the neighbor
@@ -48,7 +48,7 @@
neighbor
{
- name /ndn/memphis.edu/cs/mira ; name prefix of the neighbor router consists
+ name /ndn/edu/memphis/%C1.O.R./cs/mira ; name prefix of the neighbor router consists
; of network, site-name and router-name
face-uri udp://mira.cs.memphis.edu ; face id of the face connected to the neighbor
@@ -109,7 +109,7 @@
filter
{
type name
- regex ^[^<nlsr><INFO>]*<nlsr><INFO><><>$
+ regex ^[^<NLSR><INFO>]*<NLSR><INFO><><>$
}
checker
{
@@ -123,7 +123,7 @@
k-regex ^([^<KEY><NLSR>]*)<NLSR><KEY><ksk-.*><ID-CERT>$
k-expand \\1\\2
h-relation equal
- p-regex ^([^<nlsr><INFO>]*)<nlsr><INFO><><>$
+ p-regex ^([^<NLSR><INFO>]*)<NLSR><INFO><><>$
p-expand \\1
}
}
diff --git a/src/hello-protocol.cpp b/src/hello-protocol.cpp
index ce1f391..1cd86ae 100644
--- a/src/hello-protocol.cpp
+++ b/src/hello-protocol.cpp
@@ -30,7 +30,8 @@
INIT_LOGGER("HelloProtocol");
-const std::string HelloProtocol::INFO_COMPONENT="info";
+const std::string HelloProtocol::INFO_COMPONENT = "INFO";
+const std::string HelloProtocol::NLSR_COMPONENT = "NLSR";
void
HelloProtocol::expressInterest(const ndn::Name& interestName, uint32_t seconds)
@@ -53,7 +54,9 @@
std::list<Adjacent> adjList = m_nlsr.getAdjacencyList().getAdjList();
for (std::list<Adjacent>::iterator it = adjList.begin(); it != adjList.end();
++it) {
+ /* interest name: /<neighbor>/NLSR/INFO/<router> */
ndn::Name interestName = (*it).getName() ;
+ interestName.append(NLSR_COMPONENT);
interestName.append(INFO_COMPONENT);
interestName.append(m_nlsr.getConfParameter().getRouterPrefix().wireEncode());
expressInterest(interestName,
@@ -74,6 +77,7 @@
HelloProtocol::processInterest(const ndn::Name& name,
const ndn::Interest& interest)
{
+ /* interest name: /<neighbor>/NLSR/INFO/<router> */
const ndn::Name interestName = interest.getName();
_LOG_DEBUG("Interest Received for Name: " << interestName);
if (interestName.get(-2).toUri() != INFO_COMPONENT) {
@@ -92,7 +96,9 @@
m_nlsr.getNlsrFace().put(data);
int status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
if (status == 0) {
+ /* interest name: /<neighbor>/NLSR/INFO/<router> */
ndn::Name interestName(neighbor);
+ interestName.append(NLSR_COMPONENT);
interestName.append(INFO_COMPONENT);
interestName.append(m_nlsr.getConfParameter().getRouterPrefix().wireEncode());
expressInterest(interestName,
@@ -104,12 +110,13 @@
void
HelloProtocol::processInterestTimedOut(const ndn::Interest& interest)
{
+ /* interest name: /<neighbor>/NLSR/INFO/<router> */
const ndn::Name interestName(interest.getName());
_LOG_DEBUG("Interest timed out for Name: " << interestName);
if (interestName.get(-2).toUri() != INFO_COMPONENT) {
return;
}
- ndn::Name neighbor = interestName.getPrefix(-2);
+ ndn::Name neighbor = interestName.getPrefix(-3);
_LOG_DEBUG("Neighbor: " << neighbor);
m_nlsr.getAdjacencyList().incrementTimedOutInterestCount(neighbor);
int status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
@@ -118,7 +125,9 @@
_LOG_DEBUG("Status: " << status);
_LOG_DEBUG("Info Interest Timed out: " << infoIntTimedOutCount);
if ((infoIntTimedOutCount < m_nlsr.getConfParameter().getInterestRetryNumber())) {
+ /* interest name: /<neighbor>/NLSR/INFO/<router> */
ndn::Name interestName(neighbor);
+ interestName.append(NLSR_COMPONENT);
interestName.append(INFO_COMPONENT);
interestName.append(m_nlsr.getConfParameter().getRouterPrefix().wireEncode());
expressInterest(interestName,
@@ -151,10 +160,11 @@
void
HelloProtocol::onContentValidated(const ndn::shared_ptr<const ndn::Data>& data)
{
+ /* data name: /<neighbor>/NLSR/INFO/<router>/<version> */
ndn::Name dataName = data->getName();
_LOG_DEBUG("Data received for name: " << dataName);
if (dataName.get(-3).toUri() == INFO_COMPONENT) {
- ndn::Name neighbor = dataName.getPrefix(-3);
+ ndn::Name neighbor = dataName.getPrefix(-4);
int oldStatus = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
m_nlsr.getAdjacencyList().setStatusOfNeighbor(neighbor, 1);
m_nlsr.getAdjacencyList().setTimedOutInterestCount(neighbor, 0);
diff --git a/src/hello-protocol.hpp b/src/hello-protocol.hpp
index ac0433a..5f1cc7d 100644
--- a/src/hello-protocol.hpp
+++ b/src/hello-protocol.hpp
@@ -70,6 +70,7 @@
private:
Nlsr& m_nlsr;
static const std::string INFO_COMPONENT;
+ static const std::string NLSR_COMPONENT;
};
} //namespace nlsr