src/internet-stack/icmpv4-l4-protocol.h
author Tom Henderson <tomh@tomh.org>
Sun, 21 Jun 2009 22:29:08 -0700
changeset 4571 2c9c600270e0
parent 4558 31e9053749bb
child 6442 f380cf1aa4d8
permissions -rw-r--r--
cleanup ip alias unfinished cases (bug 591)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
#ifndef ICMPV4_L4_PROTOCOL_H
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
#define ICMPV4_L4_PROTOCOL_H
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     3
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     4
#include "ipv4-l4-protocol.h"
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
#include "icmpv4.h"
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
#include "ns3/ipv4-address.h"
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     7
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     8
namespace ns3 {
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
class Node;
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    11
class Ipv4Interface;
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 3820
diff changeset
    12
class Ipv4Route;
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
class Icmpv4L4Protocol : public Ipv4L4Protocol
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
{
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
public:
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    17
  static TypeId GetTypeId (void);
4571
2c9c600270e0 cleanup ip alias unfinished cases (bug 591)
Tom Henderson <tomh@tomh.org>
parents: 4558
diff changeset
    18
  static const uint8_t PROT_NUMBER;
2c9c600270e0 cleanup ip alias unfinished cases (bug 591)
Tom Henderson <tomh@tomh.org>
parents: 4558
diff changeset
    19
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    20
  Icmpv4L4Protocol ();
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    21
  virtual ~Icmpv4L4Protocol ();
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    22
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    23
  void SetNode (Ptr<Node> node);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
  static uint16_t GetStaticProtocolNumber (void);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
  virtual int GetProtocolNumber (void) const;
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    27
  virtual enum Ipv4L4Protocol::RxStatus Receive(Ptr<Packet> p, 
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    28
						const Ipv4Address &source,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    29
						const Ipv4Address &destination,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
						Ptr<Ipv4Interface> incomingInterface);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    31
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    32
  void SendDestUnreachFragNeeded (Ipv4Header header, Ptr<const Packet> orgData, uint16_t nextHopMtu);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    33
  void SendTimeExceededTtl (Ipv4Header header, Ptr<const Packet> orgData);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    34
  void SendDestUnreachPort (Ipv4Header header, Ptr<const Packet> orgData);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 3820
diff changeset
    35
protected:
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 3820
diff changeset
    36
  /*
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 3820
diff changeset
    37
   * This function will notify other components connected to the node that a new stack member is now connected
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 3820
diff changeset
    38
   * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 3820
diff changeset
    39
   */
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 3820
diff changeset
    40
  virtual void NotifyNewAggregate ();
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    41
private:
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    42
  void HandleEcho (Ptr<Packet> p,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    43
		   Icmpv4Header header, 
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
		   Ipv4Address source,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    45
		   Ipv4Address destination);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    46
  void HandleDestUnreach (Ptr<Packet> p,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    47
			  Icmpv4Header header, 
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    48
			  Ipv4Address source,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    49
			  Ipv4Address destination);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    50
  void HandleTimeExceeded (Ptr<Packet> p,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    51
			   Icmpv4Header icmp, 
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    52
			   Ipv4Address source,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    53
			   Ipv4Address destination);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    54
  void SendDestUnreach (Ipv4Header header, Ptr<const Packet> orgData, 
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    55
			uint8_t code, uint16_t nextHopMtu);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    56
  void SendMessage (Ptr<Packet> packet, Ipv4Address dest, uint8_t type, uint8_t code);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 3820
diff changeset
    57
  void SendMessage (Ptr<Packet> packet, Ipv4Address source, Ipv4Address dest, uint8_t type, uint8_t code, Ptr<Ipv4Route> route);
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    58
  void Forward (Ipv4Address source, Icmpv4Header icmp,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    59
		uint32_t info, Ipv4Header ipHeader,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    60
		const uint8_t payload[8]);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    61
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    62
  virtual void DoDispose (void);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    63
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    64
  Ptr<Node> m_node;
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    65
};
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    66
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    67
} // namespace ns3
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    68
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    69
#endif /* ICMPV4_L4_PROTOCOL_H */