diff -r 96811f76c3e2 bindings/python/ns3_module_core.py --- a/bindings/python/ns3_module_core.py Mon Jun 22 18:29:43 2009 -0700 +++ b/bindings/python/ns3_module_core.py Tue Jun 23 13:19:19 2009 +0200 @@ -2043,7 +2043,7 @@ cls.add_method('ConnectWithoutContext', 'void', [param('ns3::CallbackBase const &', 'cb')]) - ## traced-value.h: void ns3::TracedValue::Connect(ns3::CallbackBase const & cb, std::basic_string,std::allocator > path) [member function] + ## traced-value.h: void ns3::TracedValue::Connect(ns3::CallbackBase const & cb, std::string path) [member function] cls.add_method('Connect', 'void', [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')]) @@ -2051,7 +2051,7 @@ cls.add_method('DisconnectWithoutContext', 'void', [param('ns3::CallbackBase const &', 'cb')]) - ## traced-value.h: void ns3::TracedValue::Disconnect(ns3::CallbackBase const & cb, std::basic_string,std::allocator > path) [member function] + ## traced-value.h: void ns3::TracedValue::Disconnect(ns3::CallbackBase const & cb, std::string path) [member function] cls.add_method('Disconnect', 'void', [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')]) @@ -2199,7 +2199,7 @@ module.add_function('TypeNameGet', 'std::string', [], - template_parameters=['long']) + template_parameters=['long long']) ## type-name.h: extern std::string ns3::TypeNameGet() [free function] module.add_function('TypeNameGet', 'std::string', @@ -2219,7 +2219,7 @@ module.add_function('TypeNameGet', 'std::string', [], - template_parameters=['unsigned long']) + template_parameters=['unsigned long long']) ## type-name.h: extern std::string ns3::TypeNameGet() [free function] module.add_function('TypeNameGet', 'std::string', diff -r 96811f76c3e2 bindings/python/ns3_module_global_routing.py --- a/bindings/python/ns3_module_global_routing.py Mon Jun 22 18:29:43 2009 -0700 +++ b/bindings/python/ns3_module_global_routing.py Tue Jun 23 13:19:19 2009 +0200 @@ -17,6 +17,8 @@ module.add_enum('LinkType', ['Unknown', 'PointToPoint', 'TransitNetwork', 'StubNetwork', 'VirtualLink'], outer_class=root_module['ns3::GlobalRoutingLinkRecord']) ## global-router-interface.h: ns3::GlobalRouter [class] module.add_class('GlobalRouter', is_singleton=True, parent=root_module['ns3::Object']) + ## ipv4-global-routing.h: ns3::Ipv4GlobalRouting [class] + module.add_class('Ipv4GlobalRouting', parent=root_module['ns3::Ipv4RoutingProtocol']) ## Register a nested module for the namespace Config @@ -73,6 +75,7 @@ register_Ns3GlobalRoutingLSA_methods(root_module, root_module['ns3::GlobalRoutingLSA']) register_Ns3GlobalRoutingLinkRecord_methods(root_module, root_module['ns3::GlobalRoutingLinkRecord']) register_Ns3GlobalRouter_methods(root_module, root_module['ns3::GlobalRouter']) + register_Ns3Ipv4GlobalRouting_methods(root_module, root_module['ns3::Ipv4GlobalRouting']) return def register_Ns3GlobalRouteManager_methods(root_module, cls): @@ -81,31 +84,11 @@ 'void', [], is_static=True) - ## global-route-manager.h: static void ns3::GlobalRouteManager::PopulateRoutingTables(ns3::NodeContainer c) [member function] - cls.add_method('PopulateRoutingTables', - 'void', - [param('ns3::NodeContainer', 'c')], - is_static=True) ## global-route-manager.h: static void ns3::GlobalRouteManager::RecomputeRoutingTables() [member function] cls.add_method('RecomputeRoutingTables', 'void', [], is_static=True) - ## global-route-manager.h: static void ns3::GlobalRouteManager::DeleteGlobalRoutes() [member function] - cls.add_method('DeleteGlobalRoutes', - 'void', - [], - is_static=True) - ## global-route-manager.h: static void ns3::GlobalRouteManager::SelectRouterNodes() [member function] - cls.add_method('SelectRouterNodes', - 'void', - [], - is_static=True) - ## global-route-manager.h: static void ns3::GlobalRouteManager::SelectRouterNodes(ns3::NodeContainer c) [member function] - cls.add_method('SelectRouterNodes', - 'void', - [param('ns3::NodeContainer', 'c')], - is_static=True) ## global-route-manager.h: static uint32_t ns3::GlobalRouteManager::AllocateRouterId() [member function] cls.add_method('AllocateRouterId', 'uint32_t', @@ -267,6 +250,14 @@ is_static=True) ## global-router-interface.h: ns3::GlobalRouter::GlobalRouter() [constructor] cls.add_constructor([]) + ## global-router-interface.h: void ns3::GlobalRouter::SetRoutingProtocol(ns3::Ptr routing) [member function] + cls.add_method('SetRoutingProtocol', + 'void', + [param('ns3::Ptr< ns3::Ipv4GlobalRouting >', 'routing')]) + ## global-router-interface.h: ns3::Ptr ns3::GlobalRouter::GetRoutingProtocol() [member function] + cls.add_method('GetRoutingProtocol', + 'ns3::Ptr< ns3::Ipv4GlobalRouting >', + []) ## global-router-interface.h: ns3::Ipv4Address ns3::GlobalRouter::GetRouterId() const [member function] cls.add_method('GetRouterId', 'ns3::Ipv4Address', @@ -293,6 +284,86 @@ visibility='private', is_virtual=True) return +def register_Ns3Ipv4GlobalRouting_methods(root_module, cls): + ## ipv4-global-routing.h: ns3::Ipv4GlobalRouting::Ipv4GlobalRouting(ns3::Ipv4GlobalRouting const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Ipv4GlobalRouting const &', 'arg0')]) + ## ipv4-global-routing.h: static ns3::TypeId ns3::Ipv4GlobalRouting::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## ipv4-global-routing.h: ns3::Ipv4GlobalRouting::Ipv4GlobalRouting() [constructor] + cls.add_constructor([]) + ## ipv4-global-routing.h: ns3::Ptr ns3::Ipv4GlobalRouting::RouteOutput(ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function] + cls.add_method('RouteOutput', + 'ns3::Ptr< ns3::Ipv4Route >', + [param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')], + is_virtual=True) + ## ipv4-global-routing.h: bool ns3::Ipv4GlobalRouting::RouteInput(ns3::Ptr p, ns3::Ipv4Header const & header, ns3::Ptr idev, ns3::Callback,ns3::Ptr,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback,ns3::Ptr,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function] + cls.add_method('RouteInput', + 'bool', + [param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')], + is_virtual=True) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::NotifyInterfaceUp(uint32_t interface) [member function] + cls.add_method('NotifyInterfaceUp', + 'void', + [param('uint32_t', 'interface')], + is_virtual=True) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::NotifyInterfaceDown(uint32_t interface) [member function] + cls.add_method('NotifyInterfaceDown', + 'void', + [param('uint32_t', 'interface')], + is_virtual=True) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::NotifyAddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function] + cls.add_method('NotifyAddAddress', + 'void', + [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], + is_virtual=True) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::NotifyRemoveAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function] + cls.add_method('NotifyRemoveAddress', + 'void', + [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], + is_virtual=True) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::SetIpv4(ns3::Ptr ipv4) [member function] + cls.add_method('SetIpv4', + 'void', + [param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')], + is_virtual=True) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function] + cls.add_method('AddHostRouteTo', + 'void', + [param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')]) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function] + cls.add_method('AddHostRouteTo', + 'void', + [param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')]) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function] + cls.add_method('AddNetworkRouteTo', + 'void', + [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')]) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function] + cls.add_method('AddNetworkRouteTo', + 'void', + [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')]) + ## ipv4-global-routing.h: uint32_t ns3::Ipv4GlobalRouting::GetNRoutes() [member function] + cls.add_method('GetNRoutes', + 'uint32_t', + []) + ## ipv4-global-routing.h: ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) [member function] + cls.add_method('GetRoute', + 'ns3::Ipv4RoutingTableEntry *', + [param('uint32_t', 'i')]) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::RemoveRoute(uint32_t i) [member function] + cls.add_method('RemoveRoute', + 'void', + [param('uint32_t', 'i')]) + ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::DoDispose() [member function] + cls.add_method('DoDispose', + 'void', + [], + visibility='protected', is_virtual=True) + return + def register_functions(root_module): module = root_module register_functions_ns3_Config(module.get_submodule('Config'), root_module) diff -r 96811f76c3e2 bindings/python/ns3_module_helper.py --- a/bindings/python/ns3_module_helper.py Mon Jun 22 18:29:43 2009 -0700 +++ b/bindings/python/ns3_module_helper.py Tue Jun 23 13:19:19 2009 +0200 @@ -17,8 +17,10 @@ module.add_class('Ipv4AddressHelper', allow_subclassing=False) ## ipv4-interface-container.h: ns3::Ipv4InterfaceContainer [class] module.add_class('Ipv4InterfaceContainer') + ## ipv4-routing-helper.h: ns3::Ipv4RoutingHelper [class] + module.add_class('Ipv4RoutingHelper', allow_subclassing=False) ## ipv4-static-routing-helper.h: ns3::Ipv4StaticRoutingHelper [class] - module.add_class('Ipv4StaticRoutingHelper', allow_subclassing=False) + module.add_class('Ipv4StaticRoutingHelper', allow_subclassing=False, parent=root_module['ns3::Ipv4RoutingHelper']) ## mobility-helper.h: ns3::MobilityHelper [class] module.add_class('MobilityHelper', allow_subclassing=False) ## net-device-container.h: ns3::NetDeviceContainer [class] @@ -28,7 +30,7 @@ ## ns2-mobility-helper.h: ns3::Ns2MobilityHelper [class] module.add_class('Ns2MobilityHelper', allow_subclassing=False) ## olsr-helper.h: ns3::OlsrHelper [class] - module.add_class('OlsrHelper', allow_subclassing=False) + module.add_class('OlsrHelper', allow_subclassing=False, parent=root_module['ns3::Ipv4RoutingHelper']) ## on-off-helper.h: ns3::OnOffHelper [class] module.add_class('OnOffHelper', allow_subclassing=False) ## packet-sink-helper.h: ns3::PacketSinkHelper [class] @@ -57,6 +59,10 @@ module.add_class('YansWifiPhyHelper', allow_subclassing=False, parent=root_module['ns3::WifiPhyHelper']) ## yans-wifi-helper.h: ns3::YansWifiPhyHelper::PcapFormat [enumeration] module.add_enum('PcapFormat', ['PCAP_FORMAT_80211', 'PCAP_FORMAT_80211_PRISM', 'PCAP_FORMAT_80211_RADIOTAP'], outer_class=root_module['ns3::YansWifiPhyHelper']) + ## ipv4-global-routing-helper.h: ns3::Ipv4GlobalRoutingHelper [class] + module.add_class('Ipv4GlobalRoutingHelper', allow_subclassing=False, parent=root_module['ns3::Ipv4RoutingHelper']) + ## ipv4-list-routing-helper.h: ns3::Ipv4ListRoutingHelper [class] + module.add_class('Ipv4ListRoutingHelper', allow_subclassing=False, parent=root_module['ns3::Ipv4RoutingHelper']) ## nqos-wifi-mac-helper.h: ns3::NqosWifiMacHelper [class] module.add_class('NqosWifiMacHelper', allow_subclassing=False, parent=root_module['ns3::WifiMacHelper']) ## qos-wifi-mac-helper.h: ns3::QosWifiMacHelper [class] @@ -120,6 +126,7 @@ register_Ns3InternetStackHelper_methods(root_module, root_module['ns3::InternetStackHelper']) register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper']) register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer']) + register_Ns3Ipv4RoutingHelper_methods(root_module, root_module['ns3::Ipv4RoutingHelper']) register_Ns3Ipv4StaticRoutingHelper_methods(root_module, root_module['ns3::Ipv4StaticRoutingHelper']) register_Ns3MobilityHelper_methods(root_module, root_module['ns3::MobilityHelper']) register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer']) @@ -139,6 +146,8 @@ register_Ns3WifiPhyHelper_methods(root_module, root_module['ns3::WifiPhyHelper']) register_Ns3YansWifiChannelHelper_methods(root_module, root_module['ns3::YansWifiChannelHelper']) register_Ns3YansWifiPhyHelper_methods(root_module, root_module['ns3::YansWifiPhyHelper']) + register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, root_module['ns3::Ipv4GlobalRoutingHelper']) + register_Ns3Ipv4ListRoutingHelper_methods(root_module, root_module['ns3::Ipv4ListRoutingHelper']) register_Ns3NqosWifiMacHelper_methods(root_module, root_module['ns3::NqosWifiMacHelper']) register_Ns3QosWifiMacHelper_methods(root_module, root_module['ns3::QosWifiMacHelper']) return @@ -420,6 +429,10 @@ cls.add_constructor([param('ns3::InternetStackHelper const &', 'arg0')]) ## internet-stack-helper.h: ns3::InternetStackHelper::InternetStackHelper() [constructor] cls.add_constructor([]) + ## internet-stack-helper.h: void ns3::InternetStackHelper::SetRoutingHelper(ns3::Ipv4RoutingHelper const & routing) [member function] + cls.add_method('SetRoutingHelper', + 'void', + [param('ns3::Ipv4RoutingHelper const &', 'routing')]) ## internet-stack-helper.h: void ns3::InternetStackHelper::Install(std::string nodeName) const [member function] cls.add_method('Install', 'void', @@ -435,6 +448,11 @@ 'void', [param('ns3::NodeContainer', 'c')], is_const=True) + ## internet-stack-helper.h: void ns3::InternetStackHelper::InstallAll() const [member function] + cls.add_method('InstallAll', + 'void', + [], + is_const=True) ## internet-stack-helper.h: void ns3::InternetStackHelper::SetTcp(std::string tid) [member function] cls.add_method('SetTcp', 'void', @@ -516,11 +534,28 @@ [param('std::string', 'ipv4Name'), param('uint32_t', 'interface')]) return +def register_Ns3Ipv4RoutingHelper_methods(root_module, cls): + ## ipv4-routing-helper.h: ns3::Ipv4RoutingHelper::Ipv4RoutingHelper(ns3::Ipv4RoutingHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Ipv4RoutingHelper const &', 'arg0')]) + ## ipv4-routing-helper.h: ns3::Ipv4RoutingHelper::Ipv4RoutingHelper() [constructor] + cls.add_constructor([]) + ## ipv4-routing-helper.h: ns3::Ptr ns3::Ipv4RoutingHelper::Create(ns3::Ptr node) const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::Ipv4RoutingProtocol >', + [param('ns3::Ptr< ns3::Node >', 'node')], + is_pure_virtual=True, is_const=True, is_virtual=True) + return + def register_Ns3Ipv4StaticRoutingHelper_methods(root_module, cls): ## ipv4-static-routing-helper.h: ns3::Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper(ns3::Ipv4StaticRoutingHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4StaticRoutingHelper const &', 'arg0')]) ## ipv4-static-routing-helper.h: ns3::Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper() [constructor] cls.add_constructor([]) + ## ipv4-static-routing-helper.h: ns3::Ptr ns3::Ipv4StaticRoutingHelper::Create(ns3::Ptr node) const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::Ipv4RoutingProtocol >', + [param('ns3::Ptr< ns3::Node >', 'node')], + is_const=True, is_virtual=True) ## ipv4-static-routing-helper.h: ns3::Ptr ns3::Ipv4StaticRoutingHelper::GetStaticRouting(ns3::Ptr ipv4) const [member function] cls.add_method('GetStaticRouting', 'ns3::Ptr< ns3::Ipv4StaticRouting >', @@ -752,26 +787,15 @@ cls.add_constructor([param('ns3::OlsrHelper const &', 'arg0')]) ## olsr-helper.h: ns3::OlsrHelper::OlsrHelper() [constructor] cls.add_constructor([]) - ## olsr-helper.h: void ns3::OlsrHelper::SetAgent(std::string tid, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function] - cls.add_method('SetAgent', + ## olsr-helper.h: ns3::Ptr ns3::OlsrHelper::Create(ns3::Ptr node) const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::Ipv4RoutingProtocol >', + [param('ns3::Ptr< ns3::Node >', 'node')], + is_const=True, is_virtual=True) + ## olsr-helper.h: void ns3::OlsrHelper::Set(std::string name, ns3::AttributeValue const & value) [member function] + cls.add_method('Set', 'void', - [param('std::string', 'tid'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')]) - ## olsr-helper.h: void ns3::OlsrHelper::Install(ns3::NodeContainer container) [member function] - cls.add_method('Install', - 'void', - [param('ns3::NodeContainer', 'container')]) - ## olsr-helper.h: void ns3::OlsrHelper::Install(ns3::Ptr node) [member function] - cls.add_method('Install', - 'void', - [param('ns3::Ptr< ns3::Node >', 'node')]) - ## olsr-helper.h: void ns3::OlsrHelper::Install(std::string nodeName) [member function] - cls.add_method('Install', - 'void', - [param('std::string', 'nodeName')]) - ## olsr-helper.h: void ns3::OlsrHelper::InstallAll() [member function] - cls.add_method('InstallAll', - 'void', - []) + [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) return def register_Ns3OnOffHelper_methods(root_module, cls): @@ -1217,6 +1241,44 @@ is_const=True, visibility='private', is_virtual=True) return +def register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, cls): + ## ipv4-global-routing-helper.h: ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper(ns3::Ipv4GlobalRoutingHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Ipv4GlobalRoutingHelper const &', 'arg0')]) + ## ipv4-global-routing-helper.h: ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper() [constructor] + cls.add_constructor([]) + ## ipv4-global-routing-helper.h: ns3::Ptr ns3::Ipv4GlobalRoutingHelper::Create(ns3::Ptr node) const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::Ipv4RoutingProtocol >', + [param('ns3::Ptr< ns3::Node >', 'node')], + is_const=True, is_virtual=True) + ## ipv4-global-routing-helper.h: static void ns3::Ipv4GlobalRoutingHelper::PopulateRoutingTables() [member function] + cls.add_method('PopulateRoutingTables', + 'void', + [], + is_static=True) + ## ipv4-global-routing-helper.h: static void ns3::Ipv4GlobalRoutingHelper::RecomputeRoutingTables() [member function] + cls.add_method('RecomputeRoutingTables', + 'void', + [], + is_static=True) + return + +def register_Ns3Ipv4ListRoutingHelper_methods(root_module, cls): + ## ipv4-list-routing-helper.h: ns3::Ipv4ListRoutingHelper::Ipv4ListRoutingHelper(ns3::Ipv4ListRoutingHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Ipv4ListRoutingHelper const &', 'arg0')]) + ## ipv4-list-routing-helper.h: ns3::Ipv4ListRoutingHelper::Ipv4ListRoutingHelper() [constructor] + cls.add_constructor([]) + ## ipv4-list-routing-helper.h: void ns3::Ipv4ListRoutingHelper::Add(ns3::Ipv4RoutingHelper const & routing, int16_t priority) [member function] + cls.add_method('Add', + 'void', + [param('ns3::Ipv4RoutingHelper const &', 'routing'), param('int16_t', 'priority')]) + ## ipv4-list-routing-helper.h: ns3::Ptr ns3::Ipv4ListRoutingHelper::Create(ns3::Ptr node) const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::Ipv4RoutingProtocol >', + [param('ns3::Ptr< ns3::Node >', 'node')], + is_const=True, is_virtual=True) + return + def register_Ns3NqosWifiMacHelper_methods(root_module, cls): ## nqos-wifi-mac-helper.h: ns3::NqosWifiMacHelper::NqosWifiMacHelper(ns3::NqosWifiMacHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::NqosWifiMacHelper const &', 'arg0')]) diff -r 96811f76c3e2 bindings/python/ns3_module_internet_stack.py --- a/bindings/python/ns3_module_internet_stack.py Mon Jun 22 18:29:43 2009 -0700 +++ b/bindings/python/ns3_module_internet_stack.py Tue Jun 23 13:19:19 2009 +0200 @@ -172,6 +172,11 @@ 'uint16_t', [], is_const=True) + ## icmpv4.h: uint32_t ns3::Icmpv4Echo::GetDataSize() const [member function] + cls.add_method('GetDataSize', + 'uint32_t', + [], + is_const=True) ## icmpv4.h: uint32_t ns3::Icmpv4Echo::GetData(uint8_t * payload) const [member function] cls.add_method('GetData', 'uint32_t', diff -r 96811f76c3e2 bindings/python/ns3_module_olsr.py --- a/bindings/python/ns3_module_olsr.py Mon Jun 22 18:29:43 2009 -0700 +++ b/bindings/python/ns3_module_olsr.py Tue Jun 23 13:19:19 2009 +0200 @@ -102,13 +102,13 @@ module.add_container('std::vector< ns3::olsr::MessageHeader::Hello::LinkMessage >', 'ns3::olsr::MessageHeader::Hello::LinkMessage', container_type='vector') module.add_container('std::vector< ns3::olsr::MessageHeader::Hna::Association >', 'ns3::olsr::MessageHeader::Hna::Association', container_type='vector') typehandlers.add_type_alias('std::vector< ns3::olsr::DuplicateTuple, std::allocator< ns3::olsr::DuplicateTuple > >', 'ns3::olsr::DuplicateSet') - typehandlers.add_type_alias('std::vector< ns3::olsr::TopologyTuple, std::allocator< ns3::olsr::TopologyTuple > >', 'ns3::olsr::TopologySet') typehandlers.add_type_alias('std::set< ns3::Ipv4Address, std::less< ns3::Ipv4Address >, std::allocator< ns3::Ipv4Address > >', 'ns3::olsr::MprSet') typehandlers.add_type_alias('std::vector< ns3::olsr::MprSelectorTuple, std::allocator< ns3::olsr::MprSelectorTuple > >', 'ns3::olsr::MprSelectorSet') typehandlers.add_type_alias('std::vector< ns3::olsr::MessageHeader, std::allocator< ns3::olsr::MessageHeader > >', 'ns3::olsr::MessageList') typehandlers.add_type_alias('std::vector< ns3::olsr::IfaceAssocTuple, std::allocator< ns3::olsr::IfaceAssocTuple > >', 'ns3::olsr::IfaceAssocSet') typehandlers.add_type_alias('std::vector< ns3::olsr::NeighborTuple, std::allocator< ns3::olsr::NeighborTuple > >', 'ns3::olsr::NeighborSet') typehandlers.add_type_alias('std::vector< ns3::olsr::TwoHopNeighborTuple, std::allocator< ns3::olsr::TwoHopNeighborTuple > >', 'ns3::olsr::TwoHopNeighborSet') + typehandlers.add_type_alias('std::vector< ns3::olsr::TopologyTuple, std::allocator< ns3::olsr::TopologyTuple > >', 'ns3::olsr::TopologySet') typehandlers.add_type_alias('std::vector< ns3::olsr::LinkTuple, std::allocator< ns3::olsr::LinkTuple > >', 'ns3::olsr::LinkSet') def register_methods(root_module): @@ -747,10 +747,6 @@ is_static=True) ## olsr-routing-protocol.h: ns3::olsr::RoutingProtocol::RoutingProtocol() [constructor] cls.add_constructor([]) - ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::Start() [member function] - cls.add_method('Start', - 'void', - []) ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::SetMainInterface(uint32_t interface) [member function] cls.add_method('SetMainInterface', 'void', diff -r 96811f76c3e2 examples/csma-bridge-one-hop.cc --- a/examples/csma-bridge-one-hop.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/csma-bridge-one-hop.cc Tue Jun 23 13:19:19 2009 +0200 @@ -74,7 +74,6 @@ #include "ns3/core-module.h" #include "ns3/helper-module.h" #include "ns3/bridge-module.h" -#include "ns3/global-route-manager.h" using namespace ns3; @@ -142,9 +141,10 @@ BridgeHelper bridge; bridge.Install (bridge1, topBridgeDevices); - // Add internet stack to the topLan nodes + // Add internet stack to the router nodes + NodeContainer routerNodes (n0, n1, n2, n3, n4); InternetStackHelper internet; - internet.Install (topLan); + internet.Install (routerNodes); // Repeat for bottom bridged LAN NetDeviceContainer bottomLanDevices; @@ -158,9 +158,6 @@ } bridge.Install (bridge2, bottomBridgeDevices); - // Add internet stack to the bottomLan nodes - internet.Install (NodeContainer (n3, n4)); - // We've got the "hardware" in place. Now we need to add IP addresses. NS_LOG_INFO ("Assign IP Addresses."); Ipv4AddressHelper ipv4; @@ -174,8 +171,7 @@ // tables in the nodes. We excuse the bridge nodes from having to serve as // routers, since they don't even have internet stacks on them. // - NodeContainer routerNodes (n0, n1, n2, n3, n4); - GlobalRouteManager::PopulateRoutingTables (routerNodes); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); // // Create an OnOff application to send UDP datagrams from node zero to node 1. diff -r 96811f76c3e2 examples/csma-ping.cc --- a/examples/csma-ping.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/csma-ping.cc Tue Jun 23 13:19:19 2009 +0200 @@ -37,7 +37,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-route-manager.h" using namespace ns3; @@ -85,7 +84,7 @@ Ipv4InterfaceContainer addresses = ip.Assign (devs); // setup global router - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); NS_LOG_INFO ("Create Source"); Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2")); InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3)); diff -r 96811f76c3e2 examples/csma-star.cc --- a/examples/csma-star.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/csma-star.cc Tue Jun 23 13:19:19 2009 +0200 @@ -20,7 +20,6 @@ #include "ns3/node-module.h" #include "ns3/helper-module.h" #include "ns3/csma-module.h" -#include "ns3/global-route-manager.h" // Network topology (default) // @@ -196,7 +195,7 @@ // // Turn on global static routing so we can actually be routed across the star. // - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); NS_LOG_INFO ("Enable pcap tracing."); // diff -r 96811f76c3e2 examples/dynamic-global-routing.cc --- a/examples/dynamic-global-routing.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/dynamic-global-routing.cc Tue Jun 23 13:19:19 2009 +0200 @@ -79,7 +79,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-route-manager.h" using namespace ns3; @@ -145,7 +144,7 @@ // Create router nodes, initialize routing database and set up the routing // tables in the nodes. - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s @@ -204,9 +203,9 @@ uint32_t ipv4ifIndex1 = 2; Simulator::Schedule (Seconds (2),&Ipv4::SetDown,ipv41, ipv4ifIndex1); - Simulator::Schedule (Seconds (3),&GlobalRouteManager::RecomputeRoutingTables); + Simulator::Schedule (Seconds (3),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables); Simulator::Schedule (Seconds (4),&Ipv4::SetUp,ipv41, ipv4ifIndex1); - Simulator::Schedule (Seconds (5),&GlobalRouteManager::RecomputeRoutingTables); + Simulator::Schedule (Seconds (5),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables); Ptr n6 = c.Get (6); Ptr ipv46 = n6->GetObject (); @@ -214,14 +213,14 @@ // then the next p2p is numbered 2 uint32_t ipv4ifIndex6 = 2; Simulator::Schedule (Seconds (6),&Ipv4::SetDown,ipv46, ipv4ifIndex6); - Simulator::Schedule (Seconds (7),&GlobalRouteManager::RecomputeRoutingTables); + Simulator::Schedule (Seconds (7),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables); Simulator::Schedule (Seconds (8),&Ipv4::SetUp,ipv46, ipv4ifIndex6); - Simulator::Schedule (Seconds (9),&GlobalRouteManager::RecomputeRoutingTables); + Simulator::Schedule (Seconds (9),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables); Simulator::Schedule (Seconds (12),&Ipv4::SetDown,ipv41, ipv4ifIndex1); - Simulator::Schedule (Seconds (13),&GlobalRouteManager::RecomputeRoutingTables); + Simulator::Schedule (Seconds (13),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables); Simulator::Schedule (Seconds (14),&Ipv4::SetUp,ipv41, ipv4ifIndex1); - Simulator::Schedule (Seconds (15),&GlobalRouteManager::RecomputeRoutingTables); + Simulator::Schedule (Seconds (15),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables); NS_LOG_INFO ("Run Simulation."); Simulator::Run (); diff -r 96811f76c3e2 examples/global-routing-slash32.cc --- a/examples/global-routing-slash32.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/global-routing-slash32.cc Tue Jun 23 13:19:19 2009 +0200 @@ -29,7 +29,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-route-manager.h" using namespace ns3; @@ -99,7 +98,7 @@ // Create router nodes, initialize routing database and set up the routing // tables in the nodes. - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s diff -r 96811f76c3e2 examples/mixed-global-routing.cc --- a/examples/mixed-global-routing.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/mixed-global-routing.cc Tue Jun 23 13:19:19 2009 +0200 @@ -40,7 +40,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-route-manager.h" using namespace ns3; @@ -104,7 +103,7 @@ // Create router nodes, initialize routing database and set up the routing // tables in the nodes. - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s diff -r 96811f76c3e2 examples/mixed-wireless.cc --- a/examples/mixed-wireless.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/mixed-wireless.cc Tue Jun 23 13:19:19 2009 +0200 @@ -67,7 +67,6 @@ #include "ns3/mobility-module.h" #include "ns3/contrib-module.h" #include "ns3/wifi-module.h" -#include "ns3/global-route-manager.h" using namespace ns3; @@ -152,11 +151,21 @@ YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); NetDeviceContainer backboneDevices = wifi.Install (wifiPhy, mac, backbone); + + // We enable OLSR (which will be consulted at a higher priority than + // the global routing) on the backbone ad hoc nodes + NS_LOG_INFO ("Enabling OLSR routing on all backbone nodes"); + OlsrHelper olsr; // // Add the IPv4 protocol stack to the nodes in our container // InternetStackHelper internet; + internet.SetRoutingHelper (olsr); internet.Install (backbone); + + // re-initialize for non-olsr routing. + internet = InternetStackHelper (); + // // Assign IPv4 addresses to the device drivers (actually to the associated // IPv4 interfaces) we just created. @@ -322,13 +331,7 @@ // However, it is useful for setting default routes for all of the nodes // such as the LAN nodes. NS_LOG_INFO ("Enabling global routing on all nodes"); - GlobalRouteManager::PopulateRoutingTables (); - - // We enable OLSR (which will be consulted at a higher priority than - // the global routing above) on the backbone ad hoc nodes - NS_LOG_INFO ("Enabling OLSR routing on all backbone nodes"); - OlsrHelper olsr; - olsr.Install (backbone); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); /////////////////////////////////////////////////////////////////////////// // // diff -r 96811f76c3e2 examples/second.cc --- a/examples/second.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/second.cc Tue Jun 23 13:19:19 2009 +0200 @@ -18,7 +18,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-routing-module.h" // Default Network Topology // @@ -102,7 +101,7 @@ clientApps.Start (Seconds (2.0)); clientApps.Stop (Seconds (10.0)); - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); PointToPointHelper::EnablePcapAll ("second"); CsmaHelper::EnablePcap ("second", csmaDevices.Get (1), true); diff -r 96811f76c3e2 examples/simple-alternate-routing.cc --- a/examples/simple-alternate-routing.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/simple-alternate-routing.cc Tue Jun 23 13:19:19 2009 +0200 @@ -41,7 +41,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-route-manager.h" using namespace ns3; @@ -53,7 +52,7 @@ // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this #if 0 - LogComponentEnable("GlobalRouteManager", LOG_LOGIC); + LogComponentEnable("GlobalRoutingHelper", LOG_LOGIC); LogComponentEnable("GlobalRouter", LOG_LOGIC); #endif @@ -130,7 +129,7 @@ // Create router nodes, initialize routing database and set up the routing // tables in the nodes. - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); // Create the OnOff application to send UDP datagrams NS_LOG_INFO ("Create Application."); diff -r 96811f76c3e2 examples/simple-error-model.cc --- a/examples/simple-error-model.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/simple-error-model.cc Tue Jun 23 13:19:19 2009 +0200 @@ -44,7 +44,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-route-manager.h" using namespace ns3; @@ -111,7 +110,7 @@ Ipv4InterfaceContainer i3i2 = ipv4.Assign (d3d2); NS_LOG_INFO ("Use global routing."); - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s diff -r 96811f76c3e2 examples/simple-global-routing.cc --- a/examples/simple-global-routing.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/simple-global-routing.cc Tue Jun 23 13:19:19 2009 +0200 @@ -46,7 +46,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-route-manager.h" using namespace ns3; @@ -111,7 +110,7 @@ // Create router nodes, initialize routing database and set up the routing // tables in the nodes. - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s diff -r 96811f76c3e2 examples/simple-point-to-point-olsr.cc --- a/examples/simple-point-to-point-olsr.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/simple-point-to-point-olsr.cc Tue Jun 23 13:19:19 2009 +0200 @@ -82,7 +82,18 @@ NodeContainer n32 = NodeContainer (c.Get(3), c.Get (2)); NodeContainer n34 = NodeContainer (c.Get (3), c.Get (4)); + // Enable OLSR + NS_LOG_INFO ("Enabling OLSR Routing."); + OlsrHelper olsr; + + Ipv4StaticRoutingHelper staticRouting; + + Ipv4ListRoutingHelper list; + list.Add (staticRouting, 0); + list.Add (olsr, 10); + InternetStackHelper internet; + internet.SetRoutingHelper (list); internet.Install (c); // We create the channels first without any IP addressing information @@ -112,11 +123,6 @@ ipv4.SetBase ("10.1.4.0", "255.255.255.0"); Ipv4InterfaceContainer i34 = ipv4.Assign (nd34); - // Enable OLSR - NS_LOG_INFO ("Enabling OLSR Routing."); - OlsrHelper olsr; - olsr.InstallAll (); - // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s NS_LOG_INFO ("Create Applications."); diff -r 96811f76c3e2 examples/simple-wifi-frame-aggregation.cc --- a/examples/simple-wifi-frame-aggregation.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/simple-wifi-frame-aggregation.cc Tue Jun 23 13:19:19 2009 +0200 @@ -21,7 +21,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-routing-module.h" #include "ns3/wifi-module.h" #include "ns3/mobility-module.h" @@ -137,7 +136,7 @@ clientApps.Start (Seconds (2.0)); clientApps.Stop (Seconds (10.0)); - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); Simulator::Stop (Seconds (10.0)); diff -r 96811f76c3e2 examples/star.cc --- a/examples/star.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/star.cc Tue Jun 23 13:19:19 2009 +0200 @@ -19,7 +19,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-route-manager.h" // Network topology (default) // @@ -132,7 +131,7 @@ // // Turn on global static routing so we can actually be routed across the star. // - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); NS_LOG_INFO ("Enable pcap tracing."); // diff -r 96811f76c3e2 examples/tap-wifi-dumbbell.cc --- a/examples/tap-wifi-dumbbell.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/tap-wifi-dumbbell.cc Tue Jun 23 13:19:19 2009 +0200 @@ -114,7 +114,6 @@ #include "ns3/core-module.h" #include "ns3/wifi-module.h" #include "ns3/helper-module.h" -#include "ns3/global-routing-module.h" using namespace ns3; @@ -228,7 +227,7 @@ apps.Start (Seconds (1.0)); CsmaHelper::EnablePcapAll ("tap-dumbbell", false); - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); Simulator::Stop (Seconds (60.)); Simulator::Run (); diff -r 96811f76c3e2 examples/tcp-large-transfer.cc --- a/examples/tcp-large-transfer.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/tcp-large-transfer.cc Tue Jun 23 13:19:19 2009 +0200 @@ -39,7 +39,6 @@ #include "ns3/core-module.h" #include "ns3/helper-module.h" #include "ns3/node-module.h" -#include "ns3/global-route-manager.h" #include "ns3/simulator-module.h" using namespace ns3; @@ -98,9 +97,8 @@ NetDeviceContainer dev1 = p2p.Install (n1n2); // Now add ip/tcp stack to all nodes. - NodeContainer allNodes = NodeContainer (n0n1, n1n2.Get (1)); InternetStackHelper internet; - internet.Install (allNodes); + internet.InstallAll (); // Later, we add IP addresses. Ipv4AddressHelper ipv4; @@ -110,7 +108,7 @@ Ipv4InterfaceContainer ipInterfs = ipv4.Assign (dev1); // and setup ip routing tables to get total ip-level connectivity. - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); /////////////////////////////////////////////////////////////////////////// // Simulation 1 diff -r 96811f76c3e2 examples/tcp-nsc-lfn.cc --- a/examples/tcp-nsc-lfn.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/tcp-nsc-lfn.cc Tue Jun 23 13:19:19 2009 +0200 @@ -36,7 +36,6 @@ #include "ns3/common-module.h" #include "ns3/helper-module.h" #include "ns3/node-module.h" -#include "ns3/global-route-manager.h" #include "ns3/simulator-module.h" using namespace ns3; @@ -117,7 +116,7 @@ p2pInterfaces.Get(0)->SetAttribute("ReceiveErrorModel", PointerValue (em1)); p2pInterfaces.Get(1)->SetAttribute("ReceiveErrorModel", PointerValue (em2)); - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); uint16_t servPort = 8080; PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), servPort)); diff -r 96811f76c3e2 examples/tcp-nsc-zoo.cc --- a/examples/tcp-nsc-zoo.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/tcp-nsc-zoo.cc Tue Jun 23 13:19:19 2009 +0200 @@ -33,7 +33,6 @@ #include "ns3/core-module.h" #include "ns3/helper-module.h" #include "ns3/node-module.h" -#include "ns3/global-route-manager.h" #include "ns3/simulator-module.h" using namespace ns3; @@ -68,7 +67,6 @@ NetDeviceContainer ethInterfaces = csma.Install (n); InternetStackHelper internetStack; - internetStack.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue("liblinux2.6.26.so")); // this switches nodes 0 and 1 to NSCs Linux 2.6.26 stack. internetStack.Install (n.Get(0)); @@ -106,7 +104,7 @@ ipv4.SetBase ("10.0.0.0", "255.255.255.0"); Ipv4InterfaceContainer ipv4Interfaces = ipv4.Assign (ethInterfaces); - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); uint16_t servPort = 8080; PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), servPort)); diff -r 96811f76c3e2 examples/tcp-star-server.cc --- a/examples/tcp-star-server.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/tcp-star-server.cc Tue Jun 23 13:19:19 2009 +0200 @@ -52,7 +52,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-route-manager.h" using namespace ns3; @@ -123,7 +122,7 @@ } //Turn on global static routing - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); // Create a packet sink on the star "hub" to receive these packets uint16_t port = 50000; diff -r 96811f76c3e2 examples/third.cc --- a/examples/third.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/third.cc Tue Jun 23 13:19:19 2009 +0200 @@ -18,7 +18,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-routing-module.h" #include "ns3/wifi-module.h" #include "ns3/mobility-module.h" @@ -159,7 +158,7 @@ clientApps.Start (Seconds (2.0)); clientApps.Stop (Seconds (10.0)); - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); Simulator::Stop (Seconds (10.0)); diff -r 96811f76c3e2 examples/virtual-net-device.cc --- a/examples/virtual-net-device.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/virtual-net-device.cc Tue Jun 23 13:19:19 2009 +0200 @@ -57,7 +57,6 @@ #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" -#include "ns3/global-route-manager.h" #include "ns3/virtual-net-device.h" using namespace ns3; @@ -238,7 +237,7 @@ // Create router nodes, initialize routing database and set up the routing // tables in the nodes. - GlobalRouteManager::PopulateRoutingTables (); + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); // Add the tunnels Tunnel tunnel (c.Get (3), c.Get (0), c.Get (1), diff -r 96811f76c3e2 examples/wifi-wired-bridging.cc --- a/examples/wifi-wired-bridging.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/examples/wifi-wired-bridging.cc Tue Jun 23 13:19:19 2009 +0200 @@ -49,7 +49,6 @@ #include "ns3/helper-module.h" #include "ns3/wifi-module.h" #include "ns3/node-module.h" -#include "ns3/global-route-manager.h" #include #include #include diff -r 96811f76c3e2 src/helper/internet-stack-helper.cc --- a/src/helper/internet-stack-helper.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/src/helper/internet-stack-helper.cc Tue Jun 23 13:19:19 2009 +0200 @@ -153,7 +153,6 @@ #include "ns3/object.h" #include "ns3/names.h" #include "ns3/ipv4.h" -#include "internet-stack-helper.h" #include "ns3/packet-socket-factory.h" #include "ns3/config.h" #include "ns3/simulator.h" @@ -162,8 +161,10 @@ #include "ns3/callback.h" #include "ns3/node.h" #include "ns3/core-config.h" -#include "ns3/ipv4-list-routing.h" -#include "ns3/ipv4-static-routing.h" +#include "internet-stack-helper.h" +#include "ipv4-list-routing-helper.h" +#include "ipv4-static-routing-helper.h" +#include "ipv4-global-routing-helper.h" #include namespace ns3 { @@ -174,6 +175,18 @@ InternetStackHelper::InternetStackHelper () { SetTcp ("ns3::TcpL4Protocol"); + static Ipv4StaticRoutingHelper staticRouting; + static Ipv4GlobalRoutingHelper globalRouting; + static Ipv4ListRoutingHelper listRouting; + listRouting.Add (staticRouting,0); + listRouting.Add (globalRouting,3); + SetRoutingHelper (listRouting); +} + +void +InternetStackHelper::SetRoutingHelper (const Ipv4RoutingHelper &routing) +{ + m_routing = &routing; } void @@ -213,8 +226,14 @@ } } -static void -CreateAndAggregateObjectFromTypeId (Ptr node, const std::string typeId) +void +InternetStackHelper::InstallAll (void) const +{ + Install (NodeContainer::GetGlobal ()); +} + +void +InternetStackHelper::CreateAndAggregateObjectFromTypeId (Ptr node, const std::string typeId) { ObjectFactory factory; factory.SetTypeId(typeId); @@ -241,10 +260,7 @@ node->AggregateObject (factory); // Set routing Ptr ipv4 = node->GetObject (); - // XXX cut this over to use of TypeIds and factories - Ptr ipv4Routing = CreateObject (); - Ptr ipv4staticRouting = CreateObject (); - ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0); + Ptr ipv4Routing = m_routing->Create (node); ipv4->SetRoutingProtocol (ipv4Routing); } diff -r 96811f76c3e2 src/helper/internet-stack-helper.h --- a/src/helper/internet-stack-helper.h Mon Jun 22 18:29:43 2009 -0700 +++ b/src/helper/internet-stack-helper.h Tue Jun 23 13:19:19 2009 +0200 @@ -31,6 +31,7 @@ namespace ns3 { class Node; +class Ipv4RoutingHelper; /** * \brief aggregate IP/TCP/UDP functionality to existing Nodes. @@ -40,6 +41,8 @@ public: InternetStackHelper(void); + void SetRoutingHelper (const Ipv4RoutingHelper &routing); + /** * Aggregate implementations of the ns3::Ipv4, ns3::Udp, and ns3::Tcp classes * onto the provided node. This method will assert if called on a node that @@ -69,6 +72,11 @@ */ void Install (NodeContainer c) const; + /** + * Aggregate ip, udp, and tcp stacks to all nodes in the simulation + */ + void InstallAll (void) const; + /** * \brief set the Tcp stack which will not need any other parameter. * @@ -132,6 +140,8 @@ private: ObjectFactory m_tcpFactory; + const Ipv4RoutingHelper *m_routing; + static void CreateAndAggregateObjectFromTypeId (Ptr node, const std::string typeId); static void Cleanup (void); static void LogRxIp (std::string context, Ptr packet, uint32_t deviceId); static void LogTxIp (std::string context, Ptr packet, uint32_t deviceId); diff -r 96811f76c3e2 src/helper/ipv4-global-routing-helper.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/helper/ipv4-global-routing-helper.cc Tue Jun 23 13:19:19 2009 +0200 @@ -0,0 +1,41 @@ +#include "ipv4-global-routing-helper.h" +#include "ns3/global-router-interface.h" +#include "ns3/ipv4-global-routing.h" +#include "ns3/ipv4-list-routing.h" +#include "ns3/log.h" + +NS_LOG_COMPONENT_DEFINE("GlobalRoutingHelper"); + +namespace ns3 { + +Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper () +{} +Ptr +Ipv4GlobalRoutingHelper::Create (Ptr node) const +{ + NS_LOG_LOGIC ("Adding GlobalRouter interface to node " << + node->GetId ()); + + Ptr globalRouter = CreateObject (); + node->AggregateObject (globalRouter); + + NS_LOG_LOGIC ("Adding GlobalRouting Protocol to node " << node->GetId ()); + Ptr globalRouting = CreateObject (); + globalRouter->SetRoutingProtocol (globalRouting); + + return globalRouting; +} + +void +Ipv4GlobalRoutingHelper::PopulateRoutingTables (void) +{ + GlobalRouteManager::PopulateRoutingTables (); +} +void +Ipv4GlobalRoutingHelper::RecomputeRoutingTables (void) +{ + GlobalRouteManager::RecomputeRoutingTables (); +} + + +} // namespace ns3 diff -r 96811f76c3e2 src/helper/ipv4-global-routing-helper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/helper/ipv4-global-routing-helper.h Tue Jun 23 13:19:19 2009 +0200 @@ -0,0 +1,20 @@ +#ifndef IPV4_GLOBAL_ROUTING_HELPER_H +#define IPV4_GLOBAL_ROUTING_HELPER_H + +#include "node-container.h" +#include "ipv4-routing-helper.h" + +namespace ns3 { + +class Ipv4GlobalRoutingHelper : public Ipv4RoutingHelper +{ +public: + Ipv4GlobalRoutingHelper (); + virtual Ptr Create (Ptr node) const; + static void PopulateRoutingTables (void); + static void RecomputeRoutingTables (void); +}; + +} // namespace ns3 + +#endif /* IPV4_GLOBAL_ROUTING_HELPER_H */ diff -r 96811f76c3e2 src/helper/ipv4-list-routing-helper.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/helper/ipv4-list-routing-helper.cc Tue Jun 23 13:19:19 2009 +0200 @@ -0,0 +1,27 @@ +#include "ipv4-list-routing-helper.h" +#include "ns3/ipv4-list-routing.h" +#include "ns3/node.h" + +namespace ns3 { + +Ipv4ListRoutingHelper::Ipv4ListRoutingHelper() +{} +void +Ipv4ListRoutingHelper::Add (const Ipv4RoutingHelper &routing, int16_t priority) +{ + m_list.push_back (std::make_pair(&routing,priority)); +} +Ptr +Ipv4ListRoutingHelper::Create (Ptr node) const +{ + Ptr list = CreateObject (); + for (std::list >::const_iterator i = m_list.begin (); + i != m_list.end (); ++i) + { + Ptr prot = i->first->Create (node); + list->AddRoutingProtocol (prot,i->second); + } + return list; +} + +} // namespace ns3 diff -r 96811f76c3e2 src/helper/ipv4-list-routing-helper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/helper/ipv4-list-routing-helper.h Tue Jun 23 13:19:19 2009 +0200 @@ -0,0 +1,22 @@ +#ifndef IPV4_LIST_ROUTING_HELPER_H +#define IPV4_LIST_ROUTING_HELPER_H + +#include "ipv4-routing-helper.h" +#include +#include + +namespace ns3 { + +class Ipv4ListRoutingHelper : public Ipv4RoutingHelper +{ +public: + Ipv4ListRoutingHelper(); + void Add (const Ipv4RoutingHelper &routing, int16_t priority); + virtual Ptr Create (Ptr node) const; +private: + std::list > m_list; +}; + +} // namespace ns3 + +#endif /* IPV4_LIST_ROUTING_HELPER_H */ diff -r 96811f76c3e2 src/helper/ipv4-routing-helper.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/helper/ipv4-routing-helper.cc Tue Jun 23 13:19:19 2009 +0200 @@ -0,0 +1,8 @@ +#include "ipv4-routing-helper.h" + +namespace ns3 { + +Ipv4RoutingHelper::~Ipv4RoutingHelper () +{} + +} // namespace ns3 diff -r 96811f76c3e2 src/helper/ipv4-routing-helper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/helper/ipv4-routing-helper.h Tue Jun 23 13:19:19 2009 +0200 @@ -0,0 +1,21 @@ +#ifndef IPV4_ROUTING_HELPER_H +#define IPV4_ROUTING_HELPER_H + +#include "ns3/ptr.h" + +namespace ns3 { + +class Ipv4RoutingProtocol; +class Node; + +class Ipv4RoutingHelper +{ +public: + virtual ~Ipv4RoutingHelper (); + virtual Ptr Create (Ptr node) const = 0; +}; + +} // namespace ns3 + + +#endif /* IPV4_ROUTING_HELPER_H */ diff -r 96811f76c3e2 src/helper/ipv4-static-routing-helper.cc --- a/src/helper/ipv4-static-routing-helper.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/src/helper/ipv4-static-routing-helper.cc Tue Jun 23 13:19:19 2009 +0200 @@ -33,6 +33,15 @@ namespace ns3 { +Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper() +{} +Ptr +Ipv4StaticRoutingHelper::Create (Ptr node) const +{ + return CreateObject (); +} + + Ptr Ipv4StaticRoutingHelper::GetStaticRouting (Ptr ipv4) const { diff -r 96811f76c3e2 src/helper/ipv4-static-routing-helper.h --- a/src/helper/ipv4-static-routing-helper.h Mon Jun 22 18:29:43 2009 -0700 +++ b/src/helper/ipv4-static-routing-helper.h Tue Jun 23 13:19:19 2009 +0200 @@ -25,14 +25,18 @@ #include "ns3/ipv4-address.h" #include "ns3/node.h" #include "ns3/net-device.h" +#include "ipv4-routing-helper.h" #include "node-container.h" #include "net-device-container.h" namespace ns3 { -class Ipv4StaticRoutingHelper +class Ipv4StaticRoutingHelper : public Ipv4RoutingHelper { public: + Ipv4StaticRoutingHelper(); + virtual Ptr Create (Ptr node) const; + Ptr GetStaticRouting (Ptr ipv4) const; void AddMulticastRoute (Ptr n, Ipv4Address source, Ipv4Address group, diff -r 96811f76c3e2 src/helper/olsr-helper.cc --- a/src/helper/olsr-helper.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/src/helper/olsr-helper.cc Tue Jun 23 13:19:19 2009 +0200 @@ -30,64 +30,18 @@ m_agentFactory.SetTypeId ("ns3::olsr::RoutingProtocol"); } -void -OlsrHelper::SetAgent (std::string tid, - std::string n0, const AttributeValue &v0, - std::string n1, const AttributeValue &v1, - std::string n2, const AttributeValue &v2, - std::string n3, const AttributeValue &v3, - std::string n4, const AttributeValue &v4, - std::string n5, const AttributeValue &v5, - std::string n6, const AttributeValue &v6, - std::string n7, const AttributeValue &v7) +Ptr +OlsrHelper::Create (Ptr node) const { - m_agentFactory.SetTypeId (tid); - m_agentFactory.Set (n0, v0); - m_agentFactory.Set (n1, v1); - m_agentFactory.Set (n2, v2); - m_agentFactory.Set (n3, v3); - m_agentFactory.Set (n4, v4); - m_agentFactory.Set (n5, v5); - m_agentFactory.Set (n6, v6); - m_agentFactory.Set (n7, v7); + Ptr agent = m_agentFactory.Create (); + node->AggregateObject (agent); + return agent; } void -OlsrHelper::Install (NodeContainer container) +OlsrHelper::Set (std::string name, const AttributeValue &value) { - for (NodeContainer::Iterator i = container.Begin (); i != container.End (); ++i) - { - Ptr node = *i; - Install (node); - } -} -void -OlsrHelper::Install (Ptr node) -{ - if (node->GetObject () != 0) - { - NS_FATAL_ERROR ("OlsrHelper::Install(): Aggregating " - "an Olsr Agent to a node with an existing Olsr RoutingProtocol"); - return; - } - Ptr agent = m_agentFactory.Create (); - node->AggregateObject (agent); - Ptr ipv4 = node->GetObject (); - Ptr ipv4Routing = DynamicCast (ipv4->GetRoutingProtocol ()); - NS_ASSERT (ipv4Routing); - ipv4Routing->AddRoutingProtocol (agent, 10); - agent->Start (); -} -void -OlsrHelper::Install (std::string nodeName) -{ - Ptr node = Names::Find (nodeName); - Install (node); -} -void -OlsrHelper::InstallAll (void) -{ - Install (NodeContainer::GetGlobal ()); + m_agentFactory.Set (name, value); } } // namespace ns3 diff -r 96811f76c3e2 src/helper/olsr-helper.h --- a/src/helper/olsr-helper.h Mon Jun 22 18:29:43 2009 -0700 +++ b/src/helper/olsr-helper.h Tue Jun 23 13:19:19 2009 +0200 @@ -21,48 +21,25 @@ #define OLSR_HELPER_H #include "ns3/object-factory.h" -#include "ns3/node-container.h" #include "ns3/node.h" +#include "node-container.h" +#include "ipv4-routing-helper.h" namespace ns3 { /** * \brief Helper class that adds OLSR routing to nodes. */ -class OlsrHelper +class OlsrHelper : public Ipv4RoutingHelper { public: OlsrHelper (); + virtual Ptr Create (Ptr node) const; /** * \brief Set default OLSR routing agent attributes */ - void SetAgent (std::string tid, - std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), - std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), - std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), - std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), - std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), - std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), - std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), - std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); - - /** - * \brief Enable OLSR routing for a set of nodes - */ - void Install (NodeContainer container); - /** - * \brief Enable OLSR routing for a single node - */ - void Install (Ptr node); - /** - * \brief Enable OLSR routing for a single node - */ - void Install (std::string nodeName); - /** - * \brief Enable OLSR routing for all nodes - */ - void InstallAll (void); + void Set (std::string name, const AttributeValue &value); private: ObjectFactory m_agentFactory; }; diff -r 96811f76c3e2 src/helper/wscript --- a/src/helper/wscript Mon Jun 22 18:29:43 2009 -0700 +++ b/src/helper/wscript Tue Jun 23 13:19:19 2009 +0200 @@ -25,6 +25,9 @@ 'v4ping-helper.cc', 'nqos-wifi-mac-helper.cc', 'qos-wifi-mac-helper.cc', + 'ipv4-global-routing-helper.cc', + 'ipv4-list-routing-helper.cc', + 'ipv4-routing-helper.cc', ] headers = bld.new_task_gen('ns3header') @@ -52,6 +55,9 @@ 'v4ping-helper.h', 'nqos-wifi-mac-helper.h', 'qos-wifi-mac-helper.h', + 'ipv4-global-routing-helper.h', + 'ipv4-list-routing-helper.h', + 'ipv4-routing-helper.h', ] env = bld.env_of_name('default') diff -r 96811f76c3e2 src/internet-stack/ipv4-l3-protocol.cc --- a/src/internet-stack/ipv4-l3-protocol.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/src/internet-stack/ipv4-l3-protocol.cc Tue Jun 23 13:19:19 2009 +0200 @@ -187,11 +187,7 @@ } m_interfaces.clear (); m_node = 0; - if (m_routingProtocol) - { - m_routingProtocol->Dispose (); - m_routingProtocol = 0; - } + m_routingProtocol = 0; Object::DoDispose (); } diff -r 96811f76c3e2 src/routing/global-routing/global-route-manager-impl.cc --- a/src/routing/global-routing/global-route-manager-impl.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/src/routing/global-routing/global-route-manager-impl.cc Tue Jun 23 13:19:19 2009 +0200 @@ -374,7 +374,12 @@ for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++) { Ptr node = *i; - Ptr gr = GetGlobalRoutingProtocol (node->GetId ()); + Ptr router = node->GetObject (); + if (router == 0) + { + continue; + } + Ptr gr = router->GetRoutingProtocol (); uint32_t j = 0; uint32_t nRoutes = gr->GetNRoutes (); NS_LOG_LOGIC ("Deleting " << gr->GetNRoutes ()<< " routes from node " << node->GetId ()); @@ -397,79 +402,6 @@ } // -// In order to build the routing database, we need at least one of the nodes -// to participate as a router. This is a convenience function that makes -// all nodes routers. We do this by walking the list of nodes in the system -// and aggregating a Global Router Interface to each of the nodes. -// - void -GlobalRouteManagerImpl::SelectRouterNodes () -{ - NS_LOG_FUNCTION_NOARGS (); - for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++) - { - Ptr node = *i; - NS_LOG_LOGIC ("Adding GlobalRouter interface to node " << node->GetId ()); - - Ptr globalRouter = CreateObject (); - node->AggregateObject (globalRouter); - - NS_LOG_LOGIC ("Adding GlobalRouting Protocol to node " << node->GetId ()); - Ptr globalRouting = CreateObject (); - // Here, we check whether there is an existing Ipv4RoutingProtocol object - // to add this protocol to. - Ptr ipv4 = node->GetObject (); - NS_ASSERT_MSG (ipv4, "GlobalRouteManagerImpl::SelectRouterNodes (): GetObject for interface failed"); - // Now, we add this to an Ipv4ListRouting object. - // XXX in the future, we may want to allow this to be added to Ipv4 - // directly - Ptr ipv4ListRouting = DynamicCast (ipv4->GetRoutingProtocol ()); - NS_ASSERT_MSG (ipv4ListRouting, "GlobalRouteManagerImpl::SelectRouterNodes (): Ipv4ListRouting not found"); - // This is the object that will keep the global routes. We insert it - // at slightly higher priority than static routing (which is at zero). - // This means that global routes (e.g. host routes) will be consulted - // before static routes - // XXX make the below priority value an attribute - ipv4ListRouting->AddRoutingProtocol (globalRouting, 3); - // Locally cache the globalRouting pointer; we'll need it later - // when we add routes - AddGlobalRoutingProtocol (node->GetId (), globalRouting); - } -} - - void -GlobalRouteManagerImpl::SelectRouterNodes (NodeContainer c) -{ - NS_LOG_FUNCTION (&c); - for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++) - { - Ptr node = *i; - NS_LOG_LOGIC ("Adding GlobalRouter interface to node " << - node->GetId ()); - - Ptr globalRouter = CreateObject (); - node->AggregateObject (globalRouter); - - NS_LOG_LOGIC ("Adding GlobalRouting Protocol to node " << node->GetId ()); - Ptr globalRouting = CreateObject (); - // This is the object that will keep the global routes. We insert it - // at slightly higher priority than static routing (which is at zero). - // This means that global routes (e.g. host routes) will be consulted - // before static routes - Ptr ipv4 = node->GetObject (); - NS_ASSERT_MSG (ipv4, "GlobalRouteManagerImpl::SelectRouterNodes (): " - "GetObject for interface failed"); - Ptr ipv4ListRouting = DynamicCast (ipv4->GetRoutingProtocol ()); - NS_ASSERT_MSG (ipv4ListRouting, "GlobalRouteManagerImpl::SelectRouterNodes (): Ipv4ListRouting not found"); - // XXX make the below priority value an attribute - ipv4ListRouting->AddRoutingProtocol (globalRouting, 3); - // Locally cache the globalRouting pointer; we'll need it later - // when we add routes - AddGlobalRoutingProtocol (node->GetId (), globalRouting); - } -} - -// // In order to build the routing database, we need to walk the list of nodes // in the system and look for those that support the GlobalRouter interface. // These routers will export a number of Link State Advertisements (LSAs) @@ -1352,7 +1284,13 @@ // Similarly, the vertex has an m_rootOif (outbound interface index) to // which the packets should be send for forwarding. // - Ptr gr = GetGlobalRoutingProtocol (node->GetId ()); + + Ptr router = node->GetObject (); + if (router == 0) + { + continue; + } + Ptr gr = router->GetRoutingProtocol (); NS_ASSERT (gr); if (v->GetOutgoingInterfaceId () >= 0) { @@ -1576,7 +1514,12 @@ // Similarly, the vertex has an m_rootOif (outbound interface index) to // which the packets should be send for forwarding. // - Ptr gr = GetGlobalRoutingProtocol (node->GetId ()); + Ptr router = node->GetObject (); + if (router == 0) + { + continue; + } + Ptr gr = router->GetRoutingProtocol (); NS_ASSERT (gr); if (v->GetOutgoingInterfaceId () >= 0) { @@ -1674,7 +1617,12 @@ Ipv4Mask tempmask = lsa->GetNetworkLSANetworkMask (); Ipv4Address tempip = lsa->GetLinkStateId (); tempip = tempip.CombineMask (tempmask); - Ptr gr = GetGlobalRoutingProtocol (node->GetId ()); + Ptr router = node->GetObject (); + if (router == 0) + { + continue; + } + Ptr gr = router->GetRoutingProtocol (); NS_ASSERT (gr); if (v->GetOutgoingInterfaceId () >= 0) { @@ -1714,29 +1662,6 @@ v->GetParent ()->AddChild (v); } - void -GlobalRouteManagerImpl::AddGlobalRoutingProtocol (uint32_t nodeId, Ptr proto) -{ - NS_LOG_FUNCTION (nodeId); - m_routingProtocols.push_back - (std::pair > (nodeId, proto)); - m_routingProtocols.sort (); -} - - Ptr -GlobalRouteManagerImpl::GetGlobalRoutingProtocol (uint32_t nodeId) -{ - for (Ipv4GlobalRoutingList::const_iterator rprotoIter = m_routingProtocols.begin (); rprotoIter != m_routingProtocols.end (); rprotoIter++) - { - if ((*rprotoIter).first == nodeId) - { - return (*rprotoIter).second; - } - } - return 0; -} - - } // namespace ns3 #ifdef RUN_SELF_TESTS diff -r 96811f76c3e2 src/routing/global-routing/global-route-manager-impl.h --- a/src/routing/global-routing/global-route-manager-impl.h Mon Jun 22 18:29:43 2009 -0700 +++ b/src/routing/global-routing/global-route-manager-impl.h Tue Jun 23 13:19:19 2009 +0200 @@ -29,7 +29,6 @@ #include "ns3/object.h" #include "ns3/ptr.h" #include "ns3/ipv4-address.h" -#include "ns3/node-container.h" #include "global-router-interface.h" namespace ns3 { @@ -729,21 +728,6 @@ * */ virtual void DeleteGlobalRoutes (); -/** - * @brief Select which nodes in the system are to be router nodes and - * aggregate the appropriate interfaces onto those nodes. - * @internal - * - */ - virtual void SelectRouterNodes (); - -/** - * @brief Select which nodes in the system are to be router nodes and - * aggregate the appropriate interfaces onto those nodes. - * @internal - * - */ - virtual void SelectRouterNodes (NodeContainer c); /** * @brief Build the routing database by gathering Link State Advertisements @@ -801,12 +785,6 @@ void SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex* v); int32_t FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask = Ipv4Mask("255.255.255.255")); - - // Local cache of the Ipv4GlobalRouting objects, indexed by nodeId - typedef std::list< std::pair< uint32_t, Ptr > > Ipv4GlobalRoutingList; - void AddGlobalRoutingProtocol (uint32_t nodeId, Ptr proto); - Ptr GetGlobalRoutingProtocol (uint32_t nodeId); - Ipv4GlobalRoutingList m_routingProtocols; }; } // namespace ns3 diff -r 96811f76c3e2 src/routing/global-routing/global-route-manager.cc --- a/src/routing/global-routing/global-route-manager.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/src/routing/global-routing/global-route-manager.cc Tue Jun 23 13:19:19 2009 +0200 @@ -21,7 +21,6 @@ #include "ns3/assert.h" #include "ns3/log.h" #include "ns3/simulation-singleton.h" -#include "ns3/node-container.h" #include "global-route-manager.h" #include "global-route-manager-impl.h" @@ -36,15 +35,6 @@ void GlobalRouteManager::PopulateRoutingTables (void) { - SelectRouterNodes (); - BuildGlobalRoutingDatabase (); - InitializeRoutes (); -} - - void -GlobalRouteManager::PopulateRoutingTables (NodeContainer c) -{ - SelectRouterNodes (c); BuildGlobalRoutingDatabase (); InitializeRoutes (); } @@ -65,20 +55,6 @@ } void -GlobalRouteManager::SelectRouterNodes (void) -{ - SimulationSingleton::Get ()-> - SelectRouterNodes (); -} - - void -GlobalRouteManager::SelectRouterNodes (NodeContainer c) -{ - SimulationSingleton::Get ()-> - SelectRouterNodes (c); -} - - void GlobalRouteManager::BuildGlobalRoutingDatabase (void) { SimulationSingleton::Get ()-> diff -r 96811f76c3e2 src/routing/global-routing/global-route-manager.h --- a/src/routing/global-routing/global-route-manager.h Mon Jun 22 18:29:43 2009 -0700 +++ b/src/routing/global-routing/global-route-manager.h Tue Jun 23 13:19:19 2009 +0200 @@ -22,8 +22,6 @@ #ifndef GLOBAL_ROUTE_MANAGER_H #define GLOBAL_ROUTE_MANAGER_H -#include "ns3/node-container.h" - namespace ns3 { /** @@ -55,21 +53,6 @@ */ static void PopulateRoutingTables (); -/** - * @brief Build a routing database and initialize the routing tables of - * the nodes in the simulation. Makes the nodes in the provided container - * into routers. - * - * All this function does is call the three functions - * SelectRouterNodes (), BuildGlobalRoutingDatabase (), and - * InitializeRoutes (). - * - * @see SelectRouterNodes (Node Container c); - * @see BuildGlobalRoutingDatabase (); - * @see InitializeRoutes (); - */ - static void PopulateRoutingTables (NodeContainer c); - /** *@brief Remove all routes that were previously installed in a prior call * to either PopulateRoutingTables() or RecomputeRoutingTables(), and @@ -87,6 +70,13 @@ */ static void RecomputeRoutingTables (); +public: +/** + * @brief Allocate a 32-bit router ID from monotonically increasing counter. + */ + static uint32_t AllocateRouterId (); + +private: /** * @brief Delete all static routes on all nodes that have a * GlobalRouterInterface @@ -95,29 +85,6 @@ static void DeleteGlobalRoutes (); /** - * @brief Select which nodes in the system are to be router nodes and - * aggregate the appropriate interfaces onto those nodes. - * @internal - * - */ - static void SelectRouterNodes (); - -/** - * @brief Select which nodes in the system are to be router nodes and - * aggregate the appropriate interfaces onto those nodes. - * @internal - * - */ - static void SelectRouterNodes (NodeContainer c); - -/** - * @brief Allocate a 32-bit router ID from monotonically increasing counter. - */ - static uint32_t AllocateRouterId (); - -private: - -/** * @brief Build the routing database by gathering Link State Advertisements * from each node exporting a GlobalRouter interface. * @internal diff -r 96811f76c3e2 src/routing/global-routing/global-router-interface.cc --- a/src/routing/global-routing/global-router-interface.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/src/routing/global-routing/global-router-interface.cc Tue Jun 23 13:19:19 2009 +0200 @@ -26,7 +26,7 @@ #include "ns3/node.h" #include "ns3/ipv4.h" #include "ns3/bridge-net-device.h" -#include "ns3/net-device-container.h" +#include "ipv4-global-routing.h" #include "global-router-interface.h" #include @@ -497,10 +497,22 @@ ClearLSAs(); } +void +GlobalRouter::SetRoutingProtocol (Ptr routing) +{ + m_routingProtocol = routing; +} +Ptr +GlobalRouter::GetRoutingProtocol (void) +{ + return m_routingProtocol; +} + void GlobalRouter::DoDispose () { NS_LOG_FUNCTION_NOARGS (); + m_routingProtocol = 0; Object::DoDispose (); } diff -r 96811f76c3e2 src/routing/global-routing/global-router-interface.h --- a/src/routing/global-routing/global-router-interface.h Mon Jun 22 18:29:43 2009 -0700 +++ b/src/routing/global-routing/global-router-interface.h Tue Jun 23 13:19:19 2009 +0200 @@ -36,6 +36,7 @@ namespace ns3 { class GlobalRouter; +class Ipv4GlobalRouting; /** * @brief A single link record for a link state advertisement. @@ -572,6 +573,10 @@ */ GlobalRouter (); + + void SetRoutingProtocol (Ptr routing); + Ptr GetRoutingProtocol (void); + /** * @brief Get the Router ID associated with this Global Router. * @@ -660,6 +665,7 @@ ListOfLSAs_t m_LSAs; Ipv4Address m_routerId; + Ptr m_routingProtocol; // inherited from Object virtual void DoDispose (void); diff -r 96811f76c3e2 src/routing/global-routing/ipv4-global-routing.cc --- a/src/routing/global-routing/ipv4-global-routing.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/src/routing/global-routing/ipv4-global-routing.cc Tue Jun 23 13:19:19 2009 +0200 @@ -19,7 +19,7 @@ #include "ns3/log.h" #include "ns3/object.h" #include "ns3/packet.h" -#include "ns3/node.h" +#include "ns3/net-device.h" #include "ns3/ipv4-route.h" #include "ns3/ipv4-routing-table-entry.h" #include "ipv4-global-routing.h" diff -r 96811f76c3e2 src/routing/global-routing/wscript --- a/src/routing/global-routing/wscript Mon Jun 22 18:29:43 2009 -0700 +++ b/src/routing/global-routing/wscript Tue Jun 23 13:19:19 2009 +0200 @@ -14,5 +14,6 @@ headers.source = [ 'global-router-interface.h', 'global-route-manager.h', + 'ipv4-global-routing.h', ] diff -r 96811f76c3e2 src/routing/olsr/olsr-routing-protocol.cc --- a/src/routing/olsr/olsr-routing-protocol.cc Mon Jun 22 18:29:43 2009 -0700 +++ b/src/routing/olsr/olsr-routing-protocol.cc Tue Jun 23 13:19:19 2009 +0200 @@ -213,6 +213,8 @@ m_linkTupleTimerFirstTime = true; m_ipv4 = ipv4; + + Simulator::ScheduleNow (&RoutingProtocol::Start, this); } void RoutingProtocol::DoDispose () diff -r 96811f76c3e2 src/routing/olsr/olsr-routing-protocol.h --- a/src/routing/olsr/olsr-routing-protocol.h Mon Jun 22 18:29:43 2009 -0700 +++ b/src/routing/olsr/olsr-routing-protocol.h Tue Jun 23 13:19:19 2009 +0200 @@ -68,7 +68,6 @@ RoutingProtocol (); virtual ~RoutingProtocol (); - void Start (); void SetMainInterface (uint32_t interface); private: @@ -101,7 +100,7 @@ Ptr m_ipv4; private: - + void Start (); void Clear (); uint32_t GetSize () const { return m_table.size (); } std::vector GetEntries () const;