src/internet/model/global-route-manager.cc
author Kristijan Lenkovi? <k.lenkovic@me.com>
Sat, 20 Apr 2013 00:29:36 +0200
changeset 9704 1db7690f8e8f
parent 7176 9f2663992e99
child 10968 2d29fee2b7b8
permissions -rw-r--r--
Partially clean up function logging of internet module.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1111
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
/*
1457
562a7017ed93 Copyrights/licenses for routing code
Tom Henderson <tomh@tomh.org>
parents: 1121
diff changeset
     3
 * Copyright 2007 University of Washington
562a7017ed93 Copyrights/licenses for routing code
Tom Henderson <tomh@tomh.org>
parents: 1121
diff changeset
     4
 * 
1111
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     8
 *
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
 * GNU General Public License for more details.
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
 *
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1457
562a7017ed93 Copyrights/licenses for routing code
Tom Henderson <tomh@tomh.org>
parents: 1121
diff changeset
    17
 *
1505
286ec92f4113 debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1457
diff changeset
    18
 * Author: Tom Henderson (tomhend@u.washington.edu)
1111
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    19
 */
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    20
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    21
#include "ns3/assert.h"
1505
286ec92f4113 debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1457
diff changeset
    22
#include "ns3/log.h"
1111
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    23
#include "ns3/simulation-singleton.h"
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
#include "global-route-manager.h"
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
#include "global-route-manager-impl.h"
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
9704
1db7690f8e8f Partially clean up function logging of internet module.
Kristijan Lenkovi? <k.lenkovic@me.com>
parents: 7176
diff changeset
    27
NS_LOG_COMPONENT_DEFINE ("GlobalRouteManager");
1db7690f8e8f Partially clean up function logging of internet module.
Kristijan Lenkovi? <k.lenkovic@me.com>
parents: 7176
diff changeset
    28
1111
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    29
namespace ns3 {
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    31
// ---------------------------------------------------------------------------
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    32
//
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    33
// GlobalRouteManager Implementation
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    34
//
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    35
// ---------------------------------------------------------------------------
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    37
void
3959
ec65107df095 Segregate Ipv4GlobalRouting from Ipv4StaticRouting; add API for deleting and recomputing global routes
Tom Henderson <tomh@tomh.org>
parents: 3937
diff changeset
    38
GlobalRouteManager::DeleteGlobalRoutes ()
ec65107df095 Segregate Ipv4GlobalRouting from Ipv4StaticRouting; add API for deleting and recomputing global routes
Tom Henderson <tomh@tomh.org>
parents: 3937
diff changeset
    39
{
9704
1db7690f8e8f Partially clean up function logging of internet module.
Kristijan Lenkovi? <k.lenkovic@me.com>
parents: 7176
diff changeset
    40
  NS_LOG_FUNCTION_NOARGS ();
3959
ec65107df095 Segregate Ipv4GlobalRouting from Ipv4StaticRouting; add API for deleting and recomputing global routes
Tom Henderson <tomh@tomh.org>
parents: 3937
diff changeset
    41
  SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    42
  DeleteGlobalRoutes ();
3959
ec65107df095 Segregate Ipv4GlobalRouting from Ipv4StaticRouting; add API for deleting and recomputing global routes
Tom Henderson <tomh@tomh.org>
parents: 3937
diff changeset
    43
}
ec65107df095 Segregate Ipv4GlobalRouting from Ipv4StaticRouting; add API for deleting and recomputing global routes
Tom Henderson <tomh@tomh.org>
parents: 3937
diff changeset
    44
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    45
void
3937
04f9377661b8 convince global routing not to crash in the presence of bridges
Craig Dowell <craigdo@ee.washington.edu>
parents: 1505
diff changeset
    46
GlobalRouteManager::BuildGlobalRoutingDatabase (void) 
1111
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    47
{
9704
1db7690f8e8f Partially clean up function logging of internet module.
Kristijan Lenkovi? <k.lenkovic@me.com>
parents: 7176
diff changeset
    48
  NS_LOG_FUNCTION_NOARGS ();
1113
5b63b39161e7 remove routing environment, move router interface creation to global-route-manager
Craig Dowell <craigdo@ee.washington.edu>
parents: 1111
diff changeset
    49
  SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    50
  BuildGlobalRoutingDatabase ();
1111
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    51
}
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    52
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    53
void
3937
04f9377661b8 convince global routing not to crash in the presence of bridges
Craig Dowell <craigdo@ee.washington.edu>
parents: 1505
diff changeset
    54
GlobalRouteManager::InitializeRoutes (void)
1111
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    55
{
9704
1db7690f8e8f Partially clean up function logging of internet module.
Kristijan Lenkovi? <k.lenkovic@me.com>
parents: 7176
diff changeset
    56
  NS_LOG_FUNCTION_NOARGS ();
1113
5b63b39161e7 remove routing environment, move router interface creation to global-route-manager
Craig Dowell <craigdo@ee.washington.edu>
parents: 1111
diff changeset
    57
  SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    58
  InitializeRoutes ();
1111
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    59
}
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    60
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    61
uint32_t
3937
04f9377661b8 convince global routing not to crash in the presence of bridges
Craig Dowell <craigdo@ee.washington.edu>
parents: 1505
diff changeset
    62
GlobalRouteManager::AllocateRouterId (void)
1113
5b63b39161e7 remove routing environment, move router interface creation to global-route-manager
Craig Dowell <craigdo@ee.washington.edu>
parents: 1111
diff changeset
    63
{
9704
1db7690f8e8f Partially clean up function logging of internet module.
Kristijan Lenkovi? <k.lenkovic@me.com>
parents: 7176
diff changeset
    64
  NS_LOG_FUNCTION_NOARGS ();
1113
5b63b39161e7 remove routing environment, move router interface creation to global-route-manager
Craig Dowell <craigdo@ee.washington.edu>
parents: 1111
diff changeset
    65
  static uint32_t routerId = 0;
5b63b39161e7 remove routing environment, move router interface creation to global-route-manager
Craig Dowell <craigdo@ee.washington.edu>
parents: 1111
diff changeset
    66
  return routerId++;
5b63b39161e7 remove routing environment, move router interface creation to global-route-manager
Craig Dowell <craigdo@ee.washington.edu>
parents: 1111
diff changeset
    67
}
5b63b39161e7 remove routing environment, move router interface creation to global-route-manager
Craig Dowell <craigdo@ee.washington.edu>
parents: 1111
diff changeset
    68
5b63b39161e7 remove routing environment, move router interface creation to global-route-manager
Craig Dowell <craigdo@ee.washington.edu>
parents: 1111
diff changeset
    69
1111
835cd416a0a8 rename party
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    70
} // namespace ns3