bug 63: allow enabling or disabling ip forwarding on a per-interface basis

This commit is contained in:
Tom Henderson
2009-06-26 10:56:51 +02:00
parent 6c41c5295b
commit c2c9ee3b2f
9 changed files with 95 additions and 8 deletions

View File

@@ -51,7 +51,7 @@ public:
typedef Callback<void, Ptr<Ipv4Route>, Ptr<const Packet>, const Ipv4Header &> UnicastForwardCallback;
typedef Callback<void, Ptr<Ipv4MulticastRoute>, Ptr<const Packet>, const Ipv4Header &> MulticastForwardCallback;
typedef Callback<void, Ptr<const Packet>, const Ipv4Header &, uint32_t > LocalDeliverCallback;
typedef Callback<void, Ptr<const Packet>, const Ipv4Header &> ErrorCallback;
typedef Callback<void, Ptr<const Packet>, const Ipv4Header &, Socket::SocketErrno > ErrorCallback;
/**
* \brief Query routing cache for an existing route, for an outbound packet

View File

@@ -32,7 +32,7 @@ Ipv4::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::Ipv4")
.SetParent<Object> ()
.AddAttribute ("IpForward", "If enabled, node can act as unicast router.",
.AddAttribute ("IpForward", "Globally enable or disable IP forwarding for all current and future Ipv4 devices.",
BooleanValue (true),
MakeBooleanAccessor (&Ipv4::SetIpForward,
&Ipv4::GetIpForward),

View File

@@ -235,6 +235,20 @@ public:
*/
virtual void SetDown (uint32_t interface) = 0;
/**
* \param interface Interface number of Ipv4 interface
* \returns true if IP forwarding enabled for input datagrams on this device
*/
virtual bool IsForwarding (uint32_t interface) const = 0;
/**
* \param interface Interface number of Ipv4 interface
* \param val Value to set the forwarding flag
*
* If set to true, IP forwarding is enabled for input datagrams on this device
*/
virtual void SetForwarding (uint32_t interface, bool val) = 0;
static const uint32_t IF_ANY = 0xffffffff;
private: