untested multicast support
This commit is contained in:
1 parent
65de4fbacd
commit
a82fc38dbb
11 files changed
+709
-12
No files matched your search
+95
-1
@@ -137,7 +137,6 @@ Ipv4Route::GetInterface (void) const
|
||||
return m_interface;
|
||||
}
|
||||
|
||||
|
||||
Ipv4Route
|
||||
Ipv4Route::CreateHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
@@ -220,4 +219,99 @@ std::ostream& operator<< (std::ostream& os, Ipv4Route const& route)
|
||||
return os;
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* Ipv4MulticastRoute
|
||||
*****************************************************/
|
||||
|
||||
Ipv4MulticastRoute::Ipv4MulticastRoute ()
|
||||
{
|
||||
}
|
||||
|
||||
Ipv4MulticastRoute::Ipv4MulticastRoute (Ipv4MulticastRoute const &route)
|
||||
:
|
||||
m_origin (route.m_origin),
|
||||
m_group (route.m_group),
|
||||
m_inputInterface (route.m_inputInterface),
|
||||
m_outputInterfaces (route.m_outputInterfaces)
|
||||
{
|
||||
}
|
||||
|
||||
Ipv4MulticastRoute::Ipv4MulticastRoute (
|
||||
Ipv4Address origin,
|
||||
Ipv4Address group,
|
||||
uint32_t inputInterface,
|
||||
std::vector<uint32_t> outputInterfaces)
|
||||
{
|
||||
m_origin = origin;
|
||||
m_group = group;
|
||||
m_inputInterface = inputInterface;
|
||||
m_outputInterfaces = outputInterfaces;
|
||||
}
|
||||
|
||||
Ipv4Address
|
||||
Ipv4MulticastRoute::GetOrigin (void) const
|
||||
{
|
||||
return m_origin;
|
||||
}
|
||||
|
||||
Ipv4Address
|
||||
Ipv4MulticastRoute::GetGroup (void) const
|
||||
{
|
||||
return m_group;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4MulticastRoute::GetInputInterface (void) const
|
||||
{
|
||||
return m_inputInterface;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4MulticastRoute::GetNOutputInterfaces (void) const
|
||||
{
|
||||
return m_outputInterfaces.size ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4MulticastRoute::GetOutputInterface (uint32_t n) const
|
||||
{
|
||||
NS_ASSERT_MSG(n < m_outputInterfaces.size (),
|
||||
"Ipv4MulticastRoute::GetOutputInterface (): index out of bounds");
|
||||
|
||||
return m_outputInterfaces[n];
|
||||
}
|
||||
|
||||
std::vector<uint32_t>
|
||||
Ipv4MulticastRoute::GetOutputInterfaces (void) const
|
||||
{
|
||||
return m_outputInterfaces;
|
||||
}
|
||||
|
||||
Ipv4MulticastRoute
|
||||
Ipv4MulticastRoute::CreateMulticastRoute (
|
||||
Ipv4Address origin,
|
||||
Ipv4Address group,
|
||||
uint32_t inputInterface,
|
||||
std::vector<uint32_t> outputInterfaces)
|
||||
{
|
||||
return Ipv4MulticastRoute (origin, group, inputInterface, outputInterfaces);
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
operator<< (std::ostream& os, Ipv4MulticastRoute const& route)
|
||||
{
|
||||
os << "origin=" << route.GetOrigin () <<
|
||||
", group=" << route.GetGroup () <<
|
||||
", input interface=" << route.GetInputInterface () <<
|
||||
", output interfaces=";
|
||||
|
||||
for (uint32_t i = 0; i < route.GetNOutputInterfaces (); ++i)
|
||||
{
|
||||
os << route.GetOutputInterface (i) << " ";
|
||||
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
}//namespace ns3
|
||||
@@ -22,6 +22,7 @@
|
||||
#define IPV4_ROUTE_H
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
|
||||
#include "ipv4-address.h"
|
||||
@@ -98,6 +99,67 @@ private:
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, Ipv4Route const& route);
|
||||
|
||||
/**
|
||||
* \brief A record of an IPv4 multicast route
|
||||
*/
|
||||
class Ipv4MulticastRoute {
|
||||
public:
|
||||
/**
|
||||
* \brief This constructor does nothing
|
||||
*/
|
||||
Ipv4MulticastRoute ();
|
||||
/**
|
||||
* \brief Copy Constructor
|
||||
* \param route The route to copy
|
||||
*/
|
||||
Ipv4MulticastRoute (Ipv4MulticastRoute const &route);
|
||||
|
||||
/**
|
||||
* \return The IPv4 address of the source of this route
|
||||
*/
|
||||
Ipv4Address GetOrigin (void) const;
|
||||
|
||||
/**
|
||||
* \return The IPv4 address of the multicast group of this route
|
||||
*/
|
||||
Ipv4Address GetGroup (void) const;
|
||||
|
||||
/**
|
||||
* \return The IPv4 address of the input interface of this route
|
||||
*/
|
||||
uint32_t GetInputInterface (void) const;
|
||||
|
||||
/**
|
||||
* \return The number of output interfaces of this route
|
||||
*/
|
||||
uint32_t GetNOutputInterfaces (void) const;
|
||||
|
||||
/**
|
||||
* \return A specified output interface.
|
||||
*/
|
||||
uint32_t GetOutputInterface (uint32_t n) const;
|
||||
|
||||
/**
|
||||
* \return A vector of all of the output interfaces of this route.
|
||||
*/
|
||||
std::vector<uint32_t> GetOutputInterfaces (void) const;
|
||||
|
||||
static Ipv4MulticastRoute CreateMulticastRoute (Ipv4Address origin,
|
||||
Ipv4Address group, uint32_t inputInterface,
|
||||
std::vector<uint32_t> outputInterfaces);
|
||||
|
||||
private:
|
||||
Ipv4MulticastRoute (Ipv4Address origin, Ipv4Address group,
|
||||
uint32_t inputInterface, std::vector<uint32_t> outputInterfaces);
|
||||
|
||||
Ipv4Address m_origin;
|
||||
Ipv4Address m_group;
|
||||
uint32_t m_inputInterface;
|
||||
std::vector<uint32_t> m_outputInterfaces;
|
||||
};
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, Ipv4MulticastRoute const& route);
|
||||
|
||||
}//namespace ns3
|
||||
|
||||
#endif /* IPV4_ROUTE_H */
|
||||
@@ -202,7 +202,49 @@ public:
|
||||
* \param i index of route to remove from routing table.
|
||||
*/
|
||||
virtual void RemoveRoute (uint32_t i) = 0;
|
||||
|
||||
/**
|
||||
* \brief Add a static multicast route for a given multicast source and
|
||||
* group.
|
||||
*
|
||||
* \param origin The Ipv4 address of the multicast source.
|
||||
* \param group The multicast group address.
|
||||
* \param inputInterface The interface index over which the packet arrived.
|
||||
* \param outputInterfaces The list of output interface indices over which
|
||||
* the packet should be sent (excluding the inputInterface).
|
||||
*/
|
||||
virtual void AddMulticastRoute (Ipv4Address origin,
|
||||
Ipv4Address group,
|
||||
uint32_t inputInterface,
|
||||
std::vector<uint32_t> outputInterfaces) = 0;
|
||||
/**
|
||||
* \brief Remove a static multicast route for a given multicast source and
|
||||
* group.
|
||||
*
|
||||
* \param origin The Ipv4 address of the multicast source.
|
||||
* \param group The multicast group address.
|
||||
* \param inputInterface The interface index over which the packet arrived.
|
||||
*/
|
||||
virtual void RemoveMulticastRoute (Ipv4Address origin,
|
||||
Ipv4Address group,
|
||||
uint32_t inputInterface) = 0;
|
||||
|
||||
/**
|
||||
* \returns the number of entries in the multicast routing table.
|
||||
*/
|
||||
virtual uint32_t GetNMulticastRoutes (void) const = 0;
|
||||
|
||||
/**
|
||||
* \param i index of route to return
|
||||
* \returns the route whose index is i
|
||||
*/
|
||||
virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const = 0;
|
||||
|
||||
/**
|
||||
* \param i index of route to remove from routing table.
|
||||
*/
|
||||
virtual void RemoveMulticastRoute (uint32_t i) = 0;
|
||||
|
||||
/**
|
||||
* \param device device to add to the list of ipv4 interfaces
|
||||
* which can be used as output interfaces during packet forwarding.
|
||||
@@ -224,6 +266,24 @@ public:
|
||||
*/
|
||||
virtual Ptr<NetDevice> GetNetDevice (uint32_t i) = 0;
|
||||
|
||||
/**
|
||||
* \brief Join a multicast group for a given multicast source and
|
||||
* group.
|
||||
*
|
||||
* \param origin The Ipv4 address of the multicast source.
|
||||
* \param group The multicast group address.
|
||||
*/
|
||||
virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0;
|
||||
|
||||
/**
|
||||
* \brief Leave a multicast group for a given multicast source and
|
||||
* group.
|
||||
*
|
||||
* \param origin The Ipv4 address of the multicast source.
|
||||
* \param group The multicast group address.
|
||||
*/
|
||||
virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0;
|
||||
|
||||
/**
|
||||
* \param i index of ipv4 interface
|
||||
* \param address address to associate to the underlying ipv4 interface
|
||||
|
||||
Reference in new issue
Block a user