src/internet-node/i-ipv4-impl.cc
changeset 524 082ffdd8fbd7
parent 522 d5039448597a
child 540 507eababb124
child 568 e1660959ecbb
equal deleted inserted replaced
523:eb380b33ae24 524:082ffdd8fbd7
       
     1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2007 INRIA
       
     4  * All rights reserved.
       
     5  *
       
     6  * This program is free software; you can redistribute it and/or modify
       
     7  * it under the terms of the GNU General Public License version 2 as
       
     8  * published by the Free Software Foundation;
       
     9  *
       
    10  * This program is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13  * GNU General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License
       
    16  * along with this program; if not, write to the Free Software
       
    17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    18  *
       
    19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
       
    20  */
       
    21 #include "i-ipv4-impl.h"
       
    22 #include "ipv4.h"
       
    23 #include "ns3/assert.h"
       
    24 
       
    25 namespace ns3 {
       
    26 
       
    27 IIpv4Impl::IIpv4Impl (Ipv4 *ipv4)
       
    28   : m_ipv4 (ipv4)
       
    29 {
       
    30   m_ipv4->Ref ();
       
    31 }
       
    32 IIpv4Impl::~IIpv4Impl ()
       
    33 {
       
    34   NS_ASSERT (m_ipv4 == 0);
       
    35 }
       
    36 void 
       
    37 IIpv4Impl::DoDispose (void)
       
    38 {
       
    39   m_ipv4->Unref ();
       
    40   m_ipv4 = 0;
       
    41 }
       
    42 
       
    43 void 
       
    44 IIpv4Impl::AddHostRouteTo (Ipv4Address dest, 
       
    45 			   Ipv4Address nextHop, 
       
    46 			   uint32_t interface)
       
    47 {
       
    48   m_ipv4->AddHostRouteTo (dest, nextHop, interface);
       
    49 }
       
    50 void 
       
    51 IIpv4Impl::AddHostRouteTo (Ipv4Address dest, 
       
    52 			   uint32_t interface)
       
    53 {
       
    54   m_ipv4->AddHostRouteTo (dest, interface);
       
    55 }
       
    56 void 
       
    57 IIpv4Impl::AddNetworkRouteTo (Ipv4Address network, 
       
    58 			      Ipv4Mask networkMask, 
       
    59 			      Ipv4Address nextHop, 
       
    60 			      uint32_t interface)
       
    61 {
       
    62   m_ipv4->AddNetworkRouteTo (network, networkMask, nextHop, interface);
       
    63 }
       
    64 void 
       
    65 IIpv4Impl::AddNetworkRouteTo (Ipv4Address network, 
       
    66 			      Ipv4Mask networkMask, 
       
    67 			      uint32_t interface)
       
    68 {
       
    69   m_ipv4->AddNetworkRouteTo (network, networkMask, interface);
       
    70 }
       
    71 void 
       
    72 IIpv4Impl::SetDefaultRoute (Ipv4Address nextHop, 
       
    73 			    uint32_t interface)
       
    74 {
       
    75   m_ipv4->SetDefaultRoute (nextHop, interface);
       
    76 }
       
    77 uint32_t 
       
    78 IIpv4Impl::GetNRoutes (void)
       
    79 {
       
    80   return m_ipv4->GetNRoutes ();
       
    81 }
       
    82 Ipv4Route *
       
    83 IIpv4Impl::GetRoute (uint32_t i)
       
    84 {
       
    85   return m_ipv4->GetRoute (i);
       
    86 }
       
    87 void 
       
    88 IIpv4Impl::RemoveRoute (uint32_t i)
       
    89 {
       
    90   return m_ipv4->RemoveRoute (i);
       
    91 }
       
    92 uint32_t 
       
    93 IIpv4Impl::AddInterface (NetDevice *device)
       
    94 {
       
    95   return m_ipv4->AddInterface (device);
       
    96 }
       
    97 uint32_t 
       
    98 IIpv4Impl::GetNInterfaces (void)
       
    99 {
       
   100   return m_ipv4->GetNInterfaces ();
       
   101 }
       
   102 
       
   103 void 
       
   104 IIpv4Impl::SetAddress (uint32_t i, Ipv4Address address)
       
   105 {
       
   106   m_ipv4->SetAddress (i, address);
       
   107 }
       
   108 void 
       
   109 IIpv4Impl::SetNetworkMask (uint32_t i, Ipv4Mask mask)
       
   110 {
       
   111   m_ipv4->SetNetworkMask (i, mask);
       
   112 }
       
   113 Ipv4Mask 
       
   114 IIpv4Impl::GetNetworkMask (uint32_t i) const
       
   115 {
       
   116   return m_ipv4->GetNetworkMask (i);
       
   117 }
       
   118 Ipv4Address 
       
   119 IIpv4Impl::GetAddress (uint32_t i) const
       
   120 {
       
   121   return m_ipv4->GetAddress (i);
       
   122 }
       
   123 uint16_t 
       
   124 IIpv4Impl::GetMtu (uint32_t i) const
       
   125 {
       
   126   return m_ipv4->GetMtu (i);
       
   127 }
       
   128 bool 
       
   129 IIpv4Impl::IsUp (uint32_t i) const
       
   130 {
       
   131   return m_ipv4->IsUp (i);
       
   132 }
       
   133 void 
       
   134 IIpv4Impl::SetUp (uint32_t i)
       
   135 {
       
   136   m_ipv4->SetUp (i);
       
   137 }
       
   138 void 
       
   139 IIpv4Impl::SetDown (uint32_t i)
       
   140 {
       
   141   m_ipv4->SetDown (i);
       
   142 }
       
   143 
       
   144 }//namespace ns3