all: InterestHeader and ContentObjectHeader refactoring to Interest and ContentObject
refs #29
diff --git a/disabled/ndn-content-object-header-ccnb.cc b/disabled/ndn-content-object-header-ccnb.cc
index 112f141..1f1a9f3 100644
--- a/disabled/ndn-content-object-header-ccnb.cc
+++ b/disabled/ndn-content-object-header-ccnb.cc
@@ -39,48 +39,48 @@
#include <boost/foreach.hpp>
-NS_LOG_COMPONENT_DEFINE ("ndn.ContentObjectHeader");
+NS_LOG_COMPONENT_DEFINE ("ndn.ContentObject");
namespace ns3 {
namespace ndn {
using namespace CcnbParser;
-const std::string ContentObjectHeader::Signature::DefaultDigestAlgorithm = "2.16.840.1.101.3.4.2.1";
+const std::string ContentObject::Signature::DefaultDigestAlgorithm = "2.16.840.1.101.3.4.2.1";
-NS_OBJECT_ENSURE_REGISTERED (ContentObjectHeader);
+NS_OBJECT_ENSURE_REGISTERED (ContentObject);
NS_OBJECT_ENSURE_REGISTERED (ContentObjectTail);
TypeId
-ContentObjectHeader::GetTypeId (void)
+ContentObject::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::ndn::ContentObjectHeader")
+ static TypeId tid = TypeId ("ns3::ndn::ContentObject")
.SetGroupName ("Ndn")
.SetParent<Header> ()
- .AddConstructor<ContentObjectHeader> ()
+ .AddConstructor<ContentObject> ()
;
return tid;
}
-ContentObjectHeader::ContentObjectHeader ()
+ContentObject::ContentObject ()
{
}
void
-ContentObjectHeader::SetName (const Ptr<Name> &name)
+ContentObject::SetName (const Ptr<Name> &name)
{
m_name = name;
}
const Name&
-ContentObjectHeader::GetName () const
+ContentObject::GetName () const
{
- if (m_name==0) throw ContentObjectHeaderException();
+ if (m_name==0) throw ContentObjectException();
return *m_name;
}
Ptr<const Name>
-ContentObjectHeader::GetNamePtr () const
+ContentObject::GetNamePtr () const
{
return m_name;
}
@@ -88,7 +88,7 @@
#define CCNB EncodingHelper // just to simplify writing
void
-ContentObjectHeader::Serialize (Buffer::Iterator start) const
+ContentObject::Serialize (Buffer::Iterator start) const
{
size_t written = 0;
written += CCNB::AppendBlockHeader (start, CCN_DTAG_ContentObject, CCN_DTAG); // <ContentObject>
@@ -163,7 +163,7 @@
}
uint32_t
-ContentObjectHeader::GetSerializedSize () const
+ContentObject::GetSerializedSize () const
{
size_t written = 0;
written += CCNB::EstimateBlockHeader (CCN_DTAG_ContentObject); // <ContentObject>
@@ -240,7 +240,7 @@
class ContentObjectVisitor : public VoidDepthFirstVisitor
{
public:
- virtual void visit (Dtag &n, boost::any param/*should be ContentObjectHeader* */)
+ virtual void visit (Dtag &n, boost::any param/*should be ContentObject* */)
{
// uint32_t n.m_dtag;
// std::list<Ptr<Block> > n.m_nestedBlocks;
@@ -251,7 +251,7 @@
static Uint32tBlobVisitor uint32tBlobVisitor;
static ContentTypeVisitor contentTypeVisitor;
- ContentObjectHeader &contentObject = *(boost::any_cast<ContentObjectHeader*> (param));
+ ContentObject &contentObject = *(boost::any_cast<ContentObject*> (param));
switch (n.m_dtag)
{
@@ -337,7 +337,7 @@
throw CcnbDecodingException ();
contentObject.GetSignedInfo ().SetContentType
- (static_cast<ContentObjectHeader::ContentType>
+ (static_cast<ContentObject::ContentType>
(boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
(contentTypeVisitor))));
break;
@@ -394,7 +394,7 @@
};
uint32_t
-ContentObjectHeader::Deserialize (Buffer::Iterator start)
+ContentObject::Deserialize (Buffer::Iterator start)
{
static ContentObjectVisitor contentObjectVisitor;
@@ -406,13 +406,13 @@
}
TypeId
-ContentObjectHeader::GetInstanceTypeId (void) const
+ContentObject::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
void
-ContentObjectHeader::Print (std::ostream &os) const
+ContentObject::Print (std::ostream &os) const
{
os << "D: " << GetName ();
// os << "<ContentObject><Name>" << GetName () << "</Name><Content>";
@@ -481,7 +481,7 @@
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
-ContentObjectHeader::SignedInfo::SignedInfo ()
+ContentObject::SignedInfo::SignedInfo ()
: m_publisherPublicKeyDigest (0)
// , m_timestamp
, m_type (DATA)
@@ -492,61 +492,61 @@
}
void
-ContentObjectHeader::SignedInfo::SetPublisherPublicKeyDigest (uint32_t digest)
+ContentObject::SignedInfo::SetPublisherPublicKeyDigest (uint32_t digest)
{
m_publisherPublicKeyDigest = digest;
}
uint32_t
-ContentObjectHeader::SignedInfo::GetPublisherPublicKeyDigest () const
+ContentObject::SignedInfo::GetPublisherPublicKeyDigest () const
{
return m_publisherPublicKeyDigest;
}
void
-ContentObjectHeader::SignedInfo::SetTimestamp (const Time ×tamp)
+ContentObject::SignedInfo::SetTimestamp (const Time ×tamp)
{
m_timestamp = timestamp;
}
Time
-ContentObjectHeader::SignedInfo::GetTimestamp () const
+ContentObject::SignedInfo::GetTimestamp () const
{
return m_timestamp;
}
void
-ContentObjectHeader::SignedInfo::SetContentType (ContentObjectHeader::ContentType type)
+ContentObject::SignedInfo::SetContentType (ContentObject::ContentType type)
{
m_type = type;
}
-ContentObjectHeader::ContentType
-ContentObjectHeader::SignedInfo::GetContentType () const
+ContentObject::ContentType
+ContentObject::SignedInfo::GetContentType () const
{
return m_type;
}
void
-ContentObjectHeader::SignedInfo::SetFreshness (const Time &freshness)
+ContentObject::SignedInfo::SetFreshness (const Time &freshness)
{
m_freshness = freshness;
}
Time
-ContentObjectHeader::SignedInfo::GetFreshness () const
+ContentObject::SignedInfo::GetFreshness () const
{
return m_freshness;
}
void
-ContentObjectHeader::SignedInfo::SetKeyLocator (Ptr<const Name> keyLocator)
+ContentObject::SignedInfo::SetKeyLocator (Ptr<const Name> keyLocator)
{
m_keyLocator = keyLocator;
}
Ptr<const Name>
-ContentObjectHeader::SignedInfo::GetKeyLocator () const
+ContentObject::SignedInfo::GetKeyLocator () const
{
return m_keyLocator;
}