interest: encode and decode ForwardingHint field
refs #4055
Change-Id: I1e62b160af9fa0e1a94b996cbcf2e9f5c387cb97
diff --git a/src/interest.cpp b/src/interest.cpp
index 34ebd4a..2f54dcb 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -63,6 +63,7 @@
// Selectors?
// Nonce
// InterestLifetime?
+ // ForwardingHint?
// Link?
// SelectedDelegation?
@@ -81,6 +82,11 @@
BOOST_ASSERT(!hasSelectedDelegation());
}
+ // ForwardingHint
+ if (m_forwardingHint.size() > 0) {
+ totalLength += m_forwardingHint.wireEncode(encoder);
+ }
+
// InterestLifetime
if (getInterestLifetime() != DEFAULT_INTEREST_LIFETIME) {
totalLength += prependNonNegativeIntegerBlock(encoder,
@@ -161,6 +167,15 @@
m_interestLifetime = DEFAULT_INTEREST_LIFETIME;
}
+ // ForwardingHint
+ val = m_wire.find(tlv::ForwardingHint);
+ if (val != m_wire.elements_end()) {
+ m_forwardingHint.wireDecode(*val, false);
+ }
+ else {
+ m_forwardingHint = DelegationList();
+ }
+
// Link
m_linkCached.reset();
val = m_wire.find(tlv::Data);
@@ -367,6 +382,14 @@
return *this;
}
+Interest&
+Interest::setForwardingHint(const DelegationList& value)
+{
+ m_forwardingHint = value;
+ m_wire.reset();
+ return *this;
+}
+
bool
Interest::hasLink() const
{