src/internet/model/ipv4-routing-table-entry.cc
author Peter D. Barnes, Jr. <barnes26@llnl.gov>
Fri, 26 Sep 2014 15:51:00 -0700
changeset 10968 2d29fee2b7b8
parent 9710 df21b904fce3
permissions -rw-r--r--
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
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; -*- */
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
/*
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     3
 * Copyright (c) 2005 INRIA
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     4
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     8
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    12
 * GNU General Public License for more details.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    13
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    17
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    19
 */
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    20
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    21
#include "ipv4-routing-table-entry.h"
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
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
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9710
diff changeset
    25
namespace ns3 {
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    26
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9710
diff changeset
    27
NS_LOG_COMPONENT_DEFINE ("Ipv4RoutingTableEntry");
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    28
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    29
/*****************************************************
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    30
 *     Network Ipv4RoutingTableEntry
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    31
 *****************************************************/
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    32
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    33
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry ()
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    34
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    35
  NS_LOG_FUNCTION (this);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    36
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    37
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    38
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const &route)
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    39
  : m_dest (route.m_dest),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    40
    m_destNetworkMask (route.m_destNetworkMask),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    41
    m_gateway (route.m_gateway),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    42
    m_interface (route.m_interface)
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
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 << route);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    45
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    46
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    47
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const *route)
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    48
  : m_dest (route->m_dest),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    49
    m_destNetworkMask (route->m_destNetworkMask),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    50
    m_gateway (route->m_gateway),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    51
    m_interface (route->m_interface)
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    52
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    53
  NS_LOG_FUNCTION (this << route);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    54
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    55
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    56
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    57
                                              Ipv4Address gateway,
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    58
                                              uint32_t interface)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    59
  : m_dest (dest),
4747
3dc675bb8b20 Static routing with support for metrics and longest prefix match
Antti Makela <zarhan@cc.hut.fi>
parents: 4573
diff changeset
    60
    m_destNetworkMask (Ipv4Mask::GetOnes ()),
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    61
    m_gateway (gateway),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    62
    m_interface (interface)
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    63
{
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    64
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    65
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    66
                                              uint32_t interface)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    67
  : m_dest (dest),
4747
3dc675bb8b20 Static routing with support for metrics and longest prefix match
Antti Makela <zarhan@cc.hut.fi>
parents: 4573
diff changeset
    68
    m_destNetworkMask (Ipv4Mask::GetOnes ()),
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    69
    m_gateway (Ipv4Address::GetZero ()),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    70
    m_interface (interface)
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    71
{
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    72
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    73
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    74
                                              Ipv4Mask networkMask,
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    75
                                              Ipv4Address gateway,
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    76
                                              uint32_t interface)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    77
  : m_dest (network),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    78
    m_destNetworkMask (networkMask),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    79
    m_gateway (gateway),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    80
    m_interface (interface)
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    81
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    82
  NS_LOG_FUNCTION (this << network << networkMask << gateway << interface);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    83
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    84
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    85
                                              Ipv4Mask networkMask,
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    86
                                              uint32_t interface)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    87
  : m_dest (network),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    88
    m_destNetworkMask (networkMask),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    89
    m_gateway (Ipv4Address::GetZero ()),
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    90
    m_interface (interface)
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    91
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
    92
  NS_LOG_FUNCTION (this << network << networkMask << interface);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    93
}
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    94
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    95
bool
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    96
Ipv4RoutingTableEntry::IsHost (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
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);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    99
  if (m_destNetworkMask.IsEqual (Ipv4Mask::GetOnes ()))
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   100
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   101
      return true;
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   102
    }
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   103
  else
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   104
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   105
      return false;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   106
    }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   107
}
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   108
Ipv4Address
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   109
Ipv4RoutingTableEntry::GetDest (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   110
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   111
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   112
  return m_dest;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   113
}
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   114
bool
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   115
Ipv4RoutingTableEntry::IsNetwork (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   116
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   117
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   118
  return !IsHost ();
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   119
}
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   120
bool
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   121
Ipv4RoutingTableEntry::IsDefault (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   122
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   123
  NS_LOG_FUNCTION (this);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   124
  if (m_dest.IsEqual (Ipv4Address::GetZero ()))
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   125
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   126
      return true;
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   127
    }
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   128
  else
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   129
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   130
      return false;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   131
    }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   132
}
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   133
Ipv4Address
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   134
Ipv4RoutingTableEntry::GetDestNetwork (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   135
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   136
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   137
  return m_dest;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   138
}
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   139
Ipv4Mask
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   140
Ipv4RoutingTableEntry::GetDestNetworkMask (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   141
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   142
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   143
  return m_destNetworkMask;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   144
}
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   145
bool
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   146
Ipv4RoutingTableEntry::IsGateway (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   147
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   148
  NS_LOG_FUNCTION (this);
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   149
  if (m_gateway.IsEqual (Ipv4Address::GetZero ()))
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   150
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   151
      return false;
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   152
    }
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   153
  else
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   154
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   155
      return true;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   156
    }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   157
}
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   158
Ipv4Address
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   159
Ipv4RoutingTableEntry::GetGateway (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   160
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   161
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   162
  return m_gateway;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   163
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   164
uint32_t
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   165
Ipv4RoutingTableEntry::GetInterface (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
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);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   168
  return m_interface;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   169
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   170
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   171
Ipv4RoutingTableEntry 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   172
Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest, 
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   173
                                          Ipv4Address nextHop,
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   174
                                          uint32_t interface)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   175
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   176
  NS_LOG_FUNCTION_NOARGS ();
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   177
  return Ipv4RoutingTableEntry (dest, nextHop, interface);
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   178
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   179
Ipv4RoutingTableEntry 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   180
Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest,
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   181
                                          uint32_t interface)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   182
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   183
  NS_LOG_FUNCTION_NOARGS ();
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   184
  return Ipv4RoutingTableEntry (dest, interface);
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   185
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   186
Ipv4RoutingTableEntry 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   187
Ipv4RoutingTableEntry::CreateNetworkRouteTo (Ipv4Address network, 
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   188
                                             Ipv4Mask networkMask,
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   189
                                             Ipv4Address nextHop,
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   190
                                             uint32_t interface)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   191
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   192
  NS_LOG_FUNCTION_NOARGS ();
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   193
  return Ipv4RoutingTableEntry (network, networkMask, 
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   194
                                nextHop, interface);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   195
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   196
Ipv4RoutingTableEntry 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   197
Ipv4RoutingTableEntry::CreateNetworkRouteTo (Ipv4Address network, 
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   198
                                             Ipv4Mask networkMask,
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   199
                                             uint32_t interface)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   200
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   201
  NS_LOG_FUNCTION_NOARGS ();
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   202
  return Ipv4RoutingTableEntry (network, networkMask, 
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   203
                                interface);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   204
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   205
Ipv4RoutingTableEntry 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   206
Ipv4RoutingTableEntry::CreateDefaultRoute (Ipv4Address nextHop, 
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   207
                                           uint32_t interface)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   208
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   209
  NS_LOG_FUNCTION_NOARGS ();
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   210
  return Ipv4RoutingTableEntry (Ipv4Address::GetZero (), nextHop, interface);
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   211
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   212
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   213
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   214
std::ostream& operator<< (std::ostream& os, Ipv4RoutingTableEntry const& route)
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   215
{
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   216
  if (route.IsDefault ())
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   217
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   218
      NS_ASSERT (route.IsGateway ());
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   219
      os << "default out=" << route.GetInterface () << ", next hop=" << route.GetGateway ();
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   220
    }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   221
  else if (route.IsHost ())
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   222
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   223
      if (route.IsGateway ())
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   224
        {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   225
          os << "host="<< route.GetDest () << 
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   226
          ", out=" << route.GetInterface () <<
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   227
          ", next hop=" << route.GetGateway ();
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   228
        }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   229
      else
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   230
        {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   231
          os << "host="<< route.GetDest () << 
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   232
          ", out=" << route.GetInterface ();
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   233
        }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   234
    }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   235
  else if (route.IsNetwork ()) 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   236
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   237
      if (route.IsGateway ())
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   238
        {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   239
          os << "network=" << route.GetDestNetwork () <<
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   240
          ", mask=" << route.GetDestNetworkMask () <<
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   241
          ",out=" << route.GetInterface () <<
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   242
          ", next hop=" << route.GetGateway ();
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   243
        }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   244
      else
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   245
        {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   246
          os << "network=" << route.GetDestNetwork () <<
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   247
          ", mask=" << route.GetDestNetworkMask () <<
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   248
          ",out=" << route.GetInterface ();
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   249
        }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   250
    }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   251
  else
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   252
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   253
      NS_ASSERT (false);
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   254
    }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   255
  return os;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   256
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   257
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   258
/*****************************************************
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   259
 *     Ipv4MulticastRoutingTableEntry
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   260
 *****************************************************/
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   261
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   262
Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry ()
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   263
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   264
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   265
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   266
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   267
Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const &route)
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   268
  :
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   269
    m_origin (route.m_origin),
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   270
    m_group (route.m_group),
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   271
    m_inputInterface (route.m_inputInterface),
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   272
    m_outputInterfaces (route.m_outputInterfaces)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   273
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   274
  NS_LOG_FUNCTION (this << route);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   275
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   276
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   277
Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const *route)
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   278
  :
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   279
    m_origin (route->m_origin),
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   280
    m_group (route->m_group),
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   281
    m_inputInterface (route->m_inputInterface),
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   282
    m_outputInterfaces (route->m_outputInterfaces)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   283
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   284
  NS_LOG_FUNCTION (this << route);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   285
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   286
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   287
Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   288
  Ipv4Address origin, 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   289
  Ipv4Address group, 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   290
  uint32_t inputInterface, 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   291
  std::vector<uint32_t> outputInterfaces)
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   292
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   293
  NS_LOG_FUNCTION (this << origin << group << inputInterface << &outputInterfaces);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   294
  m_origin = origin;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   295
  m_group = group;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   296
  m_inputInterface = inputInterface;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   297
  m_outputInterfaces = outputInterfaces;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   298
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   299
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   300
Ipv4Address 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   301
Ipv4MulticastRoutingTableEntry::GetOrigin (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   302
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   303
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   304
  return m_origin;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   305
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   306
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   307
Ipv4Address 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   308
Ipv4MulticastRoutingTableEntry::GetGroup (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   309
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   310
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   311
  return m_group;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   312
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   313
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   314
uint32_t 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   315
Ipv4MulticastRoutingTableEntry::GetInputInterface (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   316
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   317
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   318
  return m_inputInterface;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   319
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   320
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   321
uint32_t
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   322
Ipv4MulticastRoutingTableEntry::GetNOutputInterfaces (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   323
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   324
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   325
  return m_outputInterfaces.size ();
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   326
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   327
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   328
uint32_t
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   329
Ipv4MulticastRoutingTableEntry::GetOutputInterface (uint32_t n) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   330
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   331
  NS_LOG_FUNCTION (this << n);
7256
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7176
diff changeset
   332
  NS_ASSERT_MSG (n < m_outputInterfaces.size (),
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7176
diff changeset
   333
                 "Ipv4MulticastRoutingTableEntry::GetOutputInterface (): index out of bounds");
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   334
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   335
  return m_outputInterfaces[n];
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   336
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   337
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   338
std::vector<uint32_t>
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   339
Ipv4MulticastRoutingTableEntry::GetOutputInterfaces (void) const
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   340
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   341
  NS_LOG_FUNCTION (this);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   342
  return m_outputInterfaces;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   343
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   344
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   345
Ipv4MulticastRoutingTableEntry 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   346
Ipv4MulticastRoutingTableEntry::CreateMulticastRoute (
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   347
  Ipv4Address origin, 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   348
  Ipv4Address group, 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   349
  uint32_t inputInterface,
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   350
  std::vector<uint32_t> outputInterfaces)
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   351
{
9710
df21b904fce3 Further work on cleaning up function logging of internet module.
Kristijan Lenković <k.lenkovic@me.com>
parents: 7386
diff changeset
   352
  NS_LOG_FUNCTION_NOARGS ();
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   353
  return Ipv4MulticastRoutingTableEntry (origin, group, inputInterface, outputInterfaces);
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   354
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   355
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   356
std::ostream& 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   357
operator<< (std::ostream& os, Ipv4MulticastRoutingTableEntry const& route)
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   358
{
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   359
  os << "origin=" << route.GetOrigin () << 
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   360
  ", group=" << route.GetGroup () <<
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   361
  ", input interface=" << route.GetInputInterface () <<
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
   362
  ", output interfaces=";
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   363
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   364
  for (uint32_t i = 0; i < route.GetNOutputInterfaces (); ++i)
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   365
    {
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   366
      os << route.GetOutputInterface (i) << " ";
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   367
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   368
    }
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   369
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   370
  return os;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   371
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   372
7386
2310ed220a61 standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents: 7385
diff changeset
   373
} // namespace ns3