A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
icmpv4-l4-protocol.h
Go to the documentation of this file.
1 #ifndef ICMPV4_L4_PROTOCOL_H
2 #define ICMPV4_L4_PROTOCOL_H
3 
4 #include "ip-l4-protocol.h"
5 #include "icmpv4.h"
6 #include "ns3/ipv4-address.h"
7 
8 namespace ns3 {
9 
10 class Node;
11 class Ipv4Interface;
12 class Ipv4Route;
13 
15 {
16 public:
21  static TypeId GetTypeId (void);
22  static const uint8_t PROT_NUMBER;
23 
25  virtual ~Icmpv4L4Protocol ();
26 
31  void SetNode (Ptr<Node> node);
32 
37  static uint16_t GetStaticProtocolNumber (void);
38 
43  virtual int GetProtocolNumber (void) const;
44 
53  Ipv4Header const &header,
54  Ptr<Ipv4Interface> incomingInterface);
55 
64  Ipv6Header const &header,
65  Ptr<Ipv6Interface> incomingInterface);
66 
73  void SendDestUnreachFragNeeded (Ipv4Header header, Ptr<const Packet> orgData, uint16_t nextHopMtu);
74 
80  void SendTimeExceededTtl (Ipv4Header header, Ptr<const Packet> orgData);
81 
87  void SendDestUnreachPort (Ipv4Header header, Ptr<const Packet> orgData);
88 
89  // From IpL4Protocol
92  // From IpL4Protocol
95 protected:
96  /*
97  * This function will notify other components connected to the node that a new stack member is now connected
98  * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
99  */
100  virtual void NotifyNewAggregate ();
101 private:
109  void HandleEcho (Ptr<Packet> p,
110  Icmpv4Header header,
111  Ipv4Address source,
112  Ipv4Address destination);
121  Icmpv4Header header,
122  Ipv4Address source,
123  Ipv4Address destination);
132  Icmpv4Header icmp,
133  Ipv4Address source,
134  Ipv4Address destination);
143  void SendDestUnreach (Ipv4Header header, Ptr<const Packet> orgData,
144  uint8_t code, uint16_t nextHopMtu);
153  void SendMessage (Ptr<Packet> packet, Ipv4Address dest, uint8_t type, uint8_t code);
164  void SendMessage (Ptr<Packet> packet, Ipv4Address source, Ipv4Address dest, uint8_t type, uint8_t code, Ptr<Ipv4Route> route);
174  void Forward (Ipv4Address source, Icmpv4Header icmp,
175  uint32_t info, Ipv4Header ipHeader,
176  const uint8_t payload[8]);
177 
178  virtual void DoDispose (void);
179 
182 };
183 
184 } // namespace ns3
185 
186 #endif /* ICMPV4_L4_PROTOCOL_H */
Doxygen introspection did not find any typical Config paths.
Definition: ipv6-header.h:33
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
Doxygen introspection did not find any typical Config paths.
Definition: icmpv4.h:33
void SetNode(Ptr< Node > node)
Set the node the protocol is associated with.
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.
Packet header for IPv4.
Definition: ipv4-header.h:31
void SendTimeExceededTtl(Ipv4Header header, Ptr< const Packet > orgData)
Send a Time Exceeded ICMP error.
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...
virtual int GetProtocolNumber(void) const
Get the protocol number.
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.
Definition: ipv4-address.h:38
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 SendDestUnreach(Ipv4Header header, Ptr< const Packet > orgData, uint8_t code, uint16_t nextHopMtu)
Send an ICMP Destination Unreachable packet.
RxStatus
Rx status codes.
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.
Definition: type-id.h:49
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...
void SendMessage(Ptr< Packet > packet, Ipv4Address dest, uint8_t type, uint8_t code)
Send a generic ICMP packet.
void HandleEcho(Ptr< Packet > p, Icmpv4Header header, Ipv4Address source, Ipv4Address destination)
Handles an incoming ICMP Echo 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.