model: First set of major API changes and reorganizations

Main motive: change interface in Face class, resulting in need to change forwarding strategy interfaces

Refs #1005 (http://redmine.named-data.net/)
diff --git a/model/fw/ndn-forwarding-strategy.cc b/model/fw/ndn-forwarding-strategy.cc
index 9d72e74..1d6bcda 100644
--- a/model/fw/ndn-forwarding-strategy.cc
+++ b/model/fw/ndn-forwarding-strategy.cc
@@ -144,7 +144,7 @@
 void
 ForwardingStrategy::OnInterest (Ptr<Face> inFace,
                                 Ptr<const Interest> header,
-                                Ptr<const Packet> origPacket)
+                                Ptr<const Packet> payload)
 {
   m_inInterests (header, inFace);
 
@@ -227,10 +227,9 @@
 void
 ForwardingStrategy::OnData (Ptr<Face> inFace,
                             Ptr<const ContentObject> header,
-                            Ptr<Packet> payload,
-                            Ptr<const Packet> origPacket)
+                            Ptr<Packet> payload)
 {
-  NS_LOG_FUNCTION (inFace << header->GetName () << payload << origPacket);
+  NS_LOG_FUNCTION (inFace << header->GetName () << payload);
   m_inData (header, payload, inFace);
 
   // Lookup PIT entry
@@ -258,7 +257,7 @@
           m_dropData (header, payload, inFace);
         }
 
-      DidReceiveUnsolicitedData (inFace, header, payload, origPacket, cached);
+      DidReceiveUnsolicitedData (inFace, header, payload, cached);
       return;
     }
   else
@@ -280,7 +279,7 @@
           cached = m_contentStore->Add (header, payload); // no need for extra copy
         }
 
-      DidReceiveSolicitedData (inFace, header, payload, origPacket, cached);
+      DidReceiveSolicitedData (inFace, header, payload, cached);
     }
 
   while (pitEntry != 0)
@@ -289,7 +288,7 @@
       WillSatisfyPendingInterest (inFace, pitEntry);
 
       // Actually satisfy pending interest
-      SatisfyPendingInterest (inFace, header, payload, origPacket, pitEntry);
+      SatisfyPendingInterest (inFace, header, payload, pitEntry);
 
       // Lookup another PIT entry
       pitEntry = m_pit->Lookup (*header);
@@ -299,7 +298,7 @@
 void
 ForwardingStrategy::DidCreatePitEntry (Ptr<Face> inFace,
                                        Ptr<const Interest> header,
-                                       Ptr<const Packet> origPacket,
+                                       Ptr<const Packet> payload,
                                        Ptr<pit::Entry> pitEntrypitEntry)
 {
 }
@@ -307,7 +306,7 @@
 void
 ForwardingStrategy::FailedToCreatePitEntry (Ptr<Face> inFace,
                                             Ptr<const Interest> header,
-                                            Ptr<const Packet> origPacket)
+                                            Ptr<const Packet> payload)
 {
   m_dropInterests (header, inFace);
 }
