5 #include "ns3/assert.h"
8 #include "ns3/packet.h"
9 #include "ns3/boolean.h"
10 #include "ns3/ipv4-route.h"
26 .AddConstructor<Icmpv4L4Protocol> ()
60 Ptr<Node> node = this->GetObject<Node> ();
63 Ptr<Ipv4> ipv4 = this->GetObject<Ipv4> ();
69 ipv4->AggregateObject (rawFactory);
93 NS_LOG_FUNCTION (
this << packet << dest << static_cast<uint32_t> (type) << static_cast<uint32_t> (code));
95 NS_ASSERT (ipv4 != 0 && ipv4->GetRoutingProtocol () != 0);
102 route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_);
107 SendMessage (packet, source, dest, type, code, route);
118 NS_LOG_FUNCTION (
this << packet << source << dest << static_cast<uint32_t> (type) << static_cast<uint32_t> (code) << route);
147 uint8_t code, uint16_t nextHopMtu)
149 NS_LOG_FUNCTION (
this << header << *orgData << (uint32_t) code << nextHopMtu);
153 unreach.SetHeader (header);
154 unreach.SetData (orgData);
166 time.SetData (orgData);
188 const uint8_t payload[8])
190 NS_LOG_FUNCTION (
this << source << icmp << info << ipHeader << payload);
229 Forward (source, icmp, 0, ipHeader, payload);
uint32_t RemoveHeader(Header &header)
void GetData(uint8_t payload[8]) const
#define NS_LOG_FUNCTION(parameters)
static bool ChecksumEnabled(void)
#define NS_ASSERT(condition)
virtual ~Icmpv4L4Protocol()
virtual void DoDispose(void)
#define NS_LOG_FUNCTION_NOARGS()
virtual void SetDownTarget6(IpL4Protocol::DownTargetCallback6 cb)
void SetNode(Ptr< Node > node)
uint16_t GetNextHopMtu(void) const
void Forward(Ipv4Address source, Icmpv4Header icmp, uint32_t info, Ipv4Header ipHeader, const uint8_t payload[8])
void SendDestUnreachFragNeeded(Ipv4Header header, Ptr< const Packet > orgData, uint16_t nextHopMtu)
void SendTimeExceededTtl(Ipv4Header header, Ptr< const Packet > orgData)
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Ipv4Address GetSource(void) const
#define NS_LOG_LOGIC(msg)
virtual IpL4Protocol::DownTargetCallback GetDownTarget(void) const
void SetHeader(Ipv4Header header)
virtual void NotifyNewAggregate(void)
Access to the Ipv4 forwarding table, interfaces, and configuration.
uint32_t PeekHeader(Header &header) const
void SetNextHopMtu(uint16_t mtu)
virtual int GetProtocolNumber(void) const
virtual void Send(Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr< Ipv4Route > route)=0
L4 Protocol abstract base class.
static TypeId GetTypeId(void)
void SendDestUnreachPort(Ipv4Header header, Ptr< const Packet > orgData)
virtual void NotifyNewAggregate()
IpL4Protocol::DownTargetCallback m_downTarget
virtual enum IpL4Protocol::RxStatus Receive(Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > incomingInterface)
Ipv4 addresses are stored in host order in this class.
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
virtual void DoDispose(void)
static uint16_t GetStaticProtocolNumber(void)
void GetData(uint8_t payload[8]) const
#define NS_LOG_DEBUG(msg)
void SendDestUnreach(Ipv4Header header, Ptr< const Packet > orgData, uint8_t code, uint16_t nextHopMtu)
Ipv4Header GetHeader(void) const
Ptr< T > GetObject(void) const
virtual IpL4Protocol::DownTargetCallback6 GetDownTarget6(void) const
void HandleTimeExceeded(Ptr< Packet > p, Icmpv4Header icmp, Ipv4Address source, Ipv4Address destination)
a unique identifier for an interface.
virtual void SetDownTarget(IpL4Protocol::DownTargetCallback cb)
Ipv4Header GetHeader(void) const
void SendMessage(Ptr< Packet > packet, Ipv4Address dest, uint8_t type, uint8_t code)
TypeId SetParent(TypeId tid)
void HandleEcho(Ptr< Packet > p, Icmpv4Header header, Ipv4Address source, Ipv4Address destination)
void AddHeader(const Header &header)
static const uint8_t PROT_NUMBER
void HandleDestUnreach(Ptr< Packet > p, Icmpv4Header header, Ipv4Address source, Ipv4Address destination)