fw+table: use Interest::Nonce instead of uint32_t
Change-Id: I2a4b83696db80d2d0b675121da53a73c309e059c
diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index 09013ee..14aa777 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2020, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -340,16 +340,14 @@
topo.registerPrefix(nodeC, linkBC->getFace(nodeC), PRODUCER_PREFIX, 16);
topo.registerPrefix(nodeB, linkBD->getFace(nodeB), PRODUCER_PREFIX, 80);
- uint32_t nonce;
-
// Send 6 interest since probes can be scheduled b/w 0-5 seconds
for (int i = 1; i < 7; i++) {
// Send ping number i
Name name(PRODUCER_PREFIX);
name.appendTimestamp();
- shared_ptr<Interest> interest = makeInterest(name);
+ auto interest = makeInterest(name);
ping->getClientFace().expressInterest(*interest, nullptr, nullptr, nullptr);
- nonce = interest->getNonce();
+ auto nonce = interest->getNonce();
// Don't know when the probe will be triggered since it is random between 0-5 seconds
// or whether it will be triggered for this interest
@@ -360,13 +358,12 @@
// Check if probe is sent to B else send another ping
if (linkAB->getFace(nodeA).getCounters().nOutInterests == 1) {
// Get pitEntry of node A
- shared_ptr<pit::Entry> pitEntry = topo.getForwarder(nodeA).getPit().find(*interest);
- //get outRecord associated with face towards B
- pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(linkAB->getFace(nodeA));
+ auto pitEntry = topo.getForwarder(nodeA).getPit().find(*interest);
+ // Get outRecord associated with face towards B
+ auto outRecord = pitEntry->getOutRecord(linkAB->getFace(nodeA));
+ BOOST_REQUIRE(outRecord != pitEntry->out_end());
- BOOST_CHECK(outRecord != pitEntry->out_end());
-
- //Check that Nonce of interest is not equal to Nonce of Probe
+ // Check that Nonce of interest is not equal to Nonce of Probe
BOOST_CHECK_NE(nonce, outRecord->getLastNonce());
// B should not have received the probe interest yet
@@ -384,7 +381,6 @@
// Get outRecord associated with face towards D.
outRecord = pitEntry->getOutRecord(linkBD->getFace(nodeB));
-
BOOST_CHECK(outRecord != pitEntry->out_end());
// RTT between B and D
diff --git a/tests/daemon/table/dead-nonce-list.t.cpp b/tests/daemon/table/dead-nonce-list.t.cpp
index b98cd00..a5a537e 100644
--- a/tests/daemon/table/dead-nonce-list.t.cpp
+++ b/tests/daemon/table/dead-nonce-list.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2020, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -39,8 +39,8 @@
{
Name nameA("ndn:/A");
Name nameB("ndn:/B");
- const uint32_t nonce1 = 0x53b4eaa8;
- const uint32_t nonce2 = 0x1f46372b;
+ const Interest::Nonce nonce1(0x53b4eaa8);
+ const Interest::Nonce nonce2(0x1f46372b);
DeadNonceList dnl;
BOOST_CHECK_EQUAL(dnl.size(), 0);
@@ -64,13 +64,8 @@
protected:
PeriodicalInsertionFixture()
: dnl(LIFETIME)
- , name("ndn:/N")
- , lastNonce(0)
- , addNonceBatch(0)
- , addNonceInterval(LIFETIME / DeadNonceList::EXPECTED_MARK_COUNT)
- , timeUnit(addNonceInterval / 2)
{
- this->addNonce();
+ addNonce();
}
void
@@ -86,7 +81,7 @@
dnl.add(name, ++lastNonce);
}
- if (addNonceInterval > time::nanoseconds::zero()) {
+ if (addNonceInterval > 0_ns) {
addNonceEvent = getScheduler().schedule(addNonceInterval, [this] { addNonce(); });
}
}
@@ -96,17 +91,17 @@
void
advanceClocksByLifetime(float t)
{
- this->advanceClocks(timeUnit, time::duration_cast<time::nanoseconds>(LIFETIME * t));
+ advanceClocks(timeUnit, time::duration_cast<time::nanoseconds>(LIFETIME * t));
}
protected:
static const time::nanoseconds LIFETIME;
DeadNonceList dnl;
- Name name;
- uint32_t lastNonce;
- size_t addNonceBatch;
- time::nanoseconds addNonceInterval;
- time::nanoseconds timeUnit;
+ Name name = "/N";
+ uint32_t lastNonce = 0;
+ size_t addNonceBatch = 0;
+ const time::nanoseconds addNonceInterval = LIFETIME / DeadNonceList::EXPECTED_MARK_COUNT;
+ const time::nanoseconds timeUnit = addNonceInterval / 2;
scheduler::ScopedEventId addNonceEvent;
};
@@ -121,7 +116,7 @@
this->advanceClocksByLifetime(10.0);
Name nameC("ndn:/C");
- const uint32_t nonceC = 0x25390656;
+ const Interest::Nonce nonceC(0x25390656);
BOOST_CHECK_EQUAL(dnl.has(nameC, nonceC), false);
dnl.add(nameC, nonceC);
BOOST_CHECK_EQUAL(dnl.has(nameC, nonceC), true);