5 #include "ns3/assert.h"
8 #include "ns3/packet.h"
9 #include "ns3/boolean.h"
10 #include "ns3/ipv4-route.h"
28 .AddConstructor<Icmpv4L4Protocol> ()
62 Ptr<Node> node = this->GetObject<Node> ();
65 Ptr<Ipv4> ipv4 = this->GetObject<Ipv4> ();
71 ipv4->AggregateObject (rawFactory);
95 NS_LOG_FUNCTION (
this << packet << dest << static_cast<uint32_t> (type) << static_cast<uint32_t> (code));
97 NS_ASSERT (ipv4 != 0 && ipv4->GetRoutingProtocol () != 0);
104 route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_);
109 SendMessage (packet, source, dest, type, code, route);
120 NS_LOG_FUNCTION (
this << packet << source << dest << static_cast<uint32_t> (type) << static_cast<uint32_t> (code) << route);
149 uint8_t code, uint16_t nextHopMtu)
151 NS_LOG_FUNCTION (
this << header << *orgData << (uint32_t) code << nextHopMtu);
155 unreach.SetHeader (header);
156 unreach.SetData (orgData);
168 time.SetData (orgData);
190 const uint8_t payload[8])
192 NS_LOG_FUNCTION (
this << source << icmp << info << ipHeader << payload);
231 Forward (source, icmp, 0, ipHeader, payload);
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void GetData(uint8_t payload[8]) const
Get the ICMP carried data.
#define NS_LOG_FUNCTION(parameters)
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
Doxygen introspection did not find any typical Config paths.
static bool ChecksumEnabled(void)
bool IsNull(void) const
Check for null implementation.
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
virtual ~Icmpv4L4Protocol()
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
virtual void SetDownTarget6(IpL4Protocol::DownTargetCallback6 cb)
This method allows a caller to set the current down target callback set for this L4 protocol (IPv6 ca...
Ptr< Node > m_node
the node this protocol is associated with
SocketErrno
Enumeration of the possible errors returned by a socket.
void SetNode(Ptr< Node > node)
Set the node the protocol is associated with.
uint16_t GetNextHopMtu(void) const
Get the next hop MTU.
void Forward(Ipv4Address source, Icmpv4Header icmp, uint32_t info, Ipv4Header ipHeader, const uint8_t payload[8])
Forward the message to an L4 protocol.
void SendDestUnreachFragNeeded(Ipv4Header header, Ptr< const Packet > orgData, uint16_t nextHopMtu)
Send a Destination Unreachable - Fragmentation needed ICMP error.
void SendTimeExceededTtl(Ipv4Header header, Ptr< const Packet > orgData)
Send a Time Exceeded ICMP error.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Ipv4Address GetSource(void) const
#define NS_LOG_LOGIC(msg)
virtual IpL4Protocol::DownTargetCallback GetDownTarget(void) const
This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 ca...
void SetHeader(Ipv4Header header)
Set the ICMP carried IPv4 header.
virtual void NotifyNewAggregate(void)
This method is invoked whenever two sets of objects are aggregated together.
Access to the Ipv4 forwarding table, interfaces, and configuration.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
void SetNextHopMtu(uint16_t mtu)
Set the next hop MTU.
virtual int GetProtocolNumber(void) const
Get the protocol number.
Doxygen introspection did not find any typical Config paths.
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)
Get the type ID.
void SendDestUnreachPort(Ipv4Header header, Ptr< const Packet > orgData)
Send a Time Exceeded ICMP error.
virtual void NotifyNewAggregate()
This method is invoked whenever two sets of objects are aggregated together.
IpL4Protocol::DownTargetCallback m_downTarget
callback to Ipv4::Send
virtual enum IpL4Protocol::RxStatus Receive(Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > incomingInterface)
Receive method.
Ipv4 addresses are stored in host order in this class.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
static uint16_t GetStaticProtocolNumber(void)
Get the protocol number.
void GetData(uint8_t payload[8]) const
Get the ICMP carried data.
Doxygen introspection did not find any typical Config paths.
#define NS_LOG_DEBUG(msg)
void SendDestUnreach(Ipv4Header header, Ptr< const Packet > orgData, uint8_t code, uint16_t nextHopMtu)
Send an ICMP Destination Unreachable packet.
void Nullify(void)
Discard the implementation, set it to null.
Ipv4Header GetHeader(void) const
Get the ICMP carried IPv4 header.
Ptr< T > GetObject(void) const
virtual IpL4Protocol::DownTargetCallback6 GetDownTarget6(void) const
This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 ca...
void HandleTimeExceeded(Ptr< Packet > p, Icmpv4Header icmp, Ipv4Address source, Ipv4Address destination)
Handles an incoming ICMP Time Exceeded packet.
a unique identifier for an interface.
virtual void SetDownTarget(IpL4Protocol::DownTargetCallback cb)
This method allows a caller to set the current down target callback set for this L4 protocol (IPv4 ca...
Ipv4Header GetHeader(void) const
Get the ICMP carried IPv4 header.
void SendMessage(Ptr< Packet > packet, Ipv4Address dest, uint8_t type, uint8_t code)
Send a generic ICMP packet.
TypeId SetParent(TypeId tid)
void HandleEcho(Ptr< Packet > p, Icmpv4Header header, Ipv4Address source, Ipv4Address destination)
Handles an incoming ICMP Echo packet.
void AddHeader(const Header &header)
Add header to this packet.
static const uint8_t PROT_NUMBER
ICMP protocol number (0x1)
void HandleDestUnreach(Ptr< Packet > p, Icmpv4Header header, Ipv4Address source, Ipv4Address destination)
Handles an incoming ICMP Destination Unreachable packet.