Fixing bugs with new fields in ContentObject. Implementing basic support of new fields in CcnxProducer
diff --git a/apps/ccnx-producer.cc b/apps/ccnx-producer.cc
index 6e413a0..69c5aea 100644
--- a/apps/ccnx-producer.cc
+++ b/apps/ccnx-producer.cc
@@ -26,6 +26,7 @@
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/packet.h"
+#include "ns3/simulator.h"
#include "../model/ccnx-local-face.h"
#include "ns3/ccnx-fib.h"
@@ -57,6 +58,12 @@
UintegerValue (1024),
MakeUintegerAccessor(&CcnxProducer::m_virtualPayloadSize),
MakeUintegerChecker<uint32_t>())
+
+ // optional attributes
+ .AddAttribute ("SignatureBits", "SignatureBits field",
+ UintegerValue (0),
+ MakeUintegerAccessor(&CcnxProducer::m_signatureBits),
+ MakeUintegerChecker<uint32_t> ())
;
return tid;
@@ -107,6 +114,8 @@
static CcnxContentObjectTail tail;
Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> ();
header->SetName (Create<CcnxNameComponents> (interest->GetName ()));
+ header->GetSignedInfo ().SetTimestamp (Simulator::Now ());
+ header->GetSignature ().SetSignatureBits (m_signatureBits);
NS_LOG_INFO ("node("<< GetNode()->GetId() <<") respodning with ContentObject:\n" << boost::cref(*header));
diff --git a/apps/ccnx-producer.h b/apps/ccnx-producer.h
index cf579ab..55e7162 100644
--- a/apps/ccnx-producer.h
+++ b/apps/ccnx-producer.h
@@ -26,6 +26,7 @@
#include "ns3/ptr.h"
#include "ns3/ccnx-name-components.h"
+#include "ns3/ccnx-content-object-header.h"
namespace ns3
{
@@ -52,6 +53,9 @@
private:
CcnxNameComponents m_prefix;
uint32_t m_virtualPayloadSize;
+
+ uint32_t m_signatureBits;
+ // CcnxContentObjectHeader::SignedInfo m_signedInfo;
};
}
diff --git a/model/ccnx-content-object-header.cc b/model/ccnx-content-object-header.cc
index 05220f5..070c366 100644
--- a/model/ccnx-content-object-header.cc
+++ b/model/ccnx-content-object-header.cc
@@ -127,13 +127,13 @@
written += CCNB::AppendTaggedBlob (start, CCN_DTAG_Type, type, 3);
}
- if (GetSignedInfo ().GetFreshness () >= Seconds(0))
+ if (GetSignedInfo ().GetFreshness () > Seconds(0))
{
written += CCNB::AppendBlockHeader (start, CCN_DTAG_FreshnessSeconds, CCN_DTAG);
written += CCNB::AppendNumber (start, GetSignedInfo ().GetFreshness ().ToInteger (Time::S));
written += CCNB::AppendCloser (start);
}
- if (GetSignedInfo ().GetKeyLocator ()->size () > 0)
+ if (GetSignedInfo ().GetKeyLocator () != 0)
{
written += CCNB::AppendBlockHeader (start, CCN_DTAG_KeyLocator, CCN_DTAG); // <KeyLocator>
{
@@ -199,14 +199,14 @@
{
written += CCNB::EstimateTaggedBlob (CCN_DTAG_Type, 3);
}
- if (GetSignedInfo ().GetFreshness () >= Seconds(0))
+ if (GetSignedInfo ().GetFreshness () > Seconds(0))
{
written += CCNB::EstimateBlockHeader (CCN_DTAG_FreshnessSeconds);
written += CCNB::EstimateNumber (GetSignedInfo ().GetFreshness ().ToInteger (Time::S));
written += 1;
}
- if (GetSignedInfo ().GetKeyLocator ()->size () > 0)
+ if (GetSignedInfo ().GetKeyLocator () != 0)
{
written += CCNB::EstimateBlockHeader (CCN_DTAG_KeyLocator); // <KeyLocator>
{