src/internet/model/ipv4-route.cc
author Brian Swenson <bswenson3@gatech.edu>
Tue, 22 Apr 2014 11:52:55 -0400
changeset 10694 4af272d94cfd
parent 9710 df21b904fce3
child 10968 2d29fee2b7b8
permissions -rw-r--r--
Bug 1791
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7256
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
     3
 * Copyright (c) 2009 University of Washington
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 */
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#include "ipv4-route.h"
6823
a27f86fb4e55 Merge node and common modules into new network module
Tom Henderson <tomh@tomh.org>
parents: 4472
diff changeset
    21
#include "ns3/net-device.h"
286
57e6a2006962 convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 236
diff changeset
    22
#include "ns3/assert.h"
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    23
#include "ns3/log.h"
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    24
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    25
NS_LOG_COMPONENT_DEFINE ("Ipv4Route");
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
namespace ns3 {
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
Ipv4Route::Ipv4Route ()
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    30
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    31
  NS_LOG_FUNCTION (this);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    32
}
1445
3fba36666488 Don't flood multicasts if no route found
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
    33
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    34
void
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    35
Ipv4Route::SetDestination (Ipv4Address dest)
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    36
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    37
  NS_LOG_FUNCTION (this << dest);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    38
  m_dest = dest;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    39
}
1445
3fba36666488 Don't flood multicasts if no route found
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
    40
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    41
Ipv4Address
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    42
Ipv4Route::GetDestination (void) const
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    44
  NS_LOG_FUNCTION (this);
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
  return m_dest;
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    47
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    48
void
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    49
Ipv4Route::SetSource (Ipv4Address src)
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    51
  NS_LOG_FUNCTION (this << src);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    52
  m_source = src;
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    54
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    55
Ipv4Address
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    56
Ipv4Route::GetSource (void) const
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    58
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    59
  return m_source;
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    61
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    62
void
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    63
Ipv4Route::SetGateway (Ipv4Address gw)
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    65
  NS_LOG_FUNCTION (this << gw);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    66
  m_gateway = gw;
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    68
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    69
Ipv4Address
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
Ipv4Route::GetGateway (void) const
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    72
  NS_LOG_FUNCTION (this);
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
  return m_gateway;
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    75
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    76
void
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    77
Ipv4Route::SetOutputDevice (Ptr<NetDevice> outputDevice)
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    79
  NS_LOG_FUNCTION (this << outputDevice);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    80
  m_outputDevice = outputDevice;
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
}
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    83
Ptr<NetDevice>
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    84
Ipv4Route::GetOutputDevice (void) const
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    85
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    86
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    87
  return m_outputDevice;
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
}
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    89
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
std::ostream& operator<< (std::ostream& os, Ipv4Route const& route)
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
{
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    92
  os << "source=" << route.GetSource () << " dest="<< route.GetDestination () <<" gw=" << route.GetGateway ();
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
    93
  return os;
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
}
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
    96
Ipv4MulticastRoute::Ipv4MulticastRoute ()
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
    97
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    98
  NS_LOG_FUNCTION (this);
7256
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7176
diff changeset
    99
  m_ttls.clear ();
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   100
}
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   101
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   102
void 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   103
Ipv4MulticastRoute::SetGroup (const Ipv4Address group)
1445
3fba36666488 Don't flood multicasts if no route found
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
   104
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   105
  NS_LOG_FUNCTION (this << group);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   106
  m_group = group;
1445
3fba36666488 Don't flood multicasts if no route found
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
   107
}
3fba36666488 Don't flood multicasts if no route found
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
   108
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   109
Ipv4Address 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   110
Ipv4MulticastRoute::GetGroup (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   111
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   112
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   113
  return m_group;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   114
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   115
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   116
void 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   117
Ipv4MulticastRoute::SetOrigin (const Ipv4Address origin)
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   118
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   119
  NS_LOG_FUNCTION (this << origin);
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   120
  m_origin = origin;
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   121
}
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   122
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   123
Ipv4Address 
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   124
Ipv4MulticastRoute::GetOrigin (void) const
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   125
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   126
  NS_LOG_FUNCTION (this);
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   127
  return m_origin;
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   128
}
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   129
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   130
void 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   131
Ipv4MulticastRoute::SetParent (uint32_t parent)
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   132
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   133
  NS_LOG_FUNCTION (this << parent);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   134
  m_parent = parent;
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   135
}
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   136
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   137
uint32_t 
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   138
Ipv4MulticastRoute::GetParent (void) const
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   139
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   140
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   141
  return m_parent;
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   142
}
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   143
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   144
void 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
   145
Ipv4MulticastRoute::SetOutputTtl (uint32_t oif, uint32_t ttl)
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   146
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   147
  NS_LOG_FUNCTION (this << oif << ttl);
7161
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   148
  if (ttl >= MAX_TTL)
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   149
    {
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
   150
      // This TTL value effectively disables the interface
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
   151
      std::map<uint32_t, uint32_t>::iterator iter;
7256
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7176
diff changeset
   152
      iter = m_ttls.find (oif);
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7176
diff changeset
   153
      if (iter != m_ttls.end ())
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
   154
        {
7256
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7176
diff changeset
   155
          m_ttls.erase (iter);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
   156
        }
7161
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   157
    }
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   158
  else
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
   159
    {
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
   160
      m_ttls[oif] = ttl;
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
   161
    }
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   162
}
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   163
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   164
uint32_t
7161
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   165
Ipv4MulticastRoute::GetOutputTtl (uint32_t oif)
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   166
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   167
  NS_LOG_FUNCTION (this << oif);
7161
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   168
  // We keep this interface around for compatibility (for now)
7256
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7176
diff changeset
   169
  std::map<uint32_t, uint32_t>::const_iterator iter = m_ttls.find (oif);
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7176
diff changeset
   170
  if (iter == m_ttls.end ())
7161
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   171
    return((uint32_t)MAX_TTL);
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   172
  return(iter->second);
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   173
}
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   174
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   175
std::map<uint32_t, uint32_t>
7256
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7176
diff changeset
   176
Ipv4MulticastRoute::GetOutputTtlMap () const
7161
7cc4506fb853 bug 1047: Multicast routes on nodes with >16 interfaces
Ken Renard <kenneth.renard@arl.army.mil>
parents: 6834
diff changeset
   177
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   178
  NS_LOG_FUNCTION (this);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7161
diff changeset
   179
  return(m_ttls);
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   180
}
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 286
diff changeset
   181
7386
2310ed220a61 standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents: 7385
diff changeset
   182
} // namespace ns3