src/internet-stack/ipv4-l4-protocol.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 04 Jul 2009 08:15:48 +0200
changeset 4654 2eaebe77d66b
parent 3820 c04ecfdce1ef
permissions -rw-r--r--
Added tag ns-3.5 for changeset c975274c9707
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
240
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
//
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
// Copyright (c) 2006 Georgia Tech Research Corporation
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
//
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
// This program is free software; you can redistribute it and/or modify
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
// it under the terms of the GNU General Public License version 2 as
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
// published by the Free Software Foundation;
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
//
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
// This program is distributed in the hope that it will be useful,
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
// GNU General Public License for more details.
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
//
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
// You should have received a copy of the GNU General Public License
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
// along with this program; if not, write to the Free Software
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
//
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
// Author: George F. Riley<riley@ece.gatech.edu>
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
//
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
// NS3 - Layer 4 Protocol base class
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
// George F. Riley, Georgia Tech, Spring 2007
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include "ipv4-l4-protocol.h"
2498
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    25
#include "ns3/uinteger.h"
240
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
namespace ns3 {
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
2501
3eaeac1dd5ed add missing NS_OBJECT_ENSURE_REGISTERED calls.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2498
diff changeset
    29
NS_OBJECT_ENSURE_REGISTERED (Ipv4L4Protocol);
3eaeac1dd5ed add missing NS_OBJECT_ENSURE_REGISTERED calls.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2498
diff changeset
    30
2498
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    31
TypeId 
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    32
Ipv4L4Protocol::GetTypeId (void)
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    33
{
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2501
diff changeset
    34
  static TypeId tid = TypeId ("ns3::Ipv4L4Protocol")
2498
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    35
    .SetParent<Object> ()
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    36
    .AddAttribute ("ProtocolNumber", "The Ipv4 protocol number.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    37
                   UintegerValue (0),
2498
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    38
                   MakeUintegerAccessor (&Ipv4L4Protocol::GetProtocolNumber),
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    39
                   MakeUintegerChecker<int> ())
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    40
    ;
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    41
  return tid;
e01570293b98 convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    42
}
240
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
Ipv4L4Protocol::~Ipv4L4Protocol ()
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
{}
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3588
diff changeset
    47
void 
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3588
diff changeset
    48
Ipv4L4Protocol::ReceiveIcmp (Ipv4Address icmpSource, uint8_t icmpTtl,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3588
diff changeset
    49
                             uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3588
diff changeset
    50
                             Ipv4Address payloadSource,Ipv4Address payloadDestination,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3588
diff changeset
    51
                             const uint8_t payload[8])
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3588
diff changeset
    52
{}
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3588
diff changeset
    53
240
7da682f99bf9 add non-debugged udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
}//namespace ns3