--- /home/wangke/Desktop/ns-allinone-3.12 (2)/ns-3.12/src/internet/model/ipv4-l3-protocol1.cc 2011-08-28 04:36:05.000000000 +0800 +++ /home/wangke/Desktop/ns-allinone-3.12 (2)/ns-3.12/src/internet/model/ipv4-l3-protocol.cc 2011-11-23 08:35:45.683208047 +0800 @@ -40,7 +40,8 @@ #include "icmpv4-l4-protocol.h" #include "ipv4-interface.h" #include "ipv4-raw-socket-impl.h" - +//wk test case +#include "ns3/ipv4-packet-info-tag.h" NS_LOG_COMPONENT_DEFINE ("Ipv4L3Protocol"); namespace ns3 { @@ -439,10 +440,18 @@ NS_LOG_LOGIC ("Packet from " << from << " received on node " << m_node->GetId ()); +//wk test case + Ipv4PacketInfoTag infoTag; + if (p->PeekPacketTag(infoTag )) + { Ipv4Address sender = infoTag.GetAddress(); + sender.Print(std::cout); + } + uint32_t interface = 0; Ptr packet = p->Copy (); + Ptr ipv4Interface; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); @@ -546,6 +555,15 @@ Ptr route) { NS_LOG_FUNCTION (this << packet << source << destination << uint32_t (protocol) << route); +//wk test case + Ipv4PacketInfoTag infoTag; + packet->RemovePacketTag(infoTag); + infoTag.SetAddress(GetAddress (1, 0).GetLocal ()); + packet->AddPacketTag(infoTag); + // Ipv4Address sender = infoTag.GetAddress(); + // sender.Print(std::cout); + + Ipv4Header ipHeader; bool mayFragment = true;