00001 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright 2007 University of Washington 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Tom Henderson (tomhend@u.washington.edu) 00019 */ 00020 00021 #include "ns3/assert.h" 00022 #include "ns3/log.h" 00023 #include "ns3/simulation-singleton.h" 00024 #include "ns3/node-container.h" 00025 #include "global-route-manager.h" 00026 #include "global-route-manager-impl.h" 00027 00028 namespace ns3 { 00029 00030 // --------------------------------------------------------------------------- 00031 // 00032 // GlobalRouteManager Implementation 00033 // 00034 // --------------------------------------------------------------------------- 00035 00036 void 00037 GlobalRouteManager::PopulateRoutingTables (void) 00038 { 00039 SelectRouterNodes (); 00040 BuildGlobalRoutingDatabase (); 00041 InitializeRoutes (); 00042 } 00043 00044 void 00045 GlobalRouteManager::PopulateRoutingTables (NodeContainer c) 00046 { 00047 SelectRouterNodes (c); 00048 BuildGlobalRoutingDatabase (); 00049 InitializeRoutes (); 00050 } 00051 00052 void 00053 GlobalRouteManager::RecomputeRoutingTables () 00054 { 00055 DeleteGlobalRoutes (); 00056 BuildGlobalRoutingDatabase (); 00057 InitializeRoutes (); 00058 } 00059 00060 void 00061 GlobalRouteManager::DeleteGlobalRoutes () 00062 { 00063 SimulationSingleton<GlobalRouteManagerImpl>::Get ()-> 00064 DeleteGlobalRoutes (); 00065 } 00066 00067 void 00068 GlobalRouteManager::SelectRouterNodes (void) 00069 { 00070 SimulationSingleton<GlobalRouteManagerImpl>::Get ()-> 00071 SelectRouterNodes (); 00072 } 00073 00074 void 00075 GlobalRouteManager::SelectRouterNodes (NodeContainer c) 00076 { 00077 SimulationSingleton<GlobalRouteManagerImpl>::Get ()-> 00078 SelectRouterNodes (c); 00079 } 00080 00081 void 00082 GlobalRouteManager::BuildGlobalRoutingDatabase (void) 00083 { 00084 SimulationSingleton<GlobalRouteManagerImpl>::Get ()-> 00085 BuildGlobalRoutingDatabase (); 00086 } 00087 00088 void 00089 GlobalRouteManager::InitializeRoutes (void) 00090 { 00091 SimulationSingleton<GlobalRouteManagerImpl>::Get ()-> 00092 InitializeRoutes (); 00093 } 00094 00095 uint32_t 00096 GlobalRouteManager::AllocateRouterId (void) 00097 { 00098 static uint32_t routerId = 0; 00099 return routerId++; 00100 } 00101 00102 00103 } // namespace ns3