|
|
| 21 |
#include "ipv4-end-point.h" |
21 |
#include "ipv4-end-point.h" |
| 22 |
#include "ns3/packet.h" |
22 |
#include "ns3/packet.h" |
| 23 |
#include "ns3/log.h" |
23 |
#include "ns3/log.h" |
|
|
24 |
#include "ns3/simulator.h" |
| 24 |
|
25 |
|
| 25 |
NS_LOG_COMPONENT_DEFINE ("Ipv4EndPoint"); |
26 |
NS_LOG_COMPONENT_DEFINE ("Ipv4EndPoint"); |
| 26 |
|
27 |
|
|
|
| 95 |
Ipv4EndPoint::ForwardUp (Ptr<Packet> p, Ipv4Address saddr, uint16_t sport) |
96 |
Ipv4EndPoint::ForwardUp (Ptr<Packet> p, Ipv4Address saddr, uint16_t sport) |
| 96 |
{ |
97 |
{ |
| 97 |
if (!m_rxCallback.IsNull ()) |
98 |
if (!m_rxCallback.IsNull ()) |
| 98 |
{ |
99 |
{ |
| 99 |
m_rxCallback (p, saddr, sport); |
100 |
Simulator::ScheduleNow (&Ipv4EndPoint::DoForwardUp, this, p, saddr, sport); |
| 100 |
} |
101 |
} |
|
|
102 |
} |
| 103 |
void |
| 104 |
Ipv4EndPoint::DoForwardUp (Ptr<Packet> p, Ipv4Address saddr, uint16_t sport) |
| 105 |
{ |
| 106 |
m_rxCallback (p, saddr, sport); |
| 101 |
} |
107 |
} |
| 102 |
|
108 |
|
| 103 |
void |
109 |
void |
|
|
| 109 |
(uint32_t)icmpCode << icmpInfo); |
115 |
(uint32_t)icmpCode << icmpInfo); |
| 110 |
if (!m_icmpCallback.IsNull ()) |
116 |
if (!m_icmpCallback.IsNull ()) |
| 111 |
{ |
117 |
{ |
| 112 |
m_icmpCallback (icmpSource,icmpTtl,icmpType,icmpCode,icmpInfo); |
118 |
Simulator::ScheduleNow (&Ipv4EndPoint::DoForwardIcmp, this, |
|
|
119 |
icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo); |
| 113 |
} |
120 |
} |
|
|
121 |
} |
| 122 |
void |
| 123 |
Ipv4EndPoint::DoForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, |
| 124 |
uint8_t icmpType, uint8_t icmpCode, |
| 125 |
uint32_t icmpInfo) |
| 126 |
{ |
| 127 |
m_icmpCallback (icmpSource,icmpTtl,icmpType,icmpCode,icmpInfo); |
| 114 |
} |
128 |
} |
| 115 |
|
129 |
|
| 116 |
}; // namespace ns3 |
130 |
}; // namespace ns3 |