Remove static routing dependencies in code

This commit is contained in:
Mathieu Lacage
2009-06-12 13:44:19 -07:00
parent 9c069ceafe
commit 2db05b272b
22 changed files with 406 additions and 197 deletions
+50 -19
View File
@@ -541,6 +541,31 @@ def register_Ns3Ipv4StaticRoutingImpl_methods(root_module, cls):
'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-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::NotifyInterfaceUp(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceUp',
'void',
[param('uint32_t', 'interface')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::NotifyInterfaceDown(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceDown',
'void',
[param('uint32_t', 'interface')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::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-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::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-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
cls.add_method('SetIpv4',
'void',
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
cls.add_method('AddHostRouteTo',
'void',
@@ -616,16 +641,6 @@ def register_Ns3Ipv4StaticRoutingImpl_methods(root_module, cls):
'void',
[param('uint32_t', 'index')],
is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_virtual=True)
## ipv4-static-routing-impl.h: ns3::Ptr<ns3::Node> ns3::Ipv4StaticRoutingImpl::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True, is_virtual=True)
## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
@@ -653,6 +668,31 @@ def register_Ns3Ipv4ListRoutingImpl_methods(root_module, cls):
'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-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::NotifyInterfaceUp(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceUp',
'void',
[param('uint32_t', 'interface')],
is_virtual=True)
## ipv4-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::NotifyInterfaceDown(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceDown',
'void',
[param('uint32_t', 'interface')],
is_virtual=True)
## ipv4-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::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-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::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-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
cls.add_method('SetIpv4',
'void',
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
is_virtual=True)
## ipv4-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::AddRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol, int16_t priority) [member function]
cls.add_method('AddRoutingProtocol',
'void',
@@ -673,15 +713,6 @@ def register_Ns3Ipv4ListRoutingImpl_methods(root_module, cls):
'ns3::Ptr< ns3::Ipv4StaticRouting >',
[],
is_const=True, is_virtual=True)
## ipv4-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## ipv4-list-routing-impl.h: ns3::Ptr<ns3::Node> ns3::Ipv4ListRoutingImpl::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True)
## ipv4-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
+25 -10
View File
@@ -2855,6 +2855,31 @@ def register_Ns3Ipv4RoutingProtocol_methods(root_module, cls):
'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_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::NotifyInterfaceUp(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceUp',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::NotifyInterfaceDown(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceDown',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::NotifyAddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('NotifyAddAddress',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::NotifyRemoveAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('NotifyRemoveAddress',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
cls.add_method('SetIpv4',
'void',
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
@@ -2942,16 +2967,6 @@ def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
'void',
[param('uint32_t', 'index')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_pure_virtual=True, is_virtual=True)
## ipv4-static-routing.h: ns3::Ptr<ns3::Node> ns3::Ipv4StaticRouting::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3NetDevice_methods(root_module, cls):
+25 -4
View File
@@ -747,10 +747,6 @@ def register_Ns3OlsrRoutingProtocol_methods(root_module, cls):
is_static=True)
## olsr-routing-protocol.h: ns3::olsr::RoutingProtocol::RoutingProtocol() [constructor]
cls.add_constructor([])
## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::Start() [member function]
cls.add_method('Start',
'void',
@@ -769,6 +765,31 @@ def register_Ns3OlsrRoutingProtocol_methods(root_module, cls):
'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')],
visibility='private', is_virtual=True)
## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::NotifyInterfaceUp(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceUp',
'void',
[param('uint32_t', 'interface')],
visibility='private', is_virtual=True)
## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::NotifyInterfaceDown(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceDown',
'void',
[param('uint32_t', 'interface')],
visibility='private', is_virtual=True)
## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::NotifyAddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('NotifyAddAddress',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
visibility='private', is_virtual=True)
## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::NotifyRemoveAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('NotifyRemoveAddress',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
visibility='private', is_virtual=True)
## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
cls.add_method('SetIpv4',
'void',
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
visibility='private', is_virtual=True)
## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
-2
View File
@@ -244,10 +244,8 @@ InternetStackHelper::Install (Ptr<Node> node) const
// XXX cut this over to use of TypeIds and factories
Ptr<Ipv4ListRoutingImpl> ipv4RoutingImpl = CreateObject<Ipv4ListRoutingImpl> ();
Ptr<Ipv4StaticRoutingImpl> ipv4staticRoutingImpl = CreateObject<Ipv4StaticRoutingImpl> ();
ipv4staticRoutingImpl->SetNode (node);
ipv4RoutingImpl->AddRoutingProtocol (ipv4staticRoutingImpl, 0);
ipv4->SetRoutingProtocol (ipv4RoutingImpl);
ipv4RoutingImpl->SetNode (node);
}
void
-1
View File
@@ -76,7 +76,6 @@ OlsrHelper::Install (Ptr<Node> node)
Ptr<Ipv4ListRouting> ipv4Routing = DynamicCast<Ipv4ListRouting> (ipv4->GetRoutingProtocol ());
NS_ASSERT (ipv4Routing);
ipv4Routing->AddRoutingProtocol (agent, 10);
agent->SetNode (node);
agent->Start ();
}
void
+15 -56
View File
@@ -163,12 +163,7 @@ Ipv4L3Protocol::SetRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol)
{
NS_LOG_FUNCTION (this);
m_routingProtocol = routingProtocol;
// XXX should check all interfaces to see if any were set to Up state
// prior to a routing protocol being added
if (GetStaticRouting () != 0)
{
GetStaticRouting ()->AddHostRouteTo (Ipv4Address::GetLoopback (), 0);
}
m_routingProtocol->SetIpv4 (this);
}
@@ -230,11 +225,11 @@ Ipv4L3Protocol::SetupLoopback (void)
Ptr<Node> node = GetObject<Node> ();
node->RegisterProtocolHandler (MakeCallback (&Ipv4L3Protocol::Receive, this),
Ipv4L3Protocol::PROT_NUMBER, device);
if (GetStaticRouting () != 0)
{
GetStaticRouting ()->AddHostRouteTo (Ipv4Address::GetLoopback (), index);
}
interface->SetUp ();
if (m_routingProtocol != 0)
{
m_routingProtocol->NotifyInterfaceUp (index);
}
}
void
@@ -244,26 +239,6 @@ Ipv4L3Protocol::SetDefaultTtl (uint8_t ttl)
m_defaultTtl = ttl;
}
// XXX need to remove dependencies on Ipv4StaticRouting from this class
Ptr<Ipv4StaticRouting>
Ipv4L3Protocol::GetStaticRouting (void) const
{
NS_LOG_FUNCTION_NOARGS ();
Ptr<Ipv4StaticRouting> staticRouting;
if (m_routingProtocol != 0)
{
Ptr<Ipv4StaticRoutingImpl> sr = DynamicCast<Ipv4StaticRoutingImpl> (m_routingProtocol);
if (sr != 0)
{
return sr;
}
Ptr<Ipv4ListRoutingImpl> lr = DynamicCast<Ipv4ListRoutingImpl> (m_routingProtocol);
NS_ASSERT (lr);
staticRouting = lr->GetStaticRouting ();
}
return staticRouting;
}
uint32_t
Ipv4L3Protocol::AddInterface (Ptr<NetDevice> device)
{
@@ -761,7 +736,12 @@ Ipv4L3Protocol::AddAddress (uint32_t i, Ipv4InterfaceAddress address)
{
NS_LOG_FUNCTION (this << i << address);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->AddAddress (address);
uint32_t index = interface->AddAddress (address);
if (m_routingProtocol != 0)
{
m_routingProtocol->NotifyAddAddress (i, address);
}
return index;
}
Ipv4InterfaceAddress
@@ -819,18 +799,9 @@ Ipv4L3Protocol::SetUp (uint32_t i)
Ptr<Ipv4Interface> interface = GetInterface (i);
interface->SetUp ();
// If interface address and network mask have been set, add a route
// to the network of the interface (like e.g. ifconfig does on a
// Linux box)
for (uint32_t j = 0; j < interface->GetNAddresses (); j++)
if (m_routingProtocol != 0)
{
if (((interface->GetAddress (j).GetLocal ()) != (Ipv4Address ()))
&& (interface->GetAddress (j).GetMask ()) != (Ipv4Mask ()))
{
NS_ASSERT_MSG (GetStaticRouting(), "SetUp:: No static routing");
GetStaticRouting ()->AddNetworkRouteTo (interface->GetAddress (j).GetLocal ().CombineMask (interface->GetAddress (j).GetMask ()),
interface->GetAddress (j).GetMask (), i);
}
m_routingProtocol->NotifyInterfaceUp (i);
}
}
@@ -841,21 +812,9 @@ Ipv4L3Protocol::SetDown (uint32_t ifaceIndex)
Ptr<Ipv4Interface> interface = GetInterface (ifaceIndex);
interface->SetDown ();
// Remove all static routes that are going through this interface
bool modified = true;
while (modified)
if (m_routingProtocol != 0)
{
modified = false;
for (uint32_t i = 0; i < GetStaticRouting ()->GetNRoutes (); i++)
{
Ipv4RoutingTableEntry route = GetStaticRouting ()->GetRoute (i);
if (route.GetInterface () == ifaceIndex)
{
GetStaticRouting ()->RemoveRoute (i);
modified = true;
break;
}
}
m_routingProtocol->NotifyInterfaceDown (ifaceIndex);
}
}
-1
View File
@@ -218,7 +218,6 @@ private:
TracedCallback<Ptr<const Packet> > m_dropTrace;
Ptr<Ipv4RoutingProtocol> m_routingProtocol;
Ptr<Ipv4StaticRouting> GetStaticRouting (void) const;
SocketList m_sockets;
};
+77 -27
View File
@@ -42,7 +42,7 @@ Ipv4ListRoutingImpl::GetTypeId (void)
Ipv4ListRoutingImpl::Ipv4ListRoutingImpl ()
: m_node (0)
: m_ipv4 (0)
{
NS_LOG_FUNCTION_NOARGS ();
}
@@ -65,7 +65,7 @@ Ipv4ListRoutingImpl::DoDispose (void)
(*rprotoIter).second = 0;
}
m_routingProtocols.clear ();
m_node = 0;
m_ipv4 = 0;
}
Ptr<Ipv4Route>
@@ -102,18 +102,17 @@ Ipv4ListRoutingImpl::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
{
bool retVal = false;
NS_LOG_FUNCTION (p << header << idev);
NS_LOG_LOGIC ("RouteInput logic for node: " << m_node->GetId ());
NS_LOG_LOGIC ("RouteInput logic for node: " << m_ipv4->GetObject<Node> ()->GetId ());
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
NS_ASSERT (ipv4);
uint32_t iif = ipv4->GetInterfaceForDevice (idev);
NS_ASSERT (m_ipv4 != 0);
uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
// Multicast recognition; handle local delivery here
//
if (header.GetDestination().IsMulticast ())
{
#ifdef NOTYET
if (ipv4->MulticastCheckGroup (iif, header.GetDestination ()))
if (m_ipv4->MulticastCheckGroup (iif, header.GetDestination ()))
#endif
if (true)
{
@@ -152,11 +151,11 @@ Ipv4ListRoutingImpl::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
// destination unicast address does not match one of the iif addresses,
// but we check our other interfaces. This could be an option
// (to remove the outer loop immediately below and just check iif).
for (uint32_t j = 0; j < ipv4->GetNInterfaces (); j++)
for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
{
for (uint32_t i = 0; i < ipv4->GetNAddresses (j); i++)
for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
{
Ipv4InterfaceAddress iaddr = ipv4->GetAddress (j, i);
Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
Ipv4Address addr = iaddr.GetLocal ();
if (addr.IsEqual (header.GetDestination ()))
{
@@ -195,13 +194,79 @@ Ipv4ListRoutingImpl::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
return retVal;
}
void
Ipv4ListRoutingImpl::NotifyInterfaceUp (uint32_t interface)
{
NS_LOG_FUNCTION (this << interface);
for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end ();
rprotoIter++)
{
(*rprotoIter).second->NotifyInterfaceUp (interface);
}
}
void
Ipv4ListRoutingImpl::NotifyInterfaceDown (uint32_t interface)
{
NS_LOG_FUNCTION (this << interface);
for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end ();
rprotoIter++)
{
(*rprotoIter).second->NotifyInterfaceDown (interface);
}
}
void
Ipv4ListRoutingImpl::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)
{
NS_LOG_FUNCTION(this << interface << address);
for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end ();
rprotoIter++)
{
(*rprotoIter).second->NotifyAddAddress (interface, address);
}
}
void
Ipv4ListRoutingImpl::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)
{
NS_LOG_FUNCTION(this << interface << address);
for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end ();
rprotoIter++)
{
(*rprotoIter).second->NotifyRemoveAddress (interface, address);
}
}
void
Ipv4ListRoutingImpl::SetIpv4 (Ptr<Ipv4> ipv4)
{
NS_LOG_FUNCTION(this << ipv4);
NS_ASSERT (m_ipv4 == 0);
for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end ();
rprotoIter++)
{
(*rprotoIter).second->SetIpv4 (ipv4);
}
m_ipv4 = ipv4;
}
void
Ipv4ListRoutingImpl::AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority)
{
NS_LOG_FUNCTION (this << routingProtocol->GetInstanceTypeId () << priority);
m_routingProtocols.push_back
(std::pair<int, Ptr<Ipv4RoutingProtocol> > (-priority, routingProtocol));
m_routingProtocols.push_back (std::make_pair (-priority, routingProtocol));
m_routingProtocols.sort ();
if (m_ipv4 != 0)
{
routingProtocol->SetIpv4 (m_ipv4);
}
}
uint32_t
@@ -253,19 +318,4 @@ Ipv4ListRoutingImpl::GetStaticRouting (void) const
}
void
Ipv4ListRoutingImpl::SetNode (Ptr<Node> node)
{
NS_LOG_FUNCTION_NOARGS ();
m_node = node;
}
Ptr<Node>
Ipv4ListRoutingImpl::GetNode (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_node;
}
}//namespace ns3
+7 -6
View File
@@ -39,6 +39,11 @@ public:
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb);
virtual void NotifyInterfaceUp (uint32_t interface);
virtual void NotifyInterfaceDown (uint32_t interface);
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority);
@@ -47,16 +52,12 @@ public:
virtual Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (uint32_t index, int16_t& priority) const;
virtual Ptr<Ipv4StaticRouting> GetStaticRouting (void) const;
void SetNode (Ptr<Node> node);
Ptr<Node> GetNode (void) const;
protected:
void DoDispose (void);
private:
typedef std::list< std::pair< int, Ptr<Ipv4RoutingProtocol> > > Ipv4RoutingProtocolList;
typedef std::list< std::pair< int16_t, Ptr<Ipv4RoutingProtocol> > > Ipv4RoutingProtocolList;
Ipv4RoutingProtocolList m_routingProtocols;
Ptr<Node> m_node;
Ptr<Ipv4> m_ipv4;
};
+95 -22
View File
@@ -42,7 +42,7 @@ Ipv4StaticRoutingImpl::GetTypeId (void)
}
Ipv4StaticRoutingImpl::Ipv4StaticRoutingImpl ()
: m_defaultRoute (0), m_node (0)
: m_defaultRoute (0), m_ipv4 (0)
{
NS_LOG_FUNCTION_NOARGS ();
}
@@ -222,15 +222,14 @@ Ipv4StaticRoutingImpl::LookupStatic (Ipv4Address dest)
if ((*i)->GetDest ().IsEqual (dest))
{
NS_LOG_LOGIC ("Found global host route" << *i);
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
Ipv4RoutingTableEntry* route = (*i);
rtentry = Create<Ipv4Route> ();
rtentry->SetDestination (route->GetDest ());
// XXX handle multi-address case
rtentry->SetSource (ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
rtentry->SetSource (m_ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
rtentry->SetGateway (route->GetGateway ());
uint32_t interfaceIdx = route->GetInterface ();
rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
return rtentry;
}
}
@@ -244,15 +243,14 @@ Ipv4StaticRoutingImpl::LookupStatic (Ipv4Address dest)
if (mask.IsMatch (dest, entry))
{
NS_LOG_LOGIC ("Found global network route" << *j);
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
Ipv4RoutingTableEntry* route = (*j);
rtentry = Create<Ipv4Route> ();
rtentry->SetDestination (route->GetDest ());
// XXX handle multi-address case
rtentry->SetSource (ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
rtentry->SetSource (m_ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
rtentry->SetGateway (route->GetGateway ());
uint32_t interfaceIdx = route->GetInterface ();
rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
return rtentry;
}
}
@@ -260,15 +258,14 @@ Ipv4StaticRoutingImpl::LookupStatic (Ipv4Address dest)
{
NS_ASSERT (m_defaultRoute->IsDefault ());
NS_LOG_LOGIC ("Found global network route" << m_defaultRoute);
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
Ipv4RoutingTableEntry* route = m_defaultRoute;
rtentry = Create<Ipv4Route> ();
rtentry->SetDestination (route->GetDest ());
// XXX handle multi-address case
rtentry->SetSource (ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
rtentry->SetSource (m_ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
rtentry->SetGateway (route->GetGateway ());
uint32_t interfaceIdx = route->GetInterface ();
rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
return rtentry;
}
return 0;
@@ -307,7 +304,6 @@ Ipv4StaticRoutingImpl::LookupStatic (
interface == route->GetInputInterface ())
{
NS_LOG_LOGIC ("Found multicast route" << *i);
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
mrtentry = Create<Ipv4MulticastRoute> ();
mrtentry->SetGroup (route->GetGroup ());
mrtentry->SetOrigin (route->GetOrigin ());
@@ -480,13 +476,12 @@ Ipv4StaticRoutingImpl::RouteInput (Ptr<const Packet> p, const Ipv4Header &ipHea
LocalDeliverCallback lcb, ErrorCallback ecb)
{
NS_LOG_FUNCTION (this << p << ipHeader << ipHeader.GetSource () << ipHeader.GetDestination () << idev);
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
if (ipHeader.GetDestination ().IsMulticast ())
{
NS_LOG_LOGIC ("Multicast destination");
Ptr<Ipv4MulticastRoute> mrtentry = LookupStatic(ipHeader.GetSource (),
ipHeader.GetDestination (), ipv4->GetInterfaceForDevice (idev));
ipHeader.GetDestination (), m_ipv4->GetInterfaceForDevice (idev));
if (mrtentry)
{
@@ -550,22 +545,100 @@ Ipv4StaticRoutingImpl::DoDispose (void)
{
delete (*i);
}
m_ipv4 = 0;
Ipv4RoutingProtocol::DoDispose ();
}
void
Ipv4StaticRoutingImpl::SetNode (Ptr<Node> node)
void
Ipv4StaticRoutingImpl::NotifyInterfaceUp (uint32_t i)
{
NS_LOG_FUNCTION_NOARGS ();
m_node = node;
// If interface address and network mask have been set, add a route
// to the network of the interface (like e.g. ifconfig does on a
// Linux box)
for (uint32_t j = 0; j < m_ipv4->GetNAddresses (i); j++)
{
if (m_ipv4->GetAddress (i,j).GetLocal () != Ipv4Address () &&
m_ipv4->GetAddress (i,j).GetMask () != Ipv4Mask ())
{
AddNetworkRouteTo (m_ipv4->GetAddress (i,j).GetLocal ().CombineMask (m_ipv4->GetAddress (i,j).GetMask ()),
m_ipv4->GetAddress (i,j).GetMask (), i);
}
}
}
Ptr<Node>
Ipv4StaticRoutingImpl::GetNode (void) const
void
Ipv4StaticRoutingImpl::NotifyInterfaceDown (uint32_t i)
{
NS_LOG_FUNCTION_NOARGS ();
return m_node;
}
// Remove all static routes that are going through this interface
for (uint32_t j = 0; j < GetNRoutes (); j++)
{
Ipv4RoutingTableEntry route = GetRoute (j);
if (route.GetInterface () == i)
{
RemoveRoute (j);
}
}
}
void
Ipv4StaticRoutingImpl::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)
{
NS_LOG_FUNCTION (this << interface);
if (!m_ipv4->IsUp (interface))
{
return;
}
Ipv4Address networkAddress = address.GetLocal ().CombineMask (address.GetMask ());
Ipv4Mask networkMask = address.GetMask ();
if (address.GetLocal () != Ipv4Address () &&
address.GetMask () != Ipv4Mask ())
{
AddNetworkRouteTo (networkAddress,
networkMask, interface);
}
}
void
Ipv4StaticRoutingImpl::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)
{
if (!m_ipv4->IsUp (interface))
{
return;
}
Ipv4Address networkAddress = address.GetLocal ().CombineMask (address.GetMask ());
Ipv4Mask networkMask = address.GetMask ();
// Remove all static routes that are going through this interface
// which reference this network
for (uint32_t j = 0; j < GetNRoutes (); j++)
{
Ipv4RoutingTableEntry route = GetRoute (j);
if (route.GetInterface () == interface &&
route.IsNetwork () &&
route.GetDestNetwork () == networkAddress &&
route.GetDestNetworkMask () == networkMask)
{
RemoveRoute (j);
}
}
}
void
Ipv4StaticRoutingImpl::SetIpv4 (Ptr<Ipv4> ipv4)
{
NS_LOG_FUNCTION (this << ipv4);
NS_ASSERT (m_ipv4 == 0 && ipv4 != 0);
m_ipv4 = ipv4;
for (uint32_t i = 0; i < m_ipv4->GetNInterfaces (); i++)
{
if (m_ipv4->IsUp (i))
{
NotifyInterfaceUp (i);
}
else
{
NotifyInterfaceDown (i);
}
}
}
}//namespace ns3
@@ -56,6 +56,13 @@ public:
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb);
virtual void NotifyInterfaceUp (uint32_t interface);
virtual void NotifyInterfaceDown (uint32_t interface);
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
/**
* \brief Add a host route to the static routing table.
*
@@ -332,11 +339,8 @@ public:
*/
void RemoveMulticastRoute (uint32_t index);
void SetNode (Ptr<Node> node);
Ptr<Node> GetNode (void) const;
protected:
void DoDispose (void);
virtual void DoDispose (void);
private:
typedef std::list<Ipv4RoutingTableEntry *> HostRoutes;
@@ -359,7 +363,7 @@ private:
Ipv4RoutingTableEntry *m_defaultRoute;
MulticastRoutes m_multicastRoutes;
Ptr<Node> m_node;
Ptr<Ipv4> m_ipv4;
};
} // Namespace ns3
+5 -4
View File
@@ -25,15 +25,16 @@
#include "ns3/ipv4.h"
#include "ns3/ipv4-interface-address.h"
#include "ns3/ipv4-route.h"
#include "tcp-socket-impl.h"
#include "tcp-l4-protocol.h"
#include "ipv4-end-point.h"
#include "ns3/ipv4-routing-protocol.h"
#include "ns3/simulation-singleton.h"
#include "tcp-typedefs.h"
#include "ns3/simulator.h"
#include "ns3/packet.h"
#include "ns3/uinteger.h"
#include "ns3/trace-source-accessor.h"
#include "tcp-typedefs.h"
#include "tcp-socket-impl.h"
#include "tcp-l4-protocol.h"
#include "ipv4-end-point.h"
#include <algorithm>
-2
View File
@@ -59,9 +59,7 @@ AddInternetStack (Ptr<Node> node)
//Routing for Ipv4
Ptr<Ipv4ListRoutingImpl> ipv4RoutingImpl = CreateObject<Ipv4ListRoutingImpl> ();
ipv4->SetRoutingProtocol (ipv4RoutingImpl);
ipv4RoutingImpl->SetNode (node);
Ptr<Ipv4StaticRoutingImpl> ipv4staticRoutingImpl = CreateObject<Ipv4StaticRoutingImpl> ();
ipv4staticRoutingImpl->SetNode (node);
ipv4RoutingImpl->AddRoutingProtocol (ipv4staticRoutingImpl, 0);
node->AggregateObject(ipv4);
//ICMP
-2
View File
@@ -59,9 +59,7 @@ AddInternetStack (Ptr<Node> node)
//Routing for Ipv4
Ptr<Ipv4ListRoutingImpl> ipv4RoutingImpl = CreateObject<Ipv4ListRoutingImpl> ();
ipv4->SetRoutingProtocol (ipv4RoutingImpl);
ipv4RoutingImpl->SetNode (node);
Ptr<Ipv4StaticRoutingImpl> ipv4staticRoutingImpl = CreateObject<Ipv4StaticRoutingImpl> ();
ipv4staticRoutingImpl->SetNode (node);
ipv4RoutingImpl->AddRoutingProtocol (ipv4staticRoutingImpl, 0);
node->AggregateObject(ipv4);
//ICMP
+44
View File
@@ -23,6 +23,8 @@
#include "ns3/object.h"
#include "ns3/socket.h"
#include "ipv4-header.h"
#include "ipv4-interface-address.h"
#include "ipv4.h"
namespace ns3 {
@@ -91,6 +93,48 @@ public:
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb) = 0;
/**
* \param interface the index of the interface we are being notified about
*
* Protocols are expected to implement this method to be notified of the state change of
* an interface in a node.
*/
virtual void NotifyInterfaceUp (uint32_t interface) = 0;
/**
* \param interface the index of the interface we are being notified about
*
* Protocols are expected to implement this method to be notified of the state change of
* an interface in a node.
*/
virtual void NotifyInterfaceDown (uint32_t interface) = 0;
/**
* \param interface the index of the interface we are being notified about
* \param address a new address being added to an interface
*
* Protocols are expected to implement this method to be notified whenever
* a new address is added to an interface. Typically used to add a 'network route' on an
* interface. Can be invoked on an up or down interface.
*/
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0;
/**
* \param interface the index of the interface we are being notified about
* \param address a new address being added to an interface
*
* Protocols are expected to implement this method to be notified whenever
* a new address is removed from an interface. Typically used to remove the 'network route' of an
* interface. Can be invoked on an up or down interface.
*/
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0;
/**
* \param ipv4 the ipv4 object this routing protocol is being associated with
*
* Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol
*/
virtual void SetIpv4 (Ptr<Ipv4> ipv4) = 0;
};
} //namespace ns3
-4
View File
@@ -357,10 +357,6 @@ public:
* \see Ipv4StaticRouting::AddRoute
*/
virtual void RemoveMulticastRoute (uint32_t index) = 0;
virtual void SetNode (Ptr<Node> node) = 0;
virtual Ptr<Node> GetNode (void) const = 0;
};
} // Namespace ns3
+1 -1
View File
@@ -24,7 +24,6 @@
#include "ns3/object.h"
#include "ns3/socket.h"
#include "ns3/callback.h"
#include "ipv4-routing-protocol.h"
#include "ipv4-address.h"
#include "ipv4-interface-address.h"
@@ -33,6 +32,7 @@ namespace ns3 {
class Node;
class NetDevice;
class Packet;
class Ipv4RoutingProtocol;
/**
* \ingroup node
@@ -416,7 +416,6 @@ GlobalRouteManagerImpl::SelectRouterNodes ()
NS_LOG_LOGIC ("Adding GlobalRouting Protocol to node " << node->GetId ());
Ptr<Ipv4GlobalRouting> globalRouting = CreateObject<Ipv4GlobalRouting> ();
globalRouting->SetNode (node);
// Here, we check whether there is an existing Ipv4RoutingProtocol object
// to add this protocol to.
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
@@ -139,14 +139,13 @@ Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest)
}
if (found == true)
{
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
rtentry = Create<Ipv4Route> ();
rtentry->SetDestination (route->GetDest ());
// XXX handle multi-address case
rtentry->SetSource (ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
rtentry->SetSource (m_ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
rtentry->SetGateway (route->GetGateway ());
uint32_t interfaceIdx = route->GetInterface ();
rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
return rtentry;
}
else
@@ -318,21 +317,25 @@ Ipv4GlobalRouting::RouteInput (Ptr<const Packet> p, const Ipv4Header &ipHeader,
// route request.
}
}
void
Ipv4GlobalRouting::SetNode (Ptr<Node> node)
void
Ipv4GlobalRouting::NotifyInterfaceUp (uint32_t i)
{}
void
Ipv4GlobalRouting::NotifyInterfaceDown (uint32_t i)
{}
void
Ipv4GlobalRouting::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)
{}
void
Ipv4GlobalRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)
{}
void
Ipv4GlobalRouting::SetIpv4 (Ptr<Ipv4> ipv4)
{
NS_LOG_FUNCTION_NOARGS ();
m_node = node;
NS_LOG_FUNCTION(this << ipv4);
NS_ASSERT (m_ipv4 == 0 && ipv4 != 0);
m_ipv4 = ipv4;
}
Ptr<Node>
Ipv4GlobalRouting::GetNode (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_node;
}
}//namespace ns3
@@ -85,6 +85,11 @@ public:
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb);
virtual void NotifyInterfaceUp (uint32_t interface);
virtual void NotifyInterfaceDown (uint32_t interface);
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
/**
* \brief Add a host route to the global routing table.
@@ -189,9 +194,6 @@ public:
*/
void RemoveRoute (uint32_t i);
void SetNode (Ptr<Node> node);
Ptr<Node> GetNode (void) const;
protected:
void DoDispose (void);
@@ -208,7 +210,7 @@ private:
HostRoutes m_hostRoutes;
NetworkRoutes m_networkRoutes;
Ptr<Node> m_node;
Ptr<Ipv4> m_ipv4;
};
} // Namespace ns3
+21 -8
View File
@@ -185,19 +185,21 @@ RoutingProtocol::GetTypeId (void)
RoutingProtocol::RoutingProtocol ()
:
m_helloTimer (Timer::CANCEL_ON_DESTROY),
m_tcTimer (Timer::CANCEL_ON_DESTROY),
m_midTimer (Timer::CANCEL_ON_DESTROY),
m_queuedMessagesTimer (Timer::CANCEL_ON_DESTROY)
: m_ipv4 (0),
m_helloTimer (Timer::CANCEL_ON_DESTROY),
m_tcTimer (Timer::CANCEL_ON_DESTROY),
m_midTimer (Timer::CANCEL_ON_DESTROY),
m_queuedMessagesTimer (Timer::CANCEL_ON_DESTROY)
{}
RoutingProtocol::~RoutingProtocol ()
{}
void
RoutingProtocol::SetNode (Ptr<Node> node)
RoutingProtocol::SetIpv4 (Ptr<Ipv4> ipv4)
{
NS_ASSERT (ipv4 != 0);
NS_ASSERT (m_ipv4 == 0);
NS_LOG_DEBUG ("Created olsr::RoutingProtocol");
m_helloTimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this);
m_tcTimer.SetFunction (&RoutingProtocol::TcTimerExpire, this);
@@ -210,8 +212,7 @@ RoutingProtocol::SetNode (Ptr<Node> node)
m_linkTupleTimerFirstTime = true;
m_ipv4 = node->GetObject<Ipv4> ();
NS_ASSERT (m_ipv4);
m_ipv4 = ipv4;
}
void RoutingProtocol::DoDispose ()
@@ -2651,6 +2652,18 @@ bool RoutingProtocol::RouteInput (Ptr<const Packet> p,
return false;
}
}
void
RoutingProtocol::NotifyInterfaceUp (uint32_t i)
{}
void
RoutingProtocol::NotifyInterfaceDown (uint32_t i)
{}
void
RoutingProtocol::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)
{}
void
RoutingProtocol::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)
{}
///
+7 -2
View File
@@ -36,6 +36,7 @@
#include "ns3/timer.h"
#include "ns3/traced-callback.h"
#include "ns3/ipv4.h"
#include "ns3/ipv4-routing-protocol.h"
#include <vector>
#include <map>
@@ -67,8 +68,6 @@ public:
RoutingProtocol ();
virtual ~RoutingProtocol ();
void SetNode (Ptr<Node> node);
void Start ();
void SetMainInterface (uint32_t interface);
@@ -125,6 +124,12 @@ private:
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb);
virtual void NotifyInterfaceUp (uint32_t interface);
virtual void NotifyInterfaceDown (uint32_t interface);
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
void DoDispose ();