|
|
| 40 |
#include "icmpv4-l4-protocol.h" |
40 |
#include "icmpv4-l4-protocol.h" |
| 41 |
#include "ipv4-interface.h" |
41 |
#include "ipv4-interface.h" |
| 42 |
#include "ipv4-raw-socket-impl.h" |
42 |
#include "ipv4-raw-socket-impl.h" |
| 43 |
|
43 |
//wk test case |
|
|
44 |
#include "ns3/ipv4-packet-info-tag.h" |
| 44 |
NS_LOG_COMPONENT_DEFINE ("Ipv4L3Protocol"); |
45 |
NS_LOG_COMPONENT_DEFINE ("Ipv4L3Protocol"); |
| 45 |
|
46 |
|
| 46 |
namespace ns3 { |
47 |
namespace ns3 { |
|
|
| 439 |
|
440 |
|
| 440 |
NS_LOG_LOGIC ("Packet from " << from << " received on node " << |
441 |
NS_LOG_LOGIC ("Packet from " << from << " received on node " << |
| 441 |
m_node->GetId ()); |
442 |
m_node->GetId ()); |
|
|
443 |
//wk test case |
| 444 |
Ipv4PacketInfoTag infoTag; |
| 445 |
if (p->PeekPacketTag(infoTag )) |
| 446 |
{ Ipv4Address sender = infoTag.GetAddress(); |
| 447 |
sender.Print(std::cout); |
| 448 |
} |
| 449 |
|
| 442 |
|
450 |
|
| 443 |
uint32_t interface = 0; |
451 |
uint32_t interface = 0; |
| 444 |
Ptr<Packet> packet = p->Copy (); |
452 |
Ptr<Packet> packet = p->Copy (); |
| 445 |
|
453 |
|
|
|
454 |
|
| 446 |
Ptr<Ipv4Interface> ipv4Interface; |
455 |
Ptr<Ipv4Interface> ipv4Interface; |
| 447 |
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); |
456 |
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); |
| 448 |
i != m_interfaces.end (); |
457 |
i != m_interfaces.end (); |
|
|
| 546 |
Ptr<Ipv4Route> route) |
555 |
Ptr<Ipv4Route> route) |
| 547 |
{ |
556 |
{ |
| 548 |
NS_LOG_FUNCTION (this << packet << source << destination << uint32_t (protocol) << route); |
557 |
NS_LOG_FUNCTION (this << packet << source << destination << uint32_t (protocol) << route); |
|
|
558 |
//wk test case |
| 559 |
Ipv4PacketInfoTag infoTag; |
| 560 |
packet->RemovePacketTag(infoTag); |
| 561 |
infoTag.SetAddress(GetAddress (1, 0).GetLocal ()); |
| 562 |
packet->AddPacketTag(infoTag); |
| 563 |
// Ipv4Address sender = infoTag.GetAddress(); |
| 564 |
// sender.Print(std::cout); |
| 565 |
|
| 566 |
|
| 549 |
|
567 |
|
| 550 |
Ipv4Header ipHeader; |
568 |
Ipv4Header ipHeader; |
| 551 |
bool mayFragment = true; |
569 |
bool mayFragment = true; |