Longest prefix match, support for metrics, for Ipv4StaticRouting and Ipv6StaticRouting
When performing route lookup, first match for longest prefix, and then
based on metrics (default metric = 0). If metrics are equal, most recent
addition is picked. Extends API for support of metrics but preserves
diff --git a/examples/radvd-two-prefix.cc b/examples/radvd-two-prefix.cc
index bd8f0e56d..e1dd31a7e 100644
--- a/examples/radvd-two-prefix.cc
+++ b/examples/radvd-two-prefix.cc
@@ -77,7 +77,7 @@ class StackHelper
routing = routingHelper.GetStaticRouting (ipv6);
std::cout << "Routing table of " << n << " : " << std::endl;
- std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << std::endl;
+ std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << "Prefix to use" << std::endl;
nbRoutes = routing->GetNRoutes ();
for (uint32_t i = 0 ; i < nbRoutes ; i++)
@@ -85,7 +85,9 @@ class StackHelper
route = routing->GetRoute (i);
std::cout << route.GetDest () << "\t"
<< route.GetGateway () << "\t"
- << route.GetInterface () << "\t" << std::endl;
+ << route.GetInterface () << "\t"
+ << route.GetPrefixToUse () << "\t"
+ << std::endl;
}
}
};
diff --git a/examples/simple-routing-ping6.cc b/examples/simple-routing-ping6.cc
index 06e9279a4..480b72b33 100644
--- a/examples/simple-routing-ping6.cc
+++ b/examples/simple-routing-ping6.cc
@@ -33,12 +33,59 @@
#include "ns3/simulator-module.h"
#include "ns3/helper-module.h"
+#include "ns3/ipv6-routing-table-entry.h"
+
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("SimpleRoutingPing6Example");
-int
-main (int argc, char** argv)
+class StackHelper
+{
+ public:
+
+ /**
+ * \brief Add an address to a IPv6 node.
+ * \param n node
+ * \param interface interface index
+ * \param address IPv6 address to add
+ */
+ inline void AddAddress (Ptr& n, uint32_t interface, Ipv6Address address)
+ {
+ Ptr ipv6 = n->GetObject ();
+ ipv6->AddAddress (interface, address);
+ }
+
+ /**
+ * \brief Print the routing table.
+ * \param n the node
+ */
+ inline void PrintRoutingTable (Ptr& n)
+ {
+ Ptr routing = 0;
+ Ipv6StaticRoutingHelper routingHelper;
+ Ptr ipv6 = n->GetObject ();
+ uint32_t nbRoutes = 0;
+ Ipv6RoutingTableEntry route;
+
+ routing = routingHelper.GetStaticRouting (ipv6);
+
+ std::cout << "Routing table of " << n << " : " << std::endl;
+ std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << "Prefix to use" << std::endl;
+
+ nbRoutes = routing->GetNRoutes ();
+ for (uint32_t i = 0 ; i < nbRoutes ; i++)
+ {
+ route = routing->GetRoute (i);
+ std::cout << route.GetDest () << "\t"
+ << route.GetGateway () << "\t"
+ << route.GetInterface () << "\t"
+ << route.GetPrefixToUse () << "\t"
+ << std::endl;
+ }
+ }
+};
+
+int main (int argc, char** argv)
{
#if 0
LogComponentEnable ("Ipv6L3Protocol", LOG_LEVEL_ALL);
@@ -50,6 +97,8 @@ main (int argc, char** argv)
CommandLine cmd;
cmd.Parse (argc, argv);
+
+ StackHelper stackHelper;
NS_LOG_INFO ("Create nodes.");
Ptr n0 = CreateObject ();
@@ -80,6 +129,8 @@ main (int argc, char** argv)
Ipv6InterfaceContainer i2 = ipv6.Assign (d2);
i2.SetRouter (0, true);
+ stackHelper.PrintRoutingTable(n0);
+
/* Create a Ping6 application to send ICMPv6 echo request from n0 to n1 via r */
uint32_t packetSize = 1024;
uint32_t maxPacketCount = 5;
@@ -88,7 +139,6 @@ main (int argc, char** argv)
ping6.SetLocal (i1.GetAddress (0, 1));
ping6.SetRemote (i2.GetAddress (1, 1));
- /* ping6.SetRemote (Ipv6Address::GetAllNodesMulticast ()); */
ping6.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
ping6.SetAttribute ("Interval", TimeValue (interPacketInterval));
diff --git a/src/internet-stack/icmpv6-l4-protocol.cc b/src/internet-stack/icmpv6-l4-protocol.cc
index 1917c5926..fb28dd0d3 100644
--- a/src/internet-stack/icmpv6-l4-protocol.cc
+++ b/src/internet-stack/icmpv6-l4-protocol.cc
@@ -1086,6 +1086,19 @@ Ptr Icmpv6L4Protocol::CreateCache (Ptr device, Ptr device, Ptr cache, Address* hardwareDestination)
+{
+ NS_LOG_FUNCTION (this << dst << device << hardwareDestination);
+
+ if (!cache)
+ {
+ /* try to find the cache */
+ cache = FindCache (device);
+ }
+
+ return cache->Lookup (dst);
+}
+
bool Icmpv6L4Protocol::Lookup (Ptr p, Ipv6Address dst, Ptr device, Ptr cache, Address* hardwareDestination)
{
NS_LOG_FUNCTION (this << p << dst << device << hardwareDestination);
diff --git a/src/internet-stack/icmpv6-l4-protocol.h b/src/internet-stack/icmpv6-l4-protocol.h
index a1976df33..4fecb747d 100644
--- a/src/internet-stack/icmpv6-l4-protocol.h
+++ b/src/internet-stack/icmpv6-l4-protocol.h
@@ -226,7 +226,6 @@ class Icmpv6L4Protocol : public Ipv6L4Protocol
* \param id id of the packet
* \param seq sequence number
* \param data auxiliary data
- * \todo Change data to be a char[], change it too in icmpv6-header.
*/
void SendEchoReply (Ipv6Address src, Ipv6Address dst, uint16_t id, uint16_t seq, Ptr data);
@@ -349,8 +348,20 @@ class Icmpv6L4Protocol : public Ipv6L4Protocol
*/
static void FunctionDadTimeout (Ptr icmpv6, Ipv6Interface* interface, Ipv6Address addr);
+ /**
+ * \brief Lookup in the ND cache for the IPv6 address
+ * \param dst destination address
+ * \param device device
+ * \param cache the neighbor cache
+ * \param hardwareDestination hardware address
+ * \note Unlike other Lookup method, it does not send NS request!
+ */
+ bool Lookup (Ipv6Address dst, Ptr device, Ptr cache, Address* hardwareDestination);
+
/**
* \brief Lookup in the ND cache for the IPv6 address (similar as ARP protocol).
+ *
+ * It also send NS request to target and store the waiting packet.
* \param p the packet
* \param dst destination address
* \param device device
diff --git a/src/internet-stack/ipv6-l3-protocol.cc b/src/internet-stack/ipv6-l3-protocol.cc
index 4293fa0fa..1bdf10012 100644
--- a/src/internet-stack/ipv6-l3-protocol.cc
+++ b/src/internet-stack/ipv6-l3-protocol.cc
@@ -269,12 +269,6 @@ void Ipv6L3Protocol::AddAutoconfiguredAddress (uint32_t interface, Ipv6Address n
(*it)->StopPreferredTimer ();
(*it)->StopValidTimer ();
(*it)->StartPreferredTimer ();
-
- /* Suppose a link with two prefixes advertised,
- * when first prefix (which is the default route) expires,
- * the second ones router has to be default router
- */
- GetRoutingProtocol ()->NotifyAddRoute (Ipv6Address::GetAny (), Ipv6Prefix ((uint8_t)0), defaultRouter, interface, network);
return;
}
}
@@ -284,10 +278,7 @@ void Ipv6L3Protocol::AddAutoconfiguredAddress (uint32_t interface, Ipv6Address n
AddAddress (interface, address);
/* add default router
- * check to know if default route already exists is done
- * in Ipv6StaticRouting class
- *
- * If default route is already set, this function does nothing.
+ * if a previous default route exists, the new ones is simply added
*/
GetRoutingProtocol ()->NotifyAddRoute (Ipv6Address::GetAny (), Ipv6Prefix ((uint8_t)0), defaultRouter, interface, network);
@@ -327,7 +318,7 @@ void Ipv6L3Protocol::RemoveAutoconfiguredAddress (uint32_t interface, Ipv6Addres
}
}
- GetRoutingProtocol ()->NotifyRemoveRoute (Ipv6Address::GetAny (), Ipv6Prefix ((uint8_t)0), defaultRouter, interface);
+ GetRoutingProtocol ()->NotifyRemoveRoute (Ipv6Address::GetAny (), Ipv6Prefix ((uint8_t)0), defaultRouter, interface, network);
}
bool Ipv6L3Protocol::AddAddress (uint32_t i, Ipv6InterfaceAddress address)
@@ -811,7 +802,7 @@ void Ipv6L3Protocol::IpForward (Ptr rtentry, Ptr p, con
copy->AddHeader (header);
- if (icmpv6->Lookup (copy, target, rtentry->GetOutputDevice (), 0, &hardwareTarget))
+ if (icmpv6->Lookup (target, rtentry->GetOutputDevice (), 0, &hardwareTarget))
{
icmpv6->SendRedirection (copy, src, target, dst, hardwareTarget);
}
@@ -820,7 +811,7 @@ void Ipv6L3Protocol::IpForward (Ptr rtentry, Ptr p, con
icmpv6->SendRedirection (copy, src, target, dst, Address ());
}
}
-
+
SendRealOut (rtentry, packet, ipHeader);
}
diff --git a/src/node/inet6-socket-address.h b/src/node/inet6-socket-address.h
index b45798fa8..3ebd41f70 100644
--- a/src/node/inet6-socket-address.h
+++ b/src/node/inet6-socket-address.h
@@ -28,6 +28,7 @@
namespace ns3 {
/**
+ * \ingroup address
* \class Inet6SocketAddress
* \brief An Inet6 address class.
*/
diff --git a/src/node/ipv6-address.cc b/src/node/ipv6-address.cc
index 87f1caa6c..92049da87 100644
--- a/src/node/ipv6-address.cc
+++ b/src/node/ipv6-address.cc
@@ -483,6 +483,12 @@ Ipv6Address Ipv6Address::GetLoopback ()
return loopback;
}
+Ipv6Address Ipv6Address::GetOnes ()
+{
+ static Ipv6Address ones ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff");
+ return ones;
+}
+
void Ipv6Address::GetBytes (uint8_t buf[16]) const
{
memcpy (buf, m_address, 16);
@@ -491,7 +497,7 @@ void Ipv6Address::GetBytes (uint8_t buf[16]) const
bool Ipv6Address::IsLinkLocal () const
{
Ipv6Address linkLocal ("fe80::0");
- if (!IsMulticast () && ((Ipv6Address*)this)->CombinePrefix (Ipv6Prefix (64))==linkLocal)
+ if (!IsMulticast () && ((Ipv6Address*)this)->CombinePrefix (Ipv6Prefix (64)) == linkLocal)
{
return true;
}
@@ -627,6 +633,12 @@ Ipv6Prefix Ipv6Prefix::GetLoopback ()
return prefix;
}
+Ipv6Prefix Ipv6Prefix::GetOnes ()
+{
+ static Ipv6Prefix ones ((uint8_t)128);
+ return ones;
+}
+
Ipv6Prefix Ipv6Prefix::GetZero ()
{
Ipv6Prefix prefix ((uint8_t)0);
@@ -638,6 +650,25 @@ void Ipv6Prefix::GetBytes (uint8_t buf[16]) const
memcpy (buf, m_prefix, 16);
}
+uint8_t Ipv6Prefix::GetPrefixLength () const
+{
+ uint8_t i = 0;
+ uint8_t prefixLength = 0;
+
+ for(i = 0 ; i < 16 ; i++)
+ {
+ uint8_t mask = m_prefix[i];
+
+ while(mask != 0)
+ {
+ mask = mask << 1;
+ prefixLength++;
+ }
+ }
+
+ return prefixLength;
+}
+
bool Ipv6Prefix::IsEqual (const Ipv6Prefix& other) const
{
if (!memcmp (m_prefix, other.m_prefix, 16))
diff --git a/src/node/ipv6-address.h b/src/node/ipv6-address.h
index 6633f2fc7..1adf8b0e2 100644
--- a/src/node/ipv6-address.h
+++ b/src/node/ipv6-address.h
@@ -35,6 +35,7 @@ class Ipv6Prefix;
class Mac48Address;
/**
+ * \ingroup address
* \class Ipv6Address
* \brief Describes an IPv6 address.
* \see Ipv6Prefix
@@ -253,6 +254,12 @@ class Ipv6Address
*/
static Ipv6Address GetLoopback ();
+ /**
+ * \brief Get the "all-1" IPv6 address (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
+ * \return all-1 Ipv6Address representation
+ */
+ static Ipv6Address GetOnes ();
+
/**
* \brief Get the bytes corresponding to the address.
* \param buf buffer to store the data
@@ -284,6 +291,7 @@ class Ipv6Address
};
/**
+ * \ingroup address
* \class Ipv6Prefix
* \brief Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.
* \see Ipv6Address
@@ -346,6 +354,12 @@ class Ipv6Prefix
*/
void GetBytes (uint8_t buf[16]) const;
+ /**
+ * \brief Get prefix length.
+ * \return prefix length
+ */
+ uint8_t GetPrefixLength () const;
+
/**
* \brief Comparison operation between two Ipv6Prefix.
* \param other the IPv6 prefix to which to compare this prefix
@@ -367,6 +381,12 @@ class Ipv6Prefix
*/
static Ipv6Prefix GetLoopback ();
+ /**
+ * \brief Get the "all-1" IPv6 mask (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
+ * \return /128 Ipv6Prefix representation
+ */
+ static Ipv6Prefix GetOnes ();
+
/**
* \brief Get the zero prefix ( /0).
* \return an Ipv6Prefix
diff --git a/src/node/ipv6-routing-protocol.h b/src/node/ipv6-routing-protocol.h
index d449e094c..34b7627f6 100644
--- a/src/node/ipv6-routing-protocol.h
+++ b/src/node/ipv6-routing-protocol.h
@@ -37,14 +37,16 @@ class NetDevice;
/**
* \ingroup node
- * \defgroup ipv6Routing Ipv6 Routing
- *
- * Abstract base class for Ipv6 routing protocols. Defines two
- * virtual functions for packet routing and forwarding. The first,
+ * \defgroup ipv6Routing Ipv6RoutingProtocol
+ */
+/**
+ * \ingroup ipv6Routing
+ * \brief Abstract base class for Ipv6 routing protocols.
+ *
+ * Defines two virtual functions for packet routing and forwarding. The first,
* RouteOutput (), is used for locally originated packets, and the second,
* RouteInput (), is used for forwarding and/or delivering received packets.
* Also defines the signatures of four callbacks used in RouteInput ().
- *
*/
class Ipv6RoutingProtocol : public Object
{
@@ -153,8 +155,9 @@ public:
* \param mask destination mask
* \param nextHop nextHop for this destination
* \param interface output interface
+ * \param prefixToUse prefix to use as source with this route
*/
- virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface) = 0;
+ virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ()) = 0;
/**
* \param ipv6 the ipv6 object this routing protocol is being associated with
diff --git a/src/routing/list-routing/ipv6-list-routing.cc b/src/routing/list-routing/ipv6-list-routing.cc
index 83748dcdd..4a8efd627 100644
--- a/src/routing/list-routing/ipv6-list-routing.cc
+++ b/src/routing/list-routing/ipv6-list-routing.cc
@@ -257,7 +257,7 @@ void Ipv6ListRouting::NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Addr
}
}
-void Ipv6ListRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface)
+void Ipv6ListRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
{
NS_LOG_FUNCTION (this << dst << mask << nextHop << interface);
for (Ipv6RoutingProtocolList::const_iterator rprotoIter =
@@ -265,7 +265,7 @@ void Ipv6ListRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6A
rprotoIter != m_routingProtocols.end ();
rprotoIter++)
{
- (*rprotoIter).second->NotifyRemoveRoute (dst, mask, nextHop, interface);
+ (*rprotoIter).second->NotifyRemoveRoute (dst, mask, nextHop, interface, prefixToUse);
}
}
@@ -352,7 +352,7 @@ public:
void NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address) {}
void NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address) {}
void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ()) {}
- void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface) {}
+ void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse) {}
void SetIpv6 (Ptr ipv6) {}
};
@@ -367,7 +367,7 @@ public:
void NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address) {}
void NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address) {}
void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ()) {}
- void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface) {}
+ void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse) {}
void SetIpv6 (Ptr ipv6) {}
};
diff --git a/src/routing/list-routing/ipv6-list-routing.h b/src/routing/list-routing/ipv6-list-routing.h
index 54fd4b0a4..03db18704 100644
--- a/src/routing/list-routing/ipv6-list-routing.h
+++ b/src/routing/list-routing/ipv6-list-routing.h
@@ -85,7 +85,7 @@ public:
virtual void NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address);
virtual void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
- virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface);
+ virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
virtual void SetIpv6 (Ptr ipv6);
protected:
diff --git a/src/routing/static-routing/ipv6-routing-table-entry.cc b/src/routing/static-routing/ipv6-routing-table-entry.cc
index 157fc9714..a5c8381b4 100644
--- a/src/routing/static-routing/ipv6-routing-table-entry.cc
+++ b/src/routing/static-routing/ipv6-routing-table-entry.cc
@@ -57,7 +57,7 @@ Ipv6RoutingTableEntry::Ipv6RoutingTableEntry (Ipv6Address dest, Ipv6Address gate
Ipv6RoutingTableEntry::Ipv6RoutingTableEntry (Ipv6Address dest, uint32_t interface)
: m_dest (dest),
- m_destNetworkPrefix (Ipv6Prefix (128)),
+ m_destNetworkPrefix (Ipv6Prefix::GetOnes ()),
m_gateway (Ipv6Address::GetZero ()),
m_interface (interface),
m_prefixToUse (Ipv6Address ("::"))
@@ -107,8 +107,7 @@ Ipv6RoutingTableEntry::~Ipv6RoutingTableEntry ()
bool Ipv6RoutingTableEntry::IsHost () const
{
- static Ipv6Prefix prefix (128);
- if (m_destNetworkPrefix.IsEqual (prefix))
+ if (m_destNetworkPrefix.IsEqual (Ipv6Prefix::GetOnes ()))
{
return true;
}
@@ -170,7 +169,7 @@ Ipv6Address Ipv6RoutingTableEntry::GetGateway () const
Ipv6RoutingTableEntry Ipv6RoutingTableEntry::CreateHostRouteTo (Ipv6Address dest, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
{
- return Ipv6RoutingTableEntry (dest, Ipv6Prefix (128), nextHop, interface, prefixToUse);
+ return Ipv6RoutingTableEntry (dest, Ipv6Prefix::GetOnes (), nextHop, interface, prefixToUse);
}
Ipv6RoutingTableEntry Ipv6RoutingTableEntry::CreateHostRouteTo (Ipv6Address dest, uint32_t interface)
diff --git a/src/routing/static-routing/ipv6-static-routing.cc b/src/routing/static-routing/ipv6-static-routing.cc
index 1c8937f0b..29052d0f1 100644
--- a/src/routing/static-routing/ipv6-static-routing.cc
+++ b/src/routing/static-routing/ipv6-static-routing.cc
@@ -40,9 +40,8 @@ TypeId Ipv6StaticRouting::GetTypeId ()
return tid;
}
-Ipv6StaticRouting::Ipv6StaticRouting ()
- : m_defaultRoute (0),
- m_ipv6 (0)
+ Ipv6StaticRouting::Ipv6StaticRouting ()
+: m_ipv6 (0)
{
NS_LOG_FUNCTION_NOARGS ();
}
@@ -58,7 +57,7 @@ void Ipv6StaticRouting::SetIpv6 (Ptr ipv6)
NS_ASSERT (m_ipv6 == 0 && ipv6 != 0);
uint32_t i = 0;
m_ipv6 = ipv6;
-
+
for (i = 0 ; i < m_ipv6->GetNInterfaces () ; i++)
{
if (m_ipv6->IsUp (i))
@@ -72,65 +71,47 @@ void Ipv6StaticRouting::SetIpv6 (Ptr ipv6)
}
}
-void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
+void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric)
{
- NS_LOG_FUNCTION (this << dst << nextHop << interface << prefixToUse);
- Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
- *route = Ipv6RoutingTableEntry::CreateHostRouteTo (dst, nextHop, interface, prefixToUse);
- m_hostRoutes.push_back (route);
+ NS_LOG_FUNCTION (this << dst << nextHop << interface << prefixToUse << metric);
+ AddNetworkRouteTo (dst, Ipv6Prefix::GetOnes (), nextHop, interface, prefixToUse, metric);
}
-void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, uint32_t interface)
+void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, uint32_t interface, uint32_t metric)
{
- NS_LOG_FUNCTION (this << dst << interface);
- Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
- *route = Ipv6RoutingTableEntry::CreateHostRouteTo (dst, interface);
- m_hostRoutes.push_back (route);
+ NS_LOG_FUNCTION (this << dst << interface << metric);
+ AddNetworkRouteTo (dst, Ipv6Prefix::GetOnes (), interface, metric);
}
-void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface)
+void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, uint32_t metric)
{
- NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface);
+ NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << metric);
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, nextHop, interface);
- m_networkRoutes.push_back (route);
+ m_networkRoutes.push_back (std::make_pair (route, metric));
}
-void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
+void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric)
{
- NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << prefixToUse);
+ NS_LOG_FUNCTION (this << network << networkPrefix << nextHop << interface << prefixToUse << metric);
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, nextHop, interface, prefixToUse);
- m_networkRoutes.push_back (route);
+ m_networkRoutes.push_back (std::make_pair (route, metric));
}
-void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface)
+void Ipv6StaticRouting::AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface, uint32_t metric)
{
NS_LOG_FUNCTION (this << network << networkPrefix << interface);
Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkPrefix, interface);
- m_networkRoutes.push_back (route);
+ m_networkRoutes.push_back (std::make_pair (route, metric));
}
-void Ipv6StaticRouting::SetDefaultRoute (Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
+void Ipv6StaticRouting::SetDefaultRoute (Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric)
{
NS_LOG_FUNCTION (this << nextHop << interface << prefixToUse);
- Ipv6RoutingTableEntry* route = new Ipv6RoutingTableEntry ();
- *route = Ipv6RoutingTableEntry::CreateDefaultRoute (nextHop, interface);
- route->SetPrefixToUse (prefixToUse);
- delete m_defaultRoute;
- m_defaultRoute = route;
-}
-
-void Ipv6StaticRouting::RemoveDefaultRoute ()
-{
- NS_LOG_FUNCTION_NOARGS ();
- if (m_defaultRoute)
- {
- delete m_defaultRoute;
- m_defaultRoute = 0;
- }
+ AddNetworkRouteTo (Ipv6Address ("::"), Ipv6Prefix::GetZero (), nextHop, interface, prefixToUse, metric);
}
void Ipv6StaticRouting::AddMulticastRoute (Ipv6Address origin, Ipv6Address group, uint32_t inputInterface, std::vector outputInterfaces)
@@ -148,7 +129,7 @@ void Ipv6StaticRouting::SetDefaultMulticastRoute (uint32_t outputInterface)
Ipv6Address network = Ipv6Address ("ff00::"); /* RFC 3513 */
Ipv6Prefix networkMask = Ipv6Prefix (8);
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo (network, networkMask, outputInterface);
- m_networkRoutes.push_back (route);
+ m_networkRoutes.push_back (std::make_pair (route, 0));
}
uint32_t Ipv6StaticRouting::GetNMulticastRoutes () const
@@ -199,7 +180,7 @@ void Ipv6StaticRouting::RemoveMulticastRoute (uint32_t index)
{
NS_LOG_FUNCTION (this << index);
uint32_t tmp = 0;
-
+
for (MulticastRoutesI i = m_multicastRoutes.begin () ; i != m_multicastRoutes.end () ; i++)
{
if (tmp == index)
@@ -219,11 +200,11 @@ bool Ipv6StaticRouting::HasNetworkDest (Ipv6Address network, uint32_t interfaceI
/* in the network table */
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++)
{
- NS_ASSERT ((*j)->IsNetwork ());
- Ipv6Prefix prefix = (*j)->GetDestNetworkPrefix ();
- Ipv6Address entry = (*j)->GetDestNetwork ();
+ Ipv6RoutingTableEntry* rtentry = j->first;
+ Ipv6Prefix prefix = rtentry->GetDestNetworkPrefix ();
+ Ipv6Address entry = rtentry->GetDestNetwork ();
- if (prefix.IsMatch (network, entry) && (*j)->GetInterface () == interfaceIndex)
+ if (prefix.IsMatch (network, entry) && rtentry->GetInterface () == interfaceIndex)
{
return true;
}
@@ -237,10 +218,12 @@ Ptr Ipv6StaticRouting::LookupStatic (Ipv6Address dst, uint32_t interf
{
NS_LOG_FUNCTION (this << dst << interface);
Ptr rtentry = 0;
+ uint16_t longestMask = 0;
+ uint32_t shortestMetric = 0xffffffff;
/* when sending on link-local multicast, there have to be interface specified */
if (dst == Ipv6Address::GetAllNodesMulticast () || dst.IsSolicitedMulticast () ||
- dst == Ipv6Address::GetAllRoutersMulticast () || dst == Ipv6Address::GetAllHostsMulticast ())
+ dst == Ipv6Address::GetAllRoutersMulticast () || dst == Ipv6Address::GetAllHostsMulticast ())
{
NS_ASSERT_MSG (interface > 0, "Try to send on link-local multicast address, and no interface index is given!");
rtentry = Create ();
@@ -251,110 +234,81 @@ Ptr Ipv6StaticRouting::LookupStatic (Ipv6Address dst, uint32_t interf
return rtentry;
}
- /* is the destination in hosts table */
- for (HostRoutesCI i = m_hostRoutes.begin () ; i != m_hostRoutes.end () ; i++)
+ for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
{
- NS_ASSERT ((*i)->IsHost ());
- if ((*i)->GetDest ().IsEqual (dst))
+ Ipv6RoutingTableEntry* j = it->first;
+ uint32_t metric = it->second;
+ Ipv6Prefix mask = j->GetDestNetworkPrefix ();
+ uint16_t maskLen = mask.GetPrefixLength ();
+ Ipv6Address entry = j->GetDestNetwork ();
+
+ NS_LOG_LOGIC ("Searching for route to " << dst << ", mask length " << maskLen << ", metric " << metric);
+
+ if (mask.IsMatch (dst, entry))
{
- if (!interface || interface == (*i)->GetInterface ())
- {
- NS_LOG_LOGIC ("Found global host route " << *i);
- Ipv6RoutingTableEntry* route = (*i);
- rtentry = Create ();
- uint32_t interfaceIdx = route->GetInterface ();
- rtentry->SetDestination (route->GetDest ());
+ NS_LOG_LOGIC ("Found global network route " << j << ", mask length " << maskLen << ", metric " << metric);
- if (route->GetGateway ().IsAny ())
- {
- rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
- }
- else
- {
- rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetGateway ()));
- }
-
- rtentry->SetGateway (route->GetGateway ());
- rtentry->SetOutputDevice (m_ipv6->GetNetDevice (interfaceIdx));
- return rtentry;
- }
- }
- }
-
- /* or in the network table */
- for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++)
- {
- NS_ASSERT ((*j)->IsNetwork ());
- Ipv6Prefix prefix = (*j)->GetDestNetworkPrefix ();
- Ipv6Address entry = (*j)->GetDestNetwork ();
-
- if (prefix.IsMatch (dst, entry))
- {
/* if interface is given, check the route will output on this interface */
- if (!interface || interface == (*j)->GetInterface ())
+ if (!interface || interface == j->GetInterface ())
{
- NS_LOG_LOGIC ("Found global network route " << *j);
- Ipv6RoutingTableEntry* route = (*j);
- rtentry = Create();
+ if (maskLen < longestMask)
+ {
+ NS_LOG_LOGIC ("Previous match longer, skipping");
+ continue;
+ }
+
+ if (maskLen > longestMask)
+ {
+ shortestMetric = 0xffffffff;
+ }
+
+ longestMask = maskLen;
+ if (metric > shortestMetric)
+ {
+ NS_LOG_LOGIC ("Equal mask length, but previous metric shorter, skipping");
+ continue;
+ }
+
+ shortestMetric = metric;
+ Ipv6RoutingTableEntry* route = j;
uint32_t interfaceIdx = route->GetInterface ();
- rtentry->SetDestination (route->GetDest ());
-
+ rtentry = Create ();
+
+
if (route->GetGateway ().IsAny ())
{
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
}
+ else if (route->GetDest ().IsAny ()) /* default route */
+ {
+ rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetPrefixToUse ().IsAny () ? route->GetGateway () : route->GetPrefixToUse ()));
+ }
else
{
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetGateway ()));
}
+ rtentry->SetDestination (route->GetDest ());
rtentry->SetGateway (route->GetGateway ());
rtentry->SetOutputDevice (m_ipv6->GetNetDevice (interfaceIdx));
- return rtentry;
}
}
}
- /* not found, return the default route if any */
- if (m_defaultRoute != 0)
- {
- NS_ASSERT (m_defaultRoute->IsDefault ());
- NS_LOG_LOGIC ("Found global network route via default route " << m_defaultRoute);
- Ipv6RoutingTableEntry* route = m_defaultRoute;
- rtentry = Create();
- uint32_t interfaceIdx = route->GetInterface ();
- rtentry->SetDestination (route->GetDest ());
- rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetPrefixToUse ().IsAny () ? route->GetGateway () : route->GetPrefixToUse ()));
- rtentry->SetGateway (route->GetGateway ());
- rtentry->SetOutputDevice (m_ipv6->GetNetDevice (interfaceIdx));
- return rtentry;
- }
-
- /* beuh!!! not route at all */
- return 0;
+ NS_LOG_LOGIC ("Matching route via " << rtentry->GetDestination () << " (throught " << rtentry->GetGateway () << ") at the end");
+ return rtentry;
}
void Ipv6StaticRouting::DoDispose ()
{
NS_LOG_FUNCTION_NOARGS ();
- for (HostRoutesI i = m_hostRoutes.begin () ; i != m_hostRoutes.end () ; i = m_hostRoutes.erase (i))
- {
- delete (*i);
- }
- m_hostRoutes.clear ();
-
+
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j = m_networkRoutes.erase (j))
{
- delete (*j);
+ delete j->first;
}
m_networkRoutes.clear ();
-
- if (m_defaultRoute != 0)
- {
- delete m_defaultRoute;
- m_defaultRoute = 0;
- }
-
+
for (MulticastRoutesI i = m_multicastRoutes.begin () ; i != m_multicastRoutes.end () ; i = m_multicastRoutes.erase (i))
{
delete (*i);
@@ -392,23 +346,23 @@ Ptr Ipv6StaticRouting::LookupStatic (Ipv6Address origin, Ipv
if (group == route->GetGroup ())
{
- if (interface == Ipv6::IF_ANY || interface == route->GetInputInterface ())
- {
- NS_LOG_LOGIC ("Found multicast route" << *i);
- mrtentry = Create();
- mrtentry->SetGroup (route->GetGroup ());
- mrtentry->SetOrigin (route->GetOrigin ());
- mrtentry->SetParent (route->GetInputInterface ());
- for (uint32_t j = 0 ; j < route->GetNOutputInterfaces () ; j++)
+ if (interface == Ipv6::IF_ANY || interface == route->GetInputInterface ())
+ {
+ NS_LOG_LOGIC ("Found multicast route" << *i);
+ mrtentry = Create ();
+ mrtentry->SetGroup (route->GetGroup ());
+ mrtentry->SetOrigin (route->GetOrigin ());
+ mrtentry->SetParent (route->GetInputInterface ());
+ for (uint32_t j = 0 ; j < route->GetNOutputInterfaces () ; j++)
+ {
+ if (route->GetOutputInterface (j))
{
- if (route->GetOutputInterface (j))
- {
- NS_LOG_LOGIC ("Setting output interface index " << route->GetOutputInterface (j));
- mrtentry->SetOutputTtl (route->GetOutputInterface (j), Ipv6MulticastRoute::MAX_TTL - 1);
- }
+ NS_LOG_LOGIC ("Setting output interface index " << route->GetOutputInterface (j));
+ mrtentry->SetOutputTtl (route->GetOutputInterface (j), Ipv6MulticastRoute::MAX_TTL - 1);
}
- return mrtentry;
- }
+ }
+ return mrtentry;
+ }
}
}
return mrtentry;
@@ -416,23 +370,40 @@ Ptr Ipv6StaticRouting::LookupStatic (Ipv6Address origin, Ipv
uint32_t Ipv6StaticRouting::GetNRoutes ()
{
- NS_LOG_FUNCTION_NOARGS ();
- uint32_t n = 0;
- if (m_defaultRoute != 0)
- {
- n++;
- }
- n += m_hostRoutes.size ();
- n += m_networkRoutes.size ();
- return n;
+ return m_networkRoutes.size ();
}
Ipv6RoutingTableEntry Ipv6StaticRouting::GetDefaultRoute ()
{
NS_LOG_FUNCTION_NOARGS ();
- if (m_defaultRoute != 0)
+ Ipv6Address dst ("::");
+ uint32_t shortestMetric = 0xffffffff;
+ Ipv6RoutingTableEntry* result = 0;
+
+ for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
{
- return *m_defaultRoute;
+ Ipv6RoutingTableEntry* j = it->first;
+ uint32_t metric = it->second;
+ Ipv6Prefix mask = j->GetDestNetworkPrefix ();
+ uint16_t maskLen = mask.GetPrefixLength ();
+ Ipv6Address entry = j->GetDestNetwork ();
+
+ if (maskLen)
+ {
+ continue;
+ }
+
+ if (metric > shortestMetric)
+ {
+ continue;
+ }
+ shortestMetric = metric;
+ result = j;
+ }
+
+ if (result)
+ {
+ return result;
}
else
{
@@ -443,38 +414,13 @@ Ipv6RoutingTableEntry Ipv6StaticRouting::GetDefaultRoute ()
Ipv6RoutingTableEntry Ipv6StaticRouting::GetRoute (uint32_t index)
{
NS_LOG_FUNCTION (this << index);
-
- if (index == 0 && m_defaultRoute != 0)
- {
- return *m_defaultRoute;
- }
-
- if (index > 0 && m_defaultRoute != 0)
- {
- index--;
- }
-
- if (index < m_hostRoutes.size ())
- {
- uint32_t tmp = 0;
- for (HostRoutesCI i = m_hostRoutes.begin () ; i != m_hostRoutes.end () ; i++)
- {
- if (tmp == index)
- {
- return *i;
- }
- tmp++;
- }
- }
-
- index -= m_hostRoutes.size ();
uint32_t tmp = 0;
- for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++)
+ for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
{
if (tmp == index)
{
- return *j;
+ return it->first;
}
tmp++;
}
@@ -483,43 +429,36 @@ Ipv6RoutingTableEntry Ipv6StaticRouting::GetRoute (uint32_t index)
return 0;
}
-void Ipv6StaticRouting::RemoveRoute (uint32_t index)
+uint32_t Ipv6StaticRouting::GetMetric (uint32_t index)
{
- NS_LOG_FUNCTION (this << index);
- if (index == 0 && m_defaultRoute != 0)
- {
- delete m_defaultRoute;
- m_defaultRoute = 0;
- }
-
- if (index > 0 && m_defaultRoute != 0)
- {
- index--;
- }
-
- if (index < m_hostRoutes.size ())
- {
- uint32_t tmp = 0;
- for (HostRoutesI i = m_hostRoutes.begin () ; i != m_hostRoutes.end () ; i++)
- {
- if (tmp == index)
- {
- delete *i;
- m_hostRoutes.erase (i);
- return;
- }
- tmp++;
- }
- }
- index -= m_hostRoutes.size ();
+ NS_LOG_FUNCTION_NOARGS ();
uint32_t tmp = 0;
-
- for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++)
+
+ for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
{
if (tmp == index)
{
- delete *j;
- m_networkRoutes.erase (j);
+ return it->second;
+ }
+ tmp++;
+ }
+ NS_ASSERT (false);
+ // quiet compiler.
+ return 0;
+}
+
+
+void Ipv6StaticRouting::RemoveRoute (uint32_t index)
+{
+ NS_LOG_FUNCTION (this << index);
+ uint32_t tmp = 0;
+
+ for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
+ {
+ if (tmp == index)
+ {
+ delete it->first;
+ m_networkRoutes.erase (it);
return;
}
tmp++;
@@ -527,15 +466,18 @@ void Ipv6StaticRouting::RemoveRoute (uint32_t index)
NS_ASSERT (false);
}
-void Ipv6StaticRouting::RemoveRoute (Ipv6Address network, Ipv6Prefix prefix, uint32_t ifIndex)
+void Ipv6StaticRouting::RemoveRoute (Ipv6Address network, Ipv6Prefix prefix, uint32_t ifIndex, Ipv6Address prefixToUse)
{
NS_LOG_FUNCTION (this << network << prefix << ifIndex);
- for (NetworkRoutesI i = m_networkRoutes.begin () ; i != m_networkRoutes.end () ; i++)
+
+ for (NetworkRoutesI it = m_networkRoutes.begin () ; it != m_networkRoutes.end () ; it++)
{
- if (network == (*i)->GetDest () and (*i)->GetInterface () == ifIndex)
+ Ipv6RoutingTableEntry* rtentry = it->first;
+ if (network == rtentry->GetDest () && rtentry->GetInterface () == ifIndex &&
+ rtentry->GetPrefixToUse () == prefixToUse)
{
- delete *i;
- m_networkRoutes.erase (i);
+ delete it->first;
+ m_networkRoutes.erase (it);
return;
}
}
@@ -557,7 +499,7 @@ Ptr Ipv6StaticRouting::RouteOutput (Ptr p, const Ipv6Header &
// So, we just log it and fall through to LookupStatic ()
NS_LOG_LOGIC ("RouteOutput ()::Multicast destination");
}
-
+
rtentry = LookupStatic (destination, oif);
if (rtentry)
{
@@ -580,7 +522,8 @@ bool Ipv6StaticRouting::RouteInput (Ptr p, const Ipv6Header &ipHea
{
NS_LOG_LOGIC ("Multicast destination");
Ptr mrtentry = LookupStatic (ipHeader.GetSourceAddress (),
- ipHeader.GetDestinationAddress (), m_ipv6->GetInterfaceForDevice (idev));
+ ipHeader.GetDestinationAddress ()
+ , m_ipv6->GetInterfaceForDevice (idev));
if (mrtentry)
{
@@ -594,9 +537,9 @@ bool Ipv6StaticRouting::RouteInput (Ptr p, const Ipv6Header &ipHea
return false; // Let other routing protocols try to handle this
}
}
-//
-// This is a unicast packet. Check to see if we have a route for it.
-//
+ //
+ // This is a unicast packet. Check to see if we have a route for it.
+ //
NS_LOG_LOGIC ("Unicast destination");
Ptr rtentry = LookupStatic (ipHeader.GetDestinationAddress ());
@@ -618,7 +561,7 @@ void Ipv6StaticRouting::NotifyInterfaceUp (uint32_t i)
for (uint32_t j = 0 ; j < m_ipv6->GetNAddresses (i) ; j++)
{
if (m_ipv6->GetAddress (i, j).GetAddress () != Ipv6Address () &&
- m_ipv6->GetAddress (i, j).GetPrefix () != Ipv6Prefix ())
+ m_ipv6->GetAddress (i, j).GetPrefix () != Ipv6Prefix ())
{
if (m_ipv6->GetAddress (i, j).GetPrefix () == Ipv6Prefix (128))
{
@@ -628,7 +571,7 @@ void Ipv6StaticRouting::NotifyInterfaceUp (uint32_t i)
else
{
AddNetworkRouteTo (m_ipv6->GetAddress (i, j).GetAddress ().CombinePrefix (m_ipv6->GetAddress (i, j).GetPrefix ()),
- m_ipv6->GetAddress (i, j).GetPrefix (), i);
+ m_ipv6->GetAddress (i, j).GetPrefix (), i);
}
}
}
@@ -636,8 +579,12 @@ void Ipv6StaticRouting::NotifyInterfaceUp (uint32_t i)
void Ipv6StaticRouting::NotifyInterfaceDown (uint32_t i)
{
+ NS_LOG_FUNCTION (this << i);
+ uint32_t j = 0;
+ uint32_t max = GetNRoutes ();
+
/* remove all static routes that are going through this interface */
- for (uint32_t j = 0 ; j < GetNRoutes () ; j++)
+ while (j < max)
{
Ipv6RoutingTableEntry route = GetRoute (j);
@@ -645,6 +592,10 @@ void Ipv6StaticRouting::NotifyInterfaceDown (uint32_t i)
{
RemoveRoute (j);
}
+ else
+ {
+ j++;
+ }
}
}
@@ -673,13 +624,13 @@ void Ipv6StaticRouting::NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAd
Ipv6Address networkAddress = address.GetAddress ().CombinePrefix (address.GetPrefix ());
Ipv6Prefix networkMask = address.GetPrefix ();
-
+
// Remove all static routes that are going through this interface
// which reference this network
for (uint32_t j = 0 ; j < GetNRoutes () ; j++)
{
Ipv6RoutingTableEntry route = GetRoute (j);
-
+
if (route.GetInterface () == interface &&
route.IsNetwork () &&
route.GetDestNetwork () == networkAddress &&
@@ -693,11 +644,7 @@ void Ipv6StaticRouting::NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAd
void Ipv6StaticRouting::NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
{
NS_LOG_INFO (this << dst << mask << nextHop << interface << prefixToUse);
- if (mask == Ipv6Prefix (128))
- {
- AddHostRouteTo (dst, nextHop, interface);
- }
- else if (dst != Ipv6Address::GetZero ())
+ if (dst != Ipv6Address::GetZero ())
{
AddNetworkRouteTo (dst, mask, nextHop, interface);
}
@@ -706,40 +653,24 @@ void Ipv6StaticRouting::NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Ad
/* this case is mainly used by configuring default route following RA processing,
* in case of multipe prefix in RA, the first will configured default route
*/
- if (!m_defaultRoute)
- {
- SetDefaultRoute (nextHop, interface, prefixToUse);
- }
+ SetDefaultRoute (nextHop, interface, prefixToUse);
}
}
-void Ipv6StaticRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface)
+void Ipv6StaticRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse)
{
NS_LOG_FUNCTION (this << dst << mask << nextHop << interface);
- if (mask == Ipv6Prefix (128))
- {
- for (HostRoutesI j = m_hostRoutes.begin () ; j != m_hostRoutes.end () ; j++)
- {
- Ipv6Prefix prefix = (*j)->GetDestNetworkPrefix ();
- Ipv6Address entry = (*j)->GetDestNetwork ();
-
- if (dst == entry && prefix == mask && (*j)->GetInterface () == interface)
- {
- delete (*j);
- m_hostRoutes.erase (j);
- }
- }
- }
- else if (dst != Ipv6Address::GetZero ())
+ if (dst != Ipv6Address::GetZero ())
{
for (NetworkRoutesI j = m_networkRoutes.begin () ; j != m_networkRoutes.end () ; j++)
{
- Ipv6Prefix prefix = (*j)->GetDestNetworkPrefix ();
- Ipv6Address entry = (*j)->GetDestNetwork ();
+ Ipv6RoutingTableEntry* rtentry = j->first;
+ Ipv6Prefix prefix = rtentry->GetDestNetworkPrefix ();
+ Ipv6Address entry = rtentry->GetDestNetwork ();
- if (dst == entry && prefix == mask && (*j)->GetInterface () == interface)
+ if (dst == entry && prefix == mask && rtentry->GetInterface () == interface)
{
- delete (*j);
+ delete j->first;
m_networkRoutes.erase (j);
}
}
@@ -747,17 +678,7 @@ void Ipv6StaticRouting::NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv
else
{
/* default route case */
- if (!m_defaultRoute)
- {
- return;
- }
-
- if (m_defaultRoute->GetInterface () == interface && m_defaultRoute->GetGateway () == nextHop)
- {
- NS_LOG_LOGIC ("Remove default route (maybe because autoconfigured address expired)");
- delete m_defaultRoute;
- m_defaultRoute = 0;
- }
+ RemoveRoute (dst, mask, interface, prefixToUse);
}
}
@@ -785,7 +706,7 @@ Ipv6Address Ipv6StaticRouting::SourceAddressSelection (uint32_t interface, Ipv6A
return test.GetAddress ();
}
}
-
+
return ret;
}
diff --git a/src/routing/static-routing/ipv6-static-routing.h b/src/routing/static-routing/ipv6-static-routing.h
index 2593b60b2..363b14012 100644
--- a/src/routing/static-routing/ipv6-static-routing.h
+++ b/src/routing/static-routing/ipv6-static-routing.h
@@ -44,6 +44,9 @@ class Ipv6MulticastRoutingTableEntry;
/**
* \ingroup routing
* \defgroup ipv6StaticRouting Ipv6StaticRouting
+ */
+/**
+ * \ingroup ipv6StaticRouting
* \class Ipv6StaticRouting
* \brief Static routing protocol for IP version 6 stack.
* \see Ipv6RoutingProtocol
@@ -74,15 +77,17 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
* \param nextHop next hop address to route the packet
* \param interface interface index
* \param prefixToUse prefix that should be used for source address for this destination
+ * \param metric metric of route in case of multiple routes to same destination
*/
- void AddHostRouteTo (Ipv6Address dest, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address ("::"));
+ void AddHostRouteTo (Ipv6Address dest, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address ("::"), uint32_t metric = 0);
/**
* \brief Add route to host.
* \param dest destination address.
* \param interface interface index
+ * \param metric metric of route in case of multiple routes to same destination
*/
- void AddHostRouteTo (Ipv6Address dest, uint32_t interface);
+ void AddHostRouteTo (Ipv6Address dest, uint32_t interface, uint32_t metric = 0);
/**
* \brief Add route to network.
@@ -90,8 +95,9 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
* \param networkPrefix network prefix*
* \param nextHop next hop address to route the packet
* \param interface interface index
+ * \param metric metric of route in case of multiple routes to same destination
*/
- void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface);
+ void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, uint32_t metric = 0);
/**
* \brief Add route to network.
@@ -100,29 +106,27 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
* \param nextHop next hop address to route the packet
* \param interface interface index
* \param prefixToUse prefix that should be used for source address for this destination
+ * \param metric metric of route in case of multiple routes to same destination
*/
- void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse);
+ void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric = 0);
/**
* \brief Add route to network.
* \param network network address
* \param networkPrefix network prefix
* \param interface interface index
+ * \param metric metric of route in case of multiple routes to same destination
*/
- void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface);
+ void AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface, uint32_t metric = 0);
/**
* \brief Set the default route.
* \param nextHop next hop address to route the packet
* \param interface interface index
* \param prefixToUse prefix to use (i.e for multihoming)
+ * \param metric metric of route in case of multiple routes to same destination
*/
- void SetDefaultRoute (Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address ("::"));
-
- /**
- * \brief Remove the default route.
- */
- void RemoveDefaultRoute ();
+ void SetDefaultRoute (Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address ("::"), uint32_t metric = 0);
/**
* \brief Get the number or entries in the routing table.
@@ -132,6 +136,8 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
/**
* \brief Get the default route.
+ *
+ * If multiple default routes exist, the one with lowest metric is returned.
* \return default Ipv6Route
*/
Ipv6RoutingTableEntry GetDefaultRoute ();
@@ -143,6 +149,13 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
*/
Ipv6RoutingTableEntry GetRoute (uint32_t i);
+ /**
+ * \brief Get a metric for route from the static unicast routing table.
+ * \param index The index (into the routing table) of the route to retrieve.
+ * \return If route is set, the metric is returned. If not, an infinity metric (0xffffffff) is returned
+ */
+ uint32_t GetMetric (uint32_t index);
+
/**
* \brief Remove a route from the routing table.
* \param i index
@@ -154,8 +167,9 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
* \param network IPv6 network
* \param prefix IPv6 prefix
* \param ifIndex interface index
+ * \param prefixToUse IPv6 prefix to use with this route (multihoming)
*/
- void RemoveRoute (Ipv6Address network, Ipv6Prefix prefix, uint32_t ifIndex);
+ void RemoveRoute (Ipv6Address network, Ipv6Prefix prefix, uint32_t ifIndex, Ipv6Address prefixToUse);
/**
* \brief Add a multicast route for a given multicast source and group.
@@ -219,7 +233,7 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
virtual void NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address);
virtual void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
- virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface);
+ virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
virtual void SetIpv6 (Ptr ipv6);
protected:
@@ -229,12 +243,9 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
void DoDispose ();
private:
- typedef std::list HostRoutes;
- typedef std::list::const_iterator HostRoutesCI;
- typedef std::list::iterator HostRoutesI;
- typedef std::list NetworkRoutes;
- typedef std::list::const_iterator NetworkRoutesCI;
- typedef std::list::iterator NetworkRoutesI;
+ typedef std::list > NetworkRoutes;
+ typedef std::list >::const_iterator NetworkRoutesCI;
+ typedef std::list >::iterator NetworkRoutesI;
typedef std::list MulticastRoutes;
typedef std::list::const_iterator MulticastRoutesCI;
@@ -265,21 +276,11 @@ class Ipv6StaticRouting : public Ipv6RoutingProtocol
*/
Ipv6Address SourceAddressSelection (uint32_t interface, Ipv6Address dest);
- /**
- * \brief the forwarding table for hosts.
- */
- HostRoutes m_hostRoutes;
-
/**
* \brief the forwarding table for network.
*/
NetworkRoutes m_networkRoutes;
- /**
- * \brief the default route.
- */
- Ipv6RoutingTableEntry *m_defaultRoute;
-
/**
* \brief the forwarding table for multicast.
*/
From 9285510a27f197b20ec9c3cb0fbd29302af43485 Mon Sep 17 00:00:00 2001
From: Sebastien Vincent
Date: Mon, 7 Sep 2009 18:03:20 +0200
Subject: [PATCH 18/22] Rescan python bindings.
---
bindings/python/ns3_module_list_routing.py | 4 +-
bindings/python/ns3_module_node.py | 19 +-
bindings/python/ns3_module_static_routing.py | 40 +--
bindings/python/ns3_module_wifi.py | 308 +++++++++----------
4 files changed, 193 insertions(+), 178 deletions(-)
diff --git a/bindings/python/ns3_module_list_routing.py b/bindings/python/ns3_module_list_routing.py
index 45ccab777..83a246a33 100644
--- a/bindings/python/ns3_module_list_routing.py
+++ b/bindings/python/ns3_module_list_routing.py
@@ -180,10 +180,10 @@ def register_Ns3Ipv6ListRouting_methods(root_module, cls):
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv6InterfaceAddress', 'address')],
is_virtual=True)
- ## ipv6-list-routing.h: void ns3::Ipv6ListRouting::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface) [member function]
+ ## ipv6-list-routing.h: void ns3::Ipv6ListRouting::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address::GetZero( )) [member function]
cls.add_method('NotifyRemoveRoute',
'void',
- [param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface')],
+ [param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address::GetZero( )')],
is_virtual=True)
## ipv6-list-routing.h: bool ns3::Ipv6ListRouting::RouteInput(ns3::Ptr p, ns3::Ipv6Header const & header, ns3::Ptr idev, ns3::Callback,ns3::Ptr,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback,ns3::Ptr,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback,const ns3::Ipv6Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback,const ns3::Ipv6Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
diff --git a/bindings/python/ns3_module_node.py b/bindings/python/ns3_module_node.py
index 21d08229d..cde79634d 100644
--- a/bindings/python/ns3_module_node.py
+++ b/bindings/python/ns3_module_node.py
@@ -762,6 +762,11 @@ def register_Ns3Ipv6Address_methods(root_module, cls):
'ns3::Ipv6Address',
[],
is_static=True)
+ ## ipv6-address.h: static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function]
+ cls.add_method('GetOnes',
+ 'ns3::Ipv6Address',
+ [],
+ is_static=True)
## ipv6-address.h: static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv6Address',
@@ -933,6 +938,16 @@ def register_Ns3Ipv6Prefix_methods(root_module, cls):
'ns3::Ipv6Prefix',
[],
is_static=True)
+ ## ipv6-address.h: static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function]
+ cls.add_method('GetOnes',
+ 'ns3::Ipv6Prefix',
+ [],
+ is_static=True)
+ ## ipv6-address.h: uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function]
+ cls.add_method('GetPrefixLength',
+ 'uint8_t',
+ [],
+ is_const=True)
## ipv6-address.h: static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv6Prefix',
@@ -3107,10 +3122,10 @@ def register_Ns3Ipv6RoutingProtocol_methods(root_module, cls):
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv6InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
- ## ipv6-routing-protocol.h: void ns3::Ipv6RoutingProtocol::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface) [member function]
+ ## ipv6-routing-protocol.h: void ns3::Ipv6RoutingProtocol::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address::GetZero( )) [member function]
cls.add_method('NotifyRemoveRoute',
'void',
- [param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface')],
+ [param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address::GetZero( )')],
is_pure_virtual=True, is_virtual=True)
## ipv6-routing-protocol.h: bool ns3::Ipv6RoutingProtocol::RouteInput(ns3::Ptr p, ns3::Ipv6Header const & header, ns3::Ptr idev, ns3::Callback,ns3::Ptr,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback,ns3::Ptr,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback,const ns3::Ipv6Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback,const ns3::Ipv6Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
diff --git a/bindings/python/ns3_module_static_routing.py b/bindings/python/ns3_module_static_routing.py
index 8ae13399e..c64dfd9f2 100644
--- a/bindings/python/ns3_module_static_routing.py
+++ b/bindings/python/ns3_module_static_routing.py
@@ -462,34 +462,38 @@ def register_Ns3Ipv6StaticRouting_methods(root_module, cls):
cls.add_constructor([param('ns3::Ipv6StaticRouting const &', 'arg0')])
## ipv6-static-routing.h: ns3::Ipv6StaticRouting::Ipv6StaticRouting() [constructor]
cls.add_constructor([])
- ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddHostRouteTo(ns3::Ipv6Address dest, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address(((const char*)"::"))) [member function]
+ ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddHostRouteTo(ns3::Ipv6Address dest, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address(((const char*)"::")), uint32_t metric=0) [member function]
cls.add_method('AddHostRouteTo',
'void',
- [param('ns3::Ipv6Address', 'dest'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address(((const char*)"::"))')])
- ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddHostRouteTo(ns3::Ipv6Address dest, uint32_t interface) [member function]
+ [param('ns3::Ipv6Address', 'dest'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address(((const char*)"::"))'), param('uint32_t', 'metric', default_value='0')])
+ ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddHostRouteTo(ns3::Ipv6Address dest, uint32_t interface, uint32_t metric=0) [member function]
cls.add_method('AddHostRouteTo',
'void',
- [param('ns3::Ipv6Address', 'dest'), param('uint32_t', 'interface')])
+ [param('ns3::Ipv6Address', 'dest'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')])
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddMulticastRoute(ns3::Ipv6Address origin, ns3::Ipv6Address group, uint32_t inputInterface, std::vector > outputInterfaces) [member function]
cls.add_method('AddMulticastRoute',
'void',
[param('ns3::Ipv6Address', 'origin'), param('ns3::Ipv6Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')])
- ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, ns3::Ipv6Address nextHop, uint32_t interface) [member function]
+ ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, ns3::Ipv6Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
cls.add_method('AddNetworkRouteTo',
'void',
- [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface')])
- ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse) [member function]
+ [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')])
+ ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse, uint32_t metric=0) [member function]
cls.add_method('AddNetworkRouteTo',
'void',
- [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse')])
- ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, uint32_t interface) [member function]
+ [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse'), param('uint32_t', 'metric', default_value='0')])
+ ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::AddNetworkRouteTo(ns3::Ipv6Address network, ns3::Ipv6Prefix networkPrefix, uint32_t interface, uint32_t metric=0) [member function]
cls.add_method('AddNetworkRouteTo',
'void',
- [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('uint32_t', 'interface')])
+ [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'networkPrefix'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')])
## ipv6-static-routing.h: ns3::Ipv6RoutingTableEntry ns3::Ipv6StaticRouting::GetDefaultRoute() [member function]
cls.add_method('GetDefaultRoute',
'ns3::Ipv6RoutingTableEntry',
[])
+ ## ipv6-static-routing.h: uint32_t ns3::Ipv6StaticRouting::GetMetric(uint32_t index) [member function]
+ cls.add_method('GetMetric',
+ 'uint32_t',
+ [param('uint32_t', 'index')])
## ipv6-static-routing.h: ns3::Ipv6MulticastRoutingTableEntry ns3::Ipv6StaticRouting::GetMulticastRoute(uint32_t i) const [member function]
cls.add_method('GetMulticastRoute',
'ns3::Ipv6MulticastRoutingTableEntry',
@@ -542,15 +546,11 @@ def register_Ns3Ipv6StaticRouting_methods(root_module, cls):
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv6InterfaceAddress', 'address')],
is_virtual=True)
- ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface) [member function]
+ ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::NotifyRemoveRoute(ns3::Ipv6Address dst, ns3::Ipv6Prefix mask, ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address::GetZero( )) [member function]
cls.add_method('NotifyRemoveRoute',
'void',
- [param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface')],
+ [param('ns3::Ipv6Address', 'dst'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address::GetZero( )')],
is_virtual=True)
- ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::RemoveDefaultRoute() [member function]
- cls.add_method('RemoveDefaultRoute',
- 'void',
- [])
## ipv6-static-routing.h: bool ns3::Ipv6StaticRouting::RemoveMulticastRoute(ns3::Ipv6Address origin, ns3::Ipv6Address group, uint32_t inputInterface) [member function]
cls.add_method('RemoveMulticastRoute',
'bool',
@@ -563,10 +563,10 @@ def register_Ns3Ipv6StaticRouting_methods(root_module, cls):
cls.add_method('RemoveRoute',
'void',
[param('uint32_t', 'i')])
- ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::RemoveRoute(ns3::Ipv6Address network, ns3::Ipv6Prefix prefix, uint32_t ifIndex) [member function]
+ ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::RemoveRoute(ns3::Ipv6Address network, ns3::Ipv6Prefix prefix, uint32_t ifIndex, ns3::Ipv6Address prefixToUse) [member function]
cls.add_method('RemoveRoute',
'void',
- [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix'), param('uint32_t', 'ifIndex')])
+ [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix'), param('uint32_t', 'ifIndex'), param('ns3::Ipv6Address', 'prefixToUse')])
## ipv6-static-routing.h: bool ns3::Ipv6StaticRouting::RouteInput(ns3::Ptr p, ns3::Ipv6Header const & header, ns3::Ptr idev, ns3::Callback,ns3::Ptr,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback,ns3::Ptr,const ns3::Ipv6Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback,const ns3::Ipv6Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback,const ns3::Ipv6Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
@@ -581,10 +581,10 @@ def register_Ns3Ipv6StaticRouting_methods(root_module, cls):
cls.add_method('SetDefaultMulticastRoute',
'void',
[param('uint32_t', 'outputInterface')])
- ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::SetDefaultRoute(ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address(((const char*)"::"))) [member function]
+ ## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::SetDefaultRoute(ns3::Ipv6Address nextHop, uint32_t interface, ns3::Ipv6Address prefixToUse=ns3::Ipv6Address(((const char*)"::")), uint32_t metric=0) [member function]
cls.add_method('SetDefaultRoute',
'void',
- [param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address(((const char*)"::"))')])
+ [param('ns3::Ipv6Address', 'nextHop'), param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefixToUse', default_value='ns3::Ipv6Address(((const char*)"::"))'), param('uint32_t', 'metric', default_value='0')])
## ipv6-static-routing.h: void ns3::Ipv6StaticRouting::SetIpv6(ns3::Ptr ipv6) [member function]
cls.add_method('SetIpv6',
'void',
diff --git a/bindings/python/ns3_module_wifi.py b/bindings/python/ns3_module_wifi.py
index 021fcd66a..9e3c360dd 100644
--- a/bindings/python/ns3_module_wifi.py
+++ b/bindings/python/ns3_module_wifi.py
@@ -3162,31 +3162,25 @@ def register_Ns3WifiRemoteStationManager_methods(root_module, cls):
return
def register_Ns3YansWifiPhy_methods(root_module, cls):
+ ## yans-wifi-phy.h: static ns3::TypeId ns3::YansWifiPhy::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
## yans-wifi-phy.h: ns3::YansWifiPhy::YansWifiPhy() [constructor]
cls.add_constructor([])
- ## yans-wifi-phy.h: double ns3::YansWifiPhy::CalculateSnr(ns3::WifiMode txMode, double ber) const [member function]
- cls.add_method('CalculateSnr',
- 'double',
- [param('ns3::WifiMode', 'txMode'), param('double', 'ber')],
- is_const=True, is_virtual=True)
- ## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::CalculateTxDuration(uint32_t size, ns3::WifiMode payloadMode, ns3::WifiPreamble preamble) const [member function]
- cls.add_method('CalculateTxDuration',
- 'ns3::Time',
- [param('uint32_t', 'size'), param('ns3::WifiMode', 'payloadMode'), param('ns3::WifiPreamble', 'preamble')],
- is_const=True, is_virtual=True)
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::ConfigureStandard(ns3::WifiPhyStandard standard) [member function]
- cls.add_method('ConfigureStandard',
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetChannel(ns3::Ptr channel) [member function]
+ cls.add_method('SetChannel',
'void',
- [param('ns3::WifiPhyStandard', 'standard')],
+ [param('ns3::Ptr< ns3::YansWifiChannel >', 'channel')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetChannelNumber(uint16_t id) [member function]
+ cls.add_method('SetChannelNumber',
+ 'void',
+ [param('uint16_t', 'id')],
is_virtual=True)
- ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetCcaMode1Threshold() const [member function]
- cls.add_method('GetCcaMode1Threshold',
- 'double',
- [],
- is_const=True)
- ## yans-wifi-phy.h: ns3::Ptr ns3::YansWifiPhy::GetChannel() const [member function]
- cls.add_method('GetChannel',
- 'ns3::Ptr< ns3::WifiChannel >',
+ ## yans-wifi-phy.h: uint16_t ns3::YansWifiPhy::GetChannelNumber() const [member function]
+ cls.add_method('GetChannelNumber',
+ 'uint16_t',
[],
is_const=True, is_virtual=True)
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetChannelFrequencyMhz() const [member function]
@@ -3194,19 +3188,67 @@ def register_Ns3YansWifiPhy_methods(root_module, cls):
'double',
[],
is_const=True)
- ## yans-wifi-phy.h: uint16_t ns3::YansWifiPhy::GetChannelNumber() const [member function]
- cls.add_method('GetChannelNumber',
- 'uint16_t',
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::StartReceivePacket(ns3::Ptr packet, double rxPowerDbm, ns3::WifiMode mode, ns3::WifiPreamble preamble) [member function]
+ cls.add_method('StartReceivePacket',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet >', 'packet'), param('double', 'rxPowerDbm'), param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetRxNoiseFigure(double noiseFigureDb) [member function]
+ cls.add_method('SetRxNoiseFigure',
+ 'void',
+ [param('double', 'noiseFigureDb')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxPowerStart(double start) [member function]
+ cls.add_method('SetTxPowerStart',
+ 'void',
+ [param('double', 'start')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxPowerEnd(double end) [member function]
+ cls.add_method('SetTxPowerEnd',
+ 'void',
+ [param('double', 'end')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetNTxPower(uint32_t n) [member function]
+ cls.add_method('SetNTxPower',
+ 'void',
+ [param('uint32_t', 'n')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxGain(double gain) [member function]
+ cls.add_method('SetTxGain',
+ 'void',
+ [param('double', 'gain')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetRxGain(double gain) [member function]
+ cls.add_method('SetRxGain',
+ 'void',
+ [param('double', 'gain')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetEdThreshold(double threshold) [member function]
+ cls.add_method('SetEdThreshold',
+ 'void',
+ [param('double', 'threshold')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetCcaMode1Threshold(double threshold) [member function]
+ cls.add_method('SetCcaMode1Threshold',
+ 'void',
+ [param('double', 'threshold')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetErrorRateModel(ns3::Ptr rate) [member function]
+ cls.add_method('SetErrorRateModel',
+ 'void',
+ [param('ns3::Ptr< ns3::ErrorRateModel >', 'rate')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetDevice(ns3::Ptr device) [member function]
+ cls.add_method('SetDevice',
+ 'void',
+ [param('ns3::Ptr< ns3::Object >', 'device')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetMobility(ns3::Ptr mobility) [member function]
+ cls.add_method('SetMobility',
+ 'void',
+ [param('ns3::Ptr< ns3::Object >', 'mobility')])
+ ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetRxNoiseFigure() const [member function]
+ cls.add_method('GetRxNoiseFigure',
+ 'double',
[],
- is_const=True, is_virtual=True)
- ## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetDelayUntilIdle() [member function]
- cls.add_method('GetDelayUntilIdle',
- 'ns3::Time',
+ is_const=True)
+ ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxGain() const [member function]
+ cls.add_method('GetTxGain',
+ 'double',
[],
- is_virtual=True)
- ## yans-wifi-phy.h: ns3::Ptr ns3::YansWifiPhy::GetDevice() const [member function]
- cls.add_method('GetDevice',
- 'ns3::Ptr< ns3::Object >',
+ is_const=True)
+ ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetRxGain() const [member function]
+ cls.add_method('GetRxGain',
+ 'double',
[],
is_const=True)
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetEdThreshold() const [member function]
@@ -3214,28 +3256,33 @@ def register_Ns3YansWifiPhy_methods(root_module, cls):
'double',
[],
is_const=True)
+ ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetCcaMode1Threshold() const [member function]
+ cls.add_method('GetCcaMode1Threshold',
+ 'double',
+ [],
+ is_const=True)
## yans-wifi-phy.h: ns3::Ptr ns3::YansWifiPhy::GetErrorRateModel() const [member function]
cls.add_method('GetErrorRateModel',
'ns3::Ptr< ns3::ErrorRateModel >',
[],
is_const=True)
- ## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetLastRxStartTime() const [member function]
- cls.add_method('GetLastRxStartTime',
- 'ns3::Time',
+ ## yans-wifi-phy.h: ns3::Ptr ns3::YansWifiPhy::GetDevice() const [member function]
+ cls.add_method('GetDevice',
+ 'ns3::Ptr< ns3::Object >',
[],
- is_const=True, is_virtual=True)
+ is_const=True)
## yans-wifi-phy.h: ns3::Ptr ns3::YansWifiPhy::GetMobility() [member function]
cls.add_method('GetMobility',
'ns3::Ptr< ns3::Object >',
[])
- ## yans-wifi-phy.h: ns3::WifiMode ns3::YansWifiPhy::GetMode(uint32_t mode) const [member function]
- cls.add_method('GetMode',
- 'ns3::WifiMode',
- [param('uint32_t', 'mode')],
+ ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxPowerStart() const [member function]
+ cls.add_method('GetTxPowerStart',
+ 'double',
+ [],
is_const=True, is_virtual=True)
- ## yans-wifi-phy.h: uint32_t ns3::YansWifiPhy::GetNModes() const [member function]
- cls.add_method('GetNModes',
- 'uint32_t',
+ ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxPowerEnd() const [member function]
+ cls.add_method('GetTxPowerEnd',
+ 'double',
[],
is_const=True, is_virtual=True)
## yans-wifi-phy.h: uint32_t ns3::YansWifiPhy::GetNTxPower() const [member function]
@@ -3243,45 +3290,25 @@ def register_Ns3YansWifiPhy_methods(root_module, cls):
'uint32_t',
[],
is_const=True, is_virtual=True)
- ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetRxGain() const [member function]
- cls.add_method('GetRxGain',
- 'double',
- [],
- is_const=True)
- ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetRxNoiseFigure() const [member function]
- cls.add_method('GetRxNoiseFigure',
- 'double',
- [],
- is_const=True)
- ## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetStateDuration() [member function]
- cls.add_method('GetStateDuration',
- 'ns3::Time',
- [],
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetReceiveOkCallback(ns3::Callback,double,ns3::WifiMode,ns3::WifiPreamble,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
+ cls.add_method('SetReceiveOkCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, double, ns3::WifiMode, ns3::WifiPreamble, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
is_virtual=True)
- ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxGain() const [member function]
- cls.add_method('GetTxGain',
- 'double',
- [],
- is_const=True)
- ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxPowerEnd() const [member function]
- cls.add_method('GetTxPowerEnd',
- 'double',
- [],
- is_const=True, is_virtual=True)
- ## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxPowerStart() const [member function]
- cls.add_method('GetTxPowerStart',
- 'double',
- [],
- is_const=True, is_virtual=True)
- ## yans-wifi-phy.h: static ns3::TypeId ns3::YansWifiPhy::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## yans-wifi-phy.h: bool ns3::YansWifiPhy::IsStateBusy() [member function]
- cls.add_method('IsStateBusy',
- 'bool',
- [],
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetReceiveErrorCallback(ns3::Callback,double,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
+ cls.add_method('SetReceiveErrorCallback',
+ 'void',
+ [param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, double, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
+ is_virtual=True)
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SendPacket(ns3::Ptr packet, ns3::WifiMode mode, ns3::WifiPreamble preamble, uint8_t txPowerLevel) [member function]
+ cls.add_method('SendPacket',
+ 'void',
+ [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble'), param('uint8_t', 'txPowerLevel')],
+ is_virtual=True)
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::RegisterListener(ns3::WifiPhyListener * listener) [member function]
+ cls.add_method('RegisterListener',
+ 'void',
+ [param('ns3::WifiPhyListener *', 'listener')],
is_virtual=True)
## yans-wifi-phy.h: bool ns3::YansWifiPhy::IsStateCcaBusy() [member function]
cls.add_method('IsStateCcaBusy',
@@ -3293,6 +3320,11 @@ def register_Ns3YansWifiPhy_methods(root_module, cls):
'bool',
[],
is_virtual=True)
+ ## yans-wifi-phy.h: bool ns3::YansWifiPhy::IsStateBusy() [member function]
+ cls.add_method('IsStateBusy',
+ 'bool',
+ [],
+ is_virtual=True)
## yans-wifi-phy.h: bool ns3::YansWifiPhy::IsStateSync() [member function]
cls.add_method('IsStateSync',
'bool',
@@ -3303,83 +3335,51 @@ def register_Ns3YansWifiPhy_methods(root_module, cls):
'bool',
[],
is_virtual=True)
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::RegisterListener(ns3::WifiPhyListener * listener) [member function]
- cls.add_method('RegisterListener',
- 'void',
- [param('ns3::WifiPhyListener *', 'listener')],
+ ## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetStateDuration() [member function]
+ cls.add_method('GetStateDuration',
+ 'ns3::Time',
+ [],
is_virtual=True)
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SendPacket(ns3::Ptr packet, ns3::WifiMode mode, ns3::WifiPreamble preamble, uint8_t txPowerLevel) [member function]
- cls.add_method('SendPacket',
- 'void',
- [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble'), param('uint8_t', 'txPowerLevel')],
+ ## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetDelayUntilIdle() [member function]
+ cls.add_method('GetDelayUntilIdle',
+ 'ns3::Time',
+ [],
is_virtual=True)
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetCcaMode1Threshold(double threshold) [member function]
- cls.add_method('SetCcaMode1Threshold',
+ ## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::GetLastRxStartTime() const [member function]
+ cls.add_method('GetLastRxStartTime',
+ 'ns3::Time',
+ [],
+ is_const=True, is_virtual=True)
+ ## yans-wifi-phy.h: ns3::Time ns3::YansWifiPhy::CalculateTxDuration(uint32_t size, ns3::WifiMode payloadMode, ns3::WifiPreamble preamble) const [member function]
+ cls.add_method('CalculateTxDuration',
+ 'ns3::Time',
+ [param('uint32_t', 'size'), param('ns3::WifiMode', 'payloadMode'), param('ns3::WifiPreamble', 'preamble')],
+ is_const=True, is_virtual=True)
+ ## yans-wifi-phy.h: uint32_t ns3::YansWifiPhy::GetNModes() const [member function]
+ cls.add_method('GetNModes',
+ 'uint32_t',
+ [],
+ is_const=True, is_virtual=True)
+ ## yans-wifi-phy.h: ns3::WifiMode ns3::YansWifiPhy::GetMode(uint32_t mode) const [member function]
+ cls.add_method('GetMode',
+ 'ns3::WifiMode',
+ [param('uint32_t', 'mode')],
+ is_const=True, is_virtual=True)
+ ## yans-wifi-phy.h: double ns3::YansWifiPhy::CalculateSnr(ns3::WifiMode txMode, double ber) const [member function]
+ cls.add_method('CalculateSnr',
+ 'double',
+ [param('ns3::WifiMode', 'txMode'), param('double', 'ber')],
+ is_const=True, is_virtual=True)
+ ## yans-wifi-phy.h: ns3::Ptr ns3::YansWifiPhy::GetChannel() const [member function]
+ cls.add_method('GetChannel',
+ 'ns3::Ptr< ns3::WifiChannel >',
+ [],
+ is_const=True, is_virtual=True)
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::ConfigureStandard(ns3::WifiPhyStandard standard) [member function]
+ cls.add_method('ConfigureStandard',
'void',
- [param('double', 'threshold')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetChannel(ns3::Ptr channel) [member function]
- cls.add_method('SetChannel',
- 'void',
- [param('ns3::Ptr< ns3::YansWifiChannel >', 'channel')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetChannelNumber(uint16_t id) [member function]
- cls.add_method('SetChannelNumber',
- 'void',
- [param('uint16_t', 'id')],
+ [param('ns3::WifiPhyStandard', 'standard')],
is_virtual=True)
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetDevice(ns3::Ptr device) [member function]
- cls.add_method('SetDevice',
- 'void',
- [param('ns3::Ptr< ns3::Object >', 'device')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetEdThreshold(double threshold) [member function]
- cls.add_method('SetEdThreshold',
- 'void',
- [param('double', 'threshold')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetErrorRateModel(ns3::Ptr rate) [member function]
- cls.add_method('SetErrorRateModel',
- 'void',
- [param('ns3::Ptr< ns3::ErrorRateModel >', 'rate')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetMobility(ns3::Ptr mobility) [member function]
- cls.add_method('SetMobility',
- 'void',
- [param('ns3::Ptr< ns3::Object >', 'mobility')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetNTxPower(uint32_t n) [member function]
- cls.add_method('SetNTxPower',
- 'void',
- [param('uint32_t', 'n')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetReceiveErrorCallback(ns3::Callback,double,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
- cls.add_method('SetReceiveErrorCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, double, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
- is_virtual=True)
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetReceiveOkCallback(ns3::Callback,double,ns3::WifiMode,ns3::WifiPreamble,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
- cls.add_method('SetReceiveOkCallback',
- 'void',
- [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, double, ns3::WifiMode, ns3::WifiPreamble, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
- is_virtual=True)
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetRxGain(double gain) [member function]
- cls.add_method('SetRxGain',
- 'void',
- [param('double', 'gain')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetRxNoiseFigure(double noiseFigureDb) [member function]
- cls.add_method('SetRxNoiseFigure',
- 'void',
- [param('double', 'noiseFigureDb')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxGain(double gain) [member function]
- cls.add_method('SetTxGain',
- 'void',
- [param('double', 'gain')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxPowerEnd(double end) [member function]
- cls.add_method('SetTxPowerEnd',
- 'void',
- [param('double', 'end')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetTxPowerStart(double start) [member function]
- cls.add_method('SetTxPowerStart',
- 'void',
- [param('double', 'start')])
- ## yans-wifi-phy.h: void ns3::YansWifiPhy::StartReceivePacket(ns3::Ptr packet, double rxPowerDbm, ns3::WifiMode mode, ns3::WifiPreamble preamble) [member function]
- cls.add_method('StartReceivePacket',
- 'void',
- [param('ns3::Ptr< ns3::Packet >', 'packet'), param('double', 'rxPowerDbm'), param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble')])
## yans-wifi-phy.h: void ns3::YansWifiPhy::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
From 345a0d99e24bc3ef6d05822194bf5a0085130b54 Mon Sep 17 00:00:00 2001
From: Sebastien Vincent
Date: Mon, 7 Sep 2009 18:27:40 +0200
Subject: [PATCH 19/22] Doxygen.
---
src/applications/ping6/ping6.h | 6 ++++++
src/applications/radvd/radvd-interface.h | 1 +
src/applications/radvd/radvd-prefix.h | 1 +
src/applications/radvd/radvd.h | 6 ++++++
4 files changed, 14 insertions(+)
diff --git a/src/applications/ping6/ping6.h b/src/applications/ping6/ping6.h
index bbf105c4c..f09c29922 100644
--- a/src/applications/ping6/ping6.h
+++ b/src/applications/ping6/ping6.h
@@ -33,6 +33,12 @@ class Packet;
class Socket;
/**
+ * \ingroup applications
+ * \defgroup ping6 Ping6
+ */
+
+/**
+ * \ingroup ping6
* \class Ping6
* \brief A ping6 application.
*/
diff --git a/src/applications/radvd/radvd-interface.h b/src/applications/radvd/radvd-interface.h
index 8713731ce..fe1d275aa 100644
--- a/src/applications/radvd/radvd-interface.h
+++ b/src/applications/radvd/radvd-interface.h
@@ -29,6 +29,7 @@ namespace ns3
{
/**
+ * \ingroup radvd
* \class RadvdInterface
* \brief Radvd interface configuration.
*/
diff --git a/src/applications/radvd/radvd-prefix.h b/src/applications/radvd/radvd-prefix.h
index 168648bd1..2c1433e84 100644
--- a/src/applications/radvd/radvd-prefix.h
+++ b/src/applications/radvd/radvd-prefix.h
@@ -29,6 +29,7 @@ namespace ns3
{
/**
+ * \ingroup radvd
* \class RadvdPrefix
* \brief Router prefix for radvd application.
*/
diff --git a/src/applications/radvd/radvd.h b/src/applications/radvd/radvd.h
index b8d5852e8..e3e40dc8f 100644
--- a/src/applications/radvd/radvd.h
+++ b/src/applications/radvd/radvd.h
@@ -34,6 +34,12 @@ namespace ns3
{
/**
+ * \ingroup applications
+ * \defgroup radvd Radvd
+ */
+
+/**
+ * \ingroup radvd
* \class Radvd
* \brief Router advertisement daemon.
*/
From 8cbdcd69c11a7bb83082ceff921abbc38c1c976c Mon Sep 17 00:00:00 2001
From: Sebastien Vincent
Date: Tue, 8 Sep 2009 06:29:26 +0200
Subject: [PATCH 20/22] [Bug 653] NetDevice link change callback
(SetLinkChangeCallback -> AddLinkChangeCallback).
---
CHANGES.html | 7 +++++++
src/devices/bridge/bridge-net-device.cc | 2 +-
src/devices/bridge/bridge-net-device.h | 2 +-
src/devices/csma/csma-net-device.cc | 10 +++-------
src/devices/csma/csma-net-device.h | 6 +++---
src/devices/emu/emu-net-device.cc | 9 +++------
src/devices/emu/emu-net-device.h | 6 +++---
.../point-to-point/point-to-point-net-device.cc | 9 +++------
.../point-to-point/point-to-point-net-device.h | 4 ++--
src/devices/tap-bridge/tap-bridge.cc | 2 +-
src/devices/tap-bridge/tap-bridge.h | 2 +-
.../virtual-net-device/virtual-net-device.cc | 2 +-
.../virtual-net-device/virtual-net-device.h | 2 +-
src/devices/wifi/wifi-net-device.cc | 14 ++++----------
src/devices/wifi/wifi-net-device.h | 4 ++--
src/internet-stack/arp-l3-protocol.cc | 2 +-
src/internet-stack/icmpv6-l4-protocol.cc | 7 ++-----
src/internet-stack/loopback-net-device.cc | 2 +-
src/internet-stack/loopback-net-device.h | 2 +-
src/node/net-device.h | 8 ++++----
src/node/simple-net-device.cc | 2 +-
src/node/simple-net-device.h | 2 +-
22 files changed, 47 insertions(+), 59 deletions(-)
diff --git a/CHANGES.html b/CHANGES.html
index 15654cb01..d2269f231 100644
--- a/CHANGES.html
+++ b/CHANGES.html
@@ -109,6 +109,13 @@ router solicitation, DAD
WifiMode
WifiMode now has a WifiPhyStandard attribute which identifies the standard the WifiMode belongs to. To properly set this attribute when creating a new WifiMode, it is now required to explicitly pass a WifiPhyStandard parameter to all WifiModeFactory::CreateXXXX() methods. The WifiPhyStandard value of an existing WifiMode can be retrieved using the new method WifiMode::GetStandard().
+NetDevice
+In order to have multiple link change callback in NetDevice (i.e. to flush ARP and IPv6 neighbor discovery caches), the following member method has been renamed:
+
+- virtual void SetLinkChangeCallback (Callback<void> callback);
++ virtual void AddLinkChangeCallback (Callback<void> callback);
+Now each NetDevice subclasses have a TracedCallback<> object (list of callbacks) instead of Callback<void> ones.
+