@@ -315,7 +314,7 @@
 void
 ForwardingStrategy::DidReceiveDuplicateInterest (Ptr<Face> inFace,
                                                  Ptr<const Interest> header,
-                                                 Ptr<const Packet> origPacket,
+                                                 Ptr<const Packet> payload,
                                                  Ptr<pit::Entry> pitEntry)
 {
   /////////////////////////////////////////////////////////////////////////////////////////
@@ -330,7 +329,7 @@
 void
 ForwardingStrategy::DidSuppressSimilarInterest (Ptr<Face> face,
                                                 Ptr<const Interest> header,
-                                                Ptr<const Packet> origPacket,
+                                                Ptr<const Packet> payload,
                                                 Ptr<pit::Entry> pitEntry)
 {
 }
@@ -338,7 +337,7 @@
 void
 ForwardingStrategy::DidForwardSimilarInterest (Ptr<Face> inFace,
                                                Ptr<const Interest> header,
-                                               Ptr<const Packet> origPacket,
+                                               Ptr<const Packet> payload,
                                                Ptr<pit::Entry> pitEntry)
 {
 }
@@ -346,7 +345,7 @@
 void
 ForwardingStrategy::DidExhaustForwardingOptions (Ptr<Face> inFace,
                                                  Ptr<const Interest> header,
-                                                 Ptr<const Packet> origPacket,
+                                                 Ptr<const Packet> payload,
                                                  Ptr<pit::Entry> pitEntry)
 {
   NS_LOG_FUNCTION (this << boost::cref (*inFace));
@@ -370,7 +369,7 @@
 bool
 ForwardingStrategy::DetectRetransmittedInterest (Ptr<Face> inFace,
                                                  Ptr<const Interest> header,
-                                                 Ptr<const Packet> packet,
+                                                 Ptr<const Packet> payload,
                                                  Ptr<pit::Entry> pitEntry)
 {
   pit::Entry::in_iterator existingInFace = pitEntry->GetIncoming ().find (inFace);
@@ -390,7 +389,6 @@
 ForwardingStrategy::SatisfyPendingInterest (Ptr<Face> inFace,
                                             Ptr<const ContentObject> header,
                                             Ptr<const Packet> payload,
-                                            Ptr<const Packet> origPacket,
                                             Ptr<pit::Entry> pitEntry)
 {
   if (inFace != 0)
@@ -399,7 +397,7 @@
   //satisfy all pending incoming Interests
   BOOST_FOREACH (const pit::IncomingFace &incoming, pitEntry->GetIncoming ())
     {
-      bool ok = incoming.m_face->Send (origPacket->Copy ());
+      bool ok = incoming.m_face->SendData (header, payload);
 
       DidSendOutData (inFace, incoming.m_face, header, payload, origPacket, pitEntry);
       NS_LOG_DEBUG ("Satisfy " << *incoming.m_face);
@@ -425,7 +423,6 @@
 ForwardingStrategy::DidReceiveSolicitedData (Ptr<Face> inFace,
                                              Ptr<const ContentObject> header,
                                              Ptr<const Packet> payload,
-                                             Ptr<const Packet> origPacket,
                                              bool didCreateCacheEntry)
 {
   // do nothing
@@ -435,7 +432,6 @@
 ForwardingStrategy::DidReceiveUnsolicitedData (Ptr<Face> inFace,
                                                Ptr<const ContentObject> header,
                                                Ptr<const Packet> payload,
-                                               Ptr<const Packet> origPacket,
                                                bool didCreateCacheEntry)
 {
   // do nothing
@@ -459,7 +455,7 @@
 bool
 ForwardingStrategy::ShouldSuppressIncomingInterest (Ptr<Face> inFace,
                                                     Ptr<const Interest> header,
-                                                    Ptr<const Packet> origPacket,
+                                                    Ptr<const Packet> payload,
                                                     Ptr<pit::Entry> pitEntry)
 {
   bool isNew = pitEntry->GetIncoming ().size () == 0 && pitEntry->GetOutgoing ().size () == 0;
@@ -494,7 +490,7 @@
 void
 ForwardingStrategy::PropagateInterest (Ptr<Face> inFace,
                                        Ptr<const Interest> header,
-                                       Ptr<const Packet> origPacket,
+                                       Ptr<const Packet> payload,
                                        Ptr<pit::Entry> pitEntry)
 {
   bool isRetransmitted = m_detectRetransmissions && // a small guard
@@ -504,7 +500,7 @@
   /// @todo Make lifetime per incoming interface
   pitEntry->UpdateLifetime (header->GetInterestLifetime ());
 
-  bool propagated = DoPropagateInterest (inFace, header, origPacket, pitEntry);
+  bool propagated = DoPropagateInterest (inFace, header, payload, origPacket, pitEntry);
 
   if (!propagated && isRetransmitted) //give another chance if retransmitted
     {
@@ -512,7 +508,7 @@
       pitEntry->IncreaseAllowedRetxCount ();
 
       // try again
-      propagated = DoPropagateInterest (inFace, header, origPacket, pitEntry);
+      propagated = DoPropagateInterest (inFace, header, payload, origPacket, pitEntry);
     }
 
   // if (!propagated)
@@ -527,7 +523,7 @@
   // ForwardingStrategy failed to find it.
   if (!propagated && pitEntry->AreAllOutgoingInVain ())
     {
-      DidExhaustForwardingOptions (inFace, header, origPacket, pitEntry);
+      DidExhaustForwardingOptions (inFace, header, payload, origPacket, pitEntry);
     }
 }
 
@@ -535,7 +531,7 @@
 ForwardingStrategy::CanSendOutInterest (Ptr<Face> inFace,
                                         Ptr<Face> outFace,
                                         Ptr<const Interest> header,
-                                        Ptr<const Packet> origPacket,
+                                        Ptr<const Packet> payload,
                                         Ptr<pit::Entry> pitEntry)
 {
   if (outFace == inFace)
@@ -566,10 +562,10 @@
 ForwardingStrategy::TrySendOutInterest (Ptr<Face> inFace,
                                         Ptr<Face> outFace,
                                         Ptr<const Interest> header,
-                                        Ptr<const Packet> origPacket,
+                                        Ptr<const Packet> payload,
                                         Ptr<pit::Entry> pitEntry)
 {
-  if (!CanSendOutInterest (inFace, outFace, header, origPacket, pitEntry))
+  if (!CanSendOutInterest (inFace, outFace, header, payload, pitEntry))
     {
       return false;
     }
@@ -577,14 +573,13 @@
   pitEntry->AddOutgoing (outFace);
 
   //transmission
-  Ptr<Packet> packetToSend = origPacket->Copy ();
-  bool successSend = outFace->Send (packetToSend);
+  bool successSend = outFace->SendInterest (header, payload);
   if (!successSend)
     {
       m_dropInterests (header, outFace);
     }
 
-  DidSendOutInterest (inFace, outFace, header, origPacket, pitEntry);
+  DidSendOutInterest (inFace, outFace, header, payload, pitEntry);
 
   return true;
 }
@@ -593,7 +588,7 @@
 ForwardingStrategy::DidSendOutInterest (Ptr<Face> inFace,
                                         Ptr<Face> outFace,
                                         Ptr<const Interest> header,
-                                        Ptr<const Packet> origPacket,
+                                        Ptr<const Packet> payload,
                                         Ptr<pit::Entry> pitEntry)
 {
   m_outInterests (header, outFace);
@@ -604,7 +599,6 @@
                                     Ptr<Face> outFace,
                                     Ptr<const ContentObject> header,
                                     Ptr<const Packet> payload,
-                                    Ptr<const Packet> origPacket,
                                     Ptr<pit::Entry> pitEntry)
 {
   m_outData (header, payload, inFace == 0, outFace);
diff --git a/model/fw/ndn-forwarding-strategy.h b/model/fw/ndn-forwarding-strategy.h
index f077332..45ccc55 100644
--- a/model/fw/ndn-forwarding-strategy.h
+++ b/model/fw/ndn-forwarding-strategy.h
@@ -34,9 +34,6 @@
 class Interest;
 class ContentObject;
 
-typedef Interest InterestHeader;
-typedef ContentObject ContentObjectHeader;
-
 class Pit;
 namespace pit { class Entry; }
 class FibFaceMetric;
@@ -76,7 +73,7 @@
   virtual void
   OnInterest (Ptr<Face> face,
               Ptr<const Interest> header,
-              Ptr<const Packet> origPacket);
+              Ptr<const Packet> payload);
 
   /**
    * \brief Actual processing of incoming Ndn content objects
@@ -85,13 +82,11 @@
    * @param face    incoming face
    * @param header  deserialized ContentObject header
    * @param payload data packet payload
-   * @param origPacket  original packet
    */
   virtual void
   OnData (Ptr<Face> face,
           Ptr<const ContentObject> header,
-          Ptr<Packet> payload,
-          Ptr<const Packet> origPacket);
+          Ptr<Packet> payload);
 
   /**
    * @brief Event fired just before PIT entry is removed by timeout
@@ -142,7 +137,6 @@
    *
    * @param inFace  incoming face
    * @param header  deserialized Interest header
-   * @param origPacket  original packet
    * @param pitEntry created PIT entry (incoming and outgoing face sets are empty)
    *
    * @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
@@ -150,7 +144,7 @@
   virtual void
   DidCreatePitEntry (Ptr<Face> inFace,
                      Ptr<const Interest> header,
-                     Ptr<const Packet> origPacket,
+                     Ptr<const Packet> payload,
                      Ptr<pit::Entry> pitEntry);
 
   /**
@@ -161,12 +155,11 @@
    *
    * @param inFace  incoming face
    * @param header  deserialized Interest header
-   * @param origPacket  original packet
    */
   virtual void
   FailedToCreatePitEntry (Ptr<Face> inFace,
                           Ptr<const Interest> header,
-                          Ptr<const Packet> origPacket);
+                          Ptr<const Packet> payload);
 
   /**
    * @brief An event that is fired every time a duplicated Interest is received
@@ -175,7 +168,6 @@
    *
    * @param inFace  incoming face
    * @param header  deserialized Interest header
-   * @param origPacket  original packet
    * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
    *
    * @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
@@ -183,7 +175,7 @@
   virtual void
   DidReceiveDuplicateInterest (Ptr<Face> inFace,
                                Ptr<const Interest> header,
-                               Ptr<const Packet> origPacket,
+                               Ptr<const Packet> payload,
                                Ptr<pit::Entry> pitEntry);
 
   /**
@@ -193,7 +185,6 @@
    *
    * @param inFace  incoming face
    * @param header  deserialized Interest header
-   * @param origPacket  original packet
    * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
    *
    * @see DidReceiveDuplicateInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
@@ -201,7 +192,7 @@
   virtual void
   DidSuppressSimilarInterest (Ptr<Face> inFace,
                               Ptr<const Interest> header,
-                              Ptr<const Packet> origPacket,
+                              Ptr<const Packet> payload,
                               Ptr<pit::Entry> pitEntry);
 
   /**
@@ -211,7 +202,6 @@
    *
    * @param inFace  incoming face
    * @param header  deserialized Interest header
-   * @param origPacket  original packet
    * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
    *
    * @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, ShouldSuppressIncomingInterest
@@ -219,7 +209,7 @@
   virtual void
   DidForwardSimilarInterest (Ptr<Face> inFace,
                              Ptr<const Interest> header,
-                             Ptr<const Packet> origPacket,
+                             Ptr<const Packet> payload,
                              Ptr<pit::Entry> pitEntry);
 
   /**
@@ -230,7 +220,6 @@
    *
    * @param inFace  incoming face
    * @param header  deserialized Interest header
-   * @param origPacket  original packet
    * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
    *
    * @see DetectRetransmittedInterest
@@ -238,7 +227,7 @@
   virtual void
   DidExhaustForwardingOptions (Ptr<Face> inFace,
                                Ptr<const Interest> header,
-                               Ptr<const Packet> origPacket,
+                               Ptr<const Packet> payload,
                                Ptr<pit::Entry> pitEntry);
 
   /**
@@ -251,14 +240,13 @@
    *
    * @param inFace  incoming face
    * @param header  deserialized Interest header
-   * @param origPacket  original packet
    * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
    * @return true if Interest should be considered as retransmitted
    */
   virtual bool
   DetectRetransmittedInterest (Ptr<Face> inFace,
                                Ptr<const Interest> header,
-                               Ptr<const Packet> origPacket,
+                               Ptr<const Packet> payload,
                                Ptr<pit::Entry> pitEntry);
 
   /**
@@ -281,14 +269,12 @@
    * @param inFace  incoming face
    * @param header  deserialized ContentObject header
    * @param payload ContentObject payload
-   * @param origPacket  original packet
    * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
    */
   virtual void
   SatisfyPendingInterest (Ptr<Face> inFace, // 0 allowed (from cache)
                           Ptr<const ContentObject> header,
                           Ptr<const Packet> payload,
-                          Ptr<const Packet> origPacket,
                           Ptr<pit::Entry> pitEntry);
 
   /**
@@ -298,7 +284,6 @@
    * @param outFace  outgoing face
    * @param header  deserialized ContentObject header
    * @param payload ContentObject payload
-   * @param origPacket  original packet
    * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
    */
   virtual void
@@ -306,7 +291,6 @@
                   Ptr<Face> outFace,
                   Ptr<const ContentObject> header,
                   Ptr<const Packet> payload,
-                  Ptr<const Packet> origPacket,
                   Ptr<pit::Entry> pitEntry);
 
   /**
@@ -315,14 +299,12 @@
    * @param inFace  incoming face
    * @param header  deserialized ContentObject header
    * @param payload ContentObject payload
-   * @param origPacket  original packet
    * @param didCreateCacheEntry flag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)
    */
   virtual void
   DidReceiveSolicitedData (Ptr<Face> inFace,
                            Ptr<const ContentObject> header,
                            Ptr<const Packet> payload,
-                           Ptr<const Packet> origPacket,
                            bool didCreateCacheEntry);
 
   /**
@@ -334,14 +316,12 @@
    * @param inFace  incoming face
    * @param header  deserialized ContentObject header
    * @param payload ContentObject payload
-   * @param origPacket  original packet
    * @param didCreateCacheEntry flag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)
    */
   virtual void
   DidReceiveUnsolicitedData (Ptr<Face> inFace,
                              Ptr<const ContentObject> header,
                              Ptr<const Packet> payload,
-                             Ptr<const Packet> origPacket,
                              bool didCreateCacheEntry);
 
   /**
@@ -355,12 +335,11 @@
    * @param inFace  incoming face
    * @param header  deserialized ContentObject header
    * @param payload ContentObject payload
-   * @param origPacket  original packet
    */
   virtual bool
   ShouldSuppressIncomingInterest (Ptr<Face> inFace,
                                   Ptr<const Interest> header,
-                                  Ptr<const Packet> origPacket,
+                                  Ptr<const Packet> payload,
                                   Ptr<pit::Entry> pitEntry);
 
   /**
@@ -374,7 +353,6 @@
    * @param inFace     incoming face of the Interest
    * @param outFace    proposed outgoing face of the Interest
    * @param header     parsed Interest header
-   * @param origPacket original Interest packet
    * @param pitEntry   reference to PIT entry (reference to corresponding FIB entry inside)
    *
    * @see DetectRetransmittedInterest
@@ -383,7 +361,7 @@
   CanSendOutInterest (Ptr<Face> inFace,
                       Ptr<Face> outFace,
                       Ptr<const Interest> header,
-                      Ptr<const Packet> origPacket,
+                      Ptr<const Packet> payload,
                       Ptr<pit::Entry> pitEntry);
 
   /**
@@ -394,7 +372,6 @@
    * @param inFace     incoming face of the Interest
    * @param outFace    proposed outgoing face of the Interest
    * @param header     parsed Interest header
-   * @param origPacket original Interest packet
    * @param pitEntry   reference to PIT entry (reference to corresponding FIB entry inside)
    *
    * @see CanSendOutInterest
@@ -403,7 +380,7 @@
   TrySendOutInterest (Ptr<Face> inFace,
                       Ptr<Face> outFace,
                       Ptr<const Interest> header,
-                      Ptr<const Packet> origPacket,
+                      Ptr<const Packet> payload,
                       Ptr<pit::Entry> pitEntry);
 
   /**
@@ -412,14 +389,12 @@
    * @param inFace     incoming face of the Interest
    * @param outFace    outgoing face of the Interest
    * @param header     parsed Interest header
-   * @param origPacket original Interest packet
    * @param pitEntry   reference to PIT entry (reference to corresponding FIB entry inside)
    */
   virtual void
   DidSendOutInterest (Ptr<Face> inFace,
                       Ptr<Face> outFace,
                       Ptr<const Interest> header,
-                      Ptr<const Packet> origPacket,
                       Ptr<pit::Entry> pitEntry);
 
   /**
@@ -430,7 +405,6 @@
    *
    * @param inFace     incoming face
    * @param header     Interest header
-   * @param origPacket original Interest packet
    * @param pitEntry   reference to PIT entry (reference to corresponding FIB entry inside)
    *
    * @see DoPropagateInterest
@@ -438,7 +412,7 @@
   virtual void
   PropagateInterest (Ptr<Face> inFace,
                      Ptr<const Interest> header,
-                     Ptr<const Packet> origPacket,
+                     Ptr<const Packet> payload,
                      Ptr<pit::Entry> pitEntry);
 
   /**
@@ -453,7 +427,6 @@
    *
    * @param inFace     incoming face
    * @param header     Interest header
-   * @param origPacket original Interest packet
    * @param pitEntry   reference to PIT entry (reference to corresponding FIB entry inside)
    *
    * @return true if interest was successfully propagated, false if all options have failed
@@ -463,7 +436,7 @@
   virtual bool
   DoPropagateInterest (Ptr<Face> inFace,
                        Ptr<const Interest> header,
-                       Ptr<const Packet> origPacket,
+                       Ptr<const Packet> payload,
                        Ptr<pit::Entry> pitEntry) = 0;
 
 protected:
@@ -480,13 +453,13 @@
   bool m_cacheUnsolicitedData;
   bool m_detectRetransmissions;
 
-  TracedCallback<Ptr<const Interest>,
+  TracedCallback<Ptr<const Interest>, Ptr<const Packet>,
                  Ptr<const Face> > m_outInterests; ///< @brief Transmitted interests trace
 
-  TracedCallback<Ptr<const Interest>,
+  TracedCallback<Ptr<const Interest>, Ptr<const Packet>,
                  Ptr<const Face> > m_inInterests; ///< @brief trace of incoming Interests
 
-  TracedCallback<Ptr<const Interest>,
+  TracedCallback<Ptr<const Interest>, Ptr<const Packet>,
                  Ptr<const Face> > m_dropInterests; ///< @brief trace of dropped Interests
 
   ////////////////////////////////////////////////////////////////////