Small extension of InterestHeader API (cheat for python bindings)
diff --git a/model/ndn-interest-header.cc b/model/ndn-interest-header.cc
index 39c87e9..d0ebaab 100644
--- a/model/ndn-interest-header.cc
+++ b/model/ndn-interest-header.cc
@@ -27,6 +27,7 @@
#include "ns3/log.h"
#include "ns3/unused.h"
+#include "ns3/packet.h"
#include "../helper/ndn-encoding-helper.h"
#include "../helper/ndn-decoding-helper.h"
@@ -77,6 +78,15 @@
{
}
+Ptr<InterestHeader>
+InterestHeader::GetInterest (Ptr<Packet> packet)
+{
+ Ptr<InterestHeader> interest = Create<InterestHeader> ();
+ packet->RemoveHeader (*interest);
+
+ return interest;
+}
+
void
InterestHeader::SetName (Ptr<NameComponents> name)
{
diff --git a/model/ndn-interest-header.h b/model/ndn-interest-header.h
index df48fb0..f645255 100644
--- a/model/ndn-interest-header.h
+++ b/model/ndn-interest-header.h
@@ -34,6 +34,9 @@
#include "ndn-name-components.h"
namespace ns3 {
+
+class Packet;
+
namespace ndn {
/**
@@ -385,6 +388,12 @@
*/
virtual uint32_t Deserialize (Buffer::Iterator start);
+ /**
+ * @brief Cheat for python bindings
+ */
+ static Ptr<InterestHeader>
+ GetInterest (Ptr<Packet> packet);
+
private:
Ptr<NameComponents> m_name; ///< Interest name
int32_t m_minSuffixComponents; ///< Minimum suffix components. not used if negative