src/internet-stack/ipv4-end-point.cc
author Hajime Tazaki <tazaki@sfc.wide.ad.jp>
Tue, 13 Jul 2010 13:00:55 +0900
changeset 6442 f380cf1aa4d8
parent 5971 805783c866fc
permissions -rw-r--r--
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2005 INRIA
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
2f09fd9cf32e add start of 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
2f09fd9cf32e add start of 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
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
2f09fd9cf32e add start of 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,
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
2f09fd9cf32e add start of 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
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
2f09fd9cf32e add start of 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
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#include "ipv4-end-point.h"
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1317
diff changeset
    22
#include "ns3/packet.h"
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
    23
#include "ns3/log.h"
4022
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
    24
#include "ns3/simulator.h"
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
    25
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
    26
NS_LOG_COMPONENT_DEFINE ("Ipv4EndPoint");
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
namespace ns3 {
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
2365
89da0ca7c55e undoes 2326:eec07777d1a2 because localInterface is no longer needed (see bug 136)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2326
diff changeset
    30
Ipv4EndPoint::Ipv4EndPoint (Ipv4Address address, uint16_t port)
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
  : m_localAddr (address), 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
    m_localPort (port),
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
    m_peerAddr (Ipv4Address::GetAny ()),
2365
89da0ca7c55e undoes 2326:eec07777d1a2 because localInterface is no longer needed (see bug 136)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2326
diff changeset
    34
    m_peerPort (0)
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
{}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
Ipv4EndPoint::~Ipv4EndPoint ()
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    37
{
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    38
  if (!m_destroyCallback.IsNull ())
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    39
    {
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    40
      m_destroyCallback ();
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    41
    }
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    42
}
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
Ipv4Address 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
Ipv4EndPoint::GetLocalAddress (void)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
{
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
  return m_localAddr;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
}
1317
82629189efff Fold the two patches for bu6 69 together, building on the bug 65 patch
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
    49
82629189efff Fold the two patches for bu6 69 together, building on the bug 65 patch
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
    50
void 
82629189efff Fold the two patches for bu6 69 together, building on the bug 65 patch
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
    51
Ipv4EndPoint::SetLocalAddress (Ipv4Address address)
82629189efff Fold the two patches for bu6 69 together, building on the bug 65 patch
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
    52
{
82629189efff Fold the two patches for bu6 69 together, building on the bug 65 patch
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
    53
  m_localAddr = address;
82629189efff Fold the two patches for bu6 69 together, building on the bug 65 patch
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
    54
}
82629189efff Fold the two patches for bu6 69 together, building on the bug 65 patch
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
    55
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    56
uint16_t 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
Ipv4EndPoint::GetLocalPort (void)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
{
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
  return m_localPort;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
Ipv4Address 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
Ipv4EndPoint::GetPeerAddress (void)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
{
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
  return m_peerAddr;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
uint16_t 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
Ipv4EndPoint::GetPeerPort (void)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
{
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
  return m_peerPort;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
void 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
Ipv4EndPoint::SetPeer (Ipv4Address address, uint16_t port)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
{
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
  m_peerAddr = address;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
  m_peerPort = port;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
5856
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    78
void
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    79
Ipv4EndPoint::BindToNetDevice (Ptr<NetDevice> netdevice)
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    80
{
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    81
  m_boundnetdevice = netdevice;
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    82
  return;
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    83
}
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    84
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    85
Ptr<NetDevice> 
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    86
Ipv4EndPoint::GetBoundNetDevice (void)
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    87
{
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    88
 return m_boundnetdevice;
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    89
}
7fd20c798a7d bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents: 4022
diff changeset
    90
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    91
void 
6442
f380cf1aa4d8 Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 5971
diff changeset
    92
Ipv4EndPoint::SetRxCallback (Callback<void,Ptr<Packet>, Ipv4Header, uint16_t, Ptr<Ipv4Interface> > callback)
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    93
{
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    94
  m_rxCallback = callback;
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    95
}
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
    96
void 
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
    97
Ipv4EndPoint::SetIcmpCallback (Callback<void,Ipv4Address,uint8_t,uint8_t,uint8_t,uint32_t> callback)
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
    98
{
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
    99
  m_icmpCallback = callback;
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   100
}
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   101
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   102
void 
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   103
Ipv4EndPoint::SetDestroyCallback (Callback<void> callback)
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   104
{
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   105
  m_destroyCallback = callback;
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   106
}
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   107
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   108
void 
6442
f380cf1aa4d8 Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 5971
diff changeset
   109
Ipv4EndPoint::ForwardUp (Ptr<Packet> p, const Ipv4Header& header, uint16_t sport,
f380cf1aa4d8 Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 5971
diff changeset
   110
                         Ptr<Ipv4Interface> incomingInterface)
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   111
{
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   112
  if (!m_rxCallback.IsNull ())
4022
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   113
    {
6442
f380cf1aa4d8 Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 5971
diff changeset
   114
      Simulator::ScheduleNow (&Ipv4EndPoint::DoForwardUp, this, p, header, sport, 
f380cf1aa4d8 Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 5971
diff changeset
   115
                              incomingInterface);
4022
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   116
    }
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   117
}
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   118
void 
6442
f380cf1aa4d8 Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 5971
diff changeset
   119
Ipv4EndPoint::DoForwardUp (Ptr<Packet> p, const Ipv4Header& header, uint16_t sport,
f380cf1aa4d8 Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 5971
diff changeset
   120
                           Ptr<Ipv4Interface> incomingInterface)
4022
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   121
{
6442
f380cf1aa4d8 Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 5971
diff changeset
   122
  m_rxCallback (p, header, sport, incomingInterface);
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   123
}
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
   124
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   125
void 
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   126
Ipv4EndPoint::ForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, 
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   127
                           uint8_t icmpType, uint8_t icmpCode,
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   128
                           uint32_t icmpInfo)
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   129
{
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   130
  NS_LOG_FUNCTION (this << icmpSource << (uint32_t)icmpTtl << (uint32_t)icmpType <<
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   131
                   (uint32_t)icmpCode << icmpInfo);
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   132
  if (!m_icmpCallback.IsNull ())
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   133
    {
4022
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   134
      Simulator::ScheduleNow (&Ipv4EndPoint::DoForwardIcmp, this, 
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   135
                              icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   136
    }
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3260
diff changeset
   137
}
4022
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   138
void 
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   139
Ipv4EndPoint::DoForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, 
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   140
                             uint8_t icmpType, uint8_t icmpCode,
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   141
                             uint32_t icmpInfo)
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   142
{
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   143
  m_icmpCallback (icmpSource,icmpTtl,icmpType,icmpCode,icmpInfo);
142c13a3975f Mathieu's patch: Avoid stack explosion (bug 417)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3820
diff changeset
   144
}
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   145
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   146
}; // namespace ns3