Make the value returned by VirtualNetDevice::IsPointToPoint configurable.
1.1 --- a/src/devices/virtual-net-device/virtual-net-device.cc Tue Jun 09 17:48:51 2009 +0100
1.2 +++ b/src/devices/virtual-net-device/virtual-net-device.cc Tue Jun 09 18:00:24 2009 +0100
1.3 @@ -54,6 +54,7 @@
1.4 m_needsArp = false;
1.5 m_supportsSendFrom = true;
1.6 m_mtu = 65535;
1.7 + m_isPointToPoint = true;
1.8 }
1.9
1.10
1.11 @@ -75,6 +76,12 @@
1.12 m_supportsSendFrom = supportsSendFrom;
1.13 }
1.14
1.15 +void
1.16 +VirtualNetDevice::SetIsPointToPoint (bool isPointToPoint)
1.17 +{
1.18 + m_isPointToPoint = isPointToPoint;
1.19 +}
1.20 +
1.21 bool
1.22 VirtualNetDevice::SetMtu (const uint16_t mtu)
1.23 {
1.24 @@ -193,7 +200,7 @@
1.25 bool
1.26 VirtualNetDevice::IsPointToPoint (void) const
1.27 {
1.28 - return true;
1.29 + return m_isPointToPoint;
1.30 }
1.31
1.32 bool
2.1 --- a/src/devices/virtual-net-device/virtual-net-device.h Tue Jun 09 17:48:51 2009 +0100
2.2 +++ b/src/devices/virtual-net-device/virtual-net-device.h Tue Jun 09 18:00:24 2009 +0100
2.3 @@ -34,7 +34,7 @@
2.4
2.5 /**
2.6 * \class VirtualNetDevice
2.7 - * \brief A virtual device, similar to Linux TAP interfaces.
2.8 + * \brief A virtual device, similar to Linux TUN/TAP interfaces.
2.9 *
2.10 * A VirtualNetDevice is a "virtual" NetDevice implementation which
2.11 * delegates to a user callback (see method SetSendFromCallback()) the
2.12 @@ -42,7 +42,7 @@
2.13 * code to inject the packet as if it had been received by the
2.14 * VirtualNetDevice. Together, these features allow one to build tunnels.
2.15 * For instance, by transmitting packets into a UDP socket we end up
2.16 - * building an IP-over-UDP-over-IP tunnel.
2.17 + * building an IP-over-UDP-over-IP tunnel, or IP-over-IP tunnels.
2.18 *
2.19 * The same thing could be accomplished by subclassing NetDevice
2.20 * directly. However, VirtualNetDevice is usually much simpler to program
2.21 @@ -78,6 +78,14 @@
2.22 void SetNeedsArp (bool needsArp);
2.23
2.24 /**
2.25 + * \brief Configure whether the virtual device is point-to-point
2.26 + *
2.27 + * \param isPointToPoint the value that should be returned by the
2.28 + * IsPointToPoint method for this instance.
2.29 + */
2.30 + void SetIsPointToPoint (bool isPointToPoint);
2.31 +
2.32 + /**
2.33 * \brief Configure whether the virtual device supports SendFrom
2.34 */
2.35 void SetSupportsSendFrom (bool supportsSendFrom);
2.36 @@ -160,6 +168,7 @@
2.37 uint16_t m_mtu;
2.38 bool m_needsArp;
2.39 bool m_supportsSendFrom;
2.40 + bool m_isPointToPoint;
2.41 };
2.42
2.43 }; // namespace ns3