Interesrt header supports nack and congested fields
diff --git a/model/ccnx-interest-header.cc b/model/ccnx-interest-header.cc
index 323c5fc..d44ac45 100644
--- a/model/ccnx-interest-header.cc
+++ b/model/ccnx-interest-header.cc
@@ -56,6 +56,8 @@
, m_scope (-1)
, m_interestLifetime (Seconds (0))
, m_nonce (0)
+ , m_nack (false)
+ , m_congested (false)
{
}
@@ -174,7 +176,31 @@
{
return m_nonce;
}
-
+
+void
+CcnxInterestHeader::SetNack (bool isNack)
+{
+ m_nack = isNack;
+}
+
+bool
+CcnxInterestHeader::IsNack () const
+{
+ return m_nack;
+}
+
+void
+CcnxInterestHeader::SetCongested (bool IsCongested)
+{
+ m_congested = IsCongested;
+}
+
+bool
+CcnxInterestHeader::IsCongested () const
+{
+ return m_congested;
+}
+
uint32_t
CcnxInterestHeader::GetSerializedSize (void) const
{
@@ -206,6 +232,8 @@
CcnxInterestHeader::Print (std::ostream &os) const
{
os << "<Interest>\n <Name>" << GetName () << "</Name>\n";
+ if (IsNack ())
+ os << " <NACK />\n";
if (GetMinSuffixComponents () >= 0)
os << " <MinSuffixComponents>" << GetMinSuffixComponents () << "</MinSuffixComponents>\n";
if (GetMaxSuffixComponents () >= 0)
diff --git a/model/ccnx-interest-header.h b/model/ccnx-interest-header.h
index 061c26b..4bfebe3 100644
--- a/model/ccnx-interest-header.h
+++ b/model/ccnx-interest-header.h
@@ -201,6 +201,18 @@
uint32_t
GetNonce () const;
+
+ void
+ SetNack (bool isNack);
+
+ bool
+ IsNack () const;
+
+ void
+ SetCongested (bool IsCongested);
+
+ bool
+ IsCongested () const;
//////////////////////////////////////////////////////////////////
@@ -221,6 +233,8 @@
int8_t m_scope; ///< -1 not set, 0 local scope, 1 this host, 2 immediate neighborhood
Time m_interestLifetime;
uint32_t m_nonce; ///< Nonce. not used if zero
+ bool m_nack; ///< is Negative ACK
+ bool m_congested; ///< NACK because of congestion
};
class CcnxInterestHeaderException {};