helper: Extending ndn::HeaderHelper with a call to obtain ndn::Name from the raw packet

As of right now, the call is a very heavy weight operations, as it
copies packet and de-serializes the packet
diff --git a/helper/ndn-header-helper.cc b/helper/ndn-header-helper.cc
index 97d282a..ee22b43 100644
--- a/helper/ndn-header-helper.cc
+++ b/helper/ndn-header-helper.cc
@@ -70,5 +70,51 @@
   throw UnknownHeaderException();
 }
 
+Ptr<const Name>
+HeaderHelper::GetName (Ptr<const Packet> p)
+{
+  Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
+  try
+    {
+      HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (p);
+      switch (type)
+        {
+        case HeaderHelper::INTEREST_NDNSIM:
+          {
+            Ptr<InterestHeader> header = Create<InterestHeader> ();
+
+            // Deserialization. Exception may be thrown
+            packet->RemoveHeader (*header);
+            NS_ASSERT_MSG (packet->GetSize () == 0, "Payload of Interests should be zero");
+
+            return header->GetNamePtr ();
+            break;
+          }
+        case HeaderHelper::CONTENT_OBJECT_NDNSIM:
+          {
+            Ptr<ContentObjectHeader> header = Create<ContentObjectHeader> ();
+
+            // Deserialization. Exception may be thrown
+            packet->RemoveHeader (*header);
+            return header->GetNamePtr ();
+            break;
+          }
+        case HeaderHelper::INTEREST_CCNB:
+        case HeaderHelper::CONTENT_OBJECT_CCNB:
+          NS_FATAL_ERROR ("ccnb support is broken in this implementation");
+          break;
+        }
+
+      // exception will be thrown if packet is not recognized
+    }
+  catch (UnknownHeaderException)
+    {
+      return 0;
+    }
+
+  return 0;
+}
+
+
 } // namespace ndn
 } // namespace ns3