diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 725e29484..73fa34445 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -21,12 +21,14 @@ Supported platforms New user-visible features ------------------------- +- (network) SimpleChannel allows per-NetDevice blacklists, in order to do hidden terminal testcases. Bugs fixed ---------- - Bug 1736 - default dot11EDCATableMSDULifetime - Bug 1929 - TcpL4Protocol::Send must indicate the source address to routing (if known) - Bug 2126 - LrWpanNetDevice silently accepts no mobility on the node +- Bug 2130 - Allow SimpleChannel to simulate hidden terminals. - Bug 2135 - TCP doesn't honor the socket's output interface - Bug 2136 - The usage of tid in wifi and wave module shall be "if (tid > 7)" rather than "if (tid >= 7)" - Bug 2138 - SimpleNetDevice could send overlapped packets. diff --git a/src/network/bindings/modulegen__gcc_ILP32.py b/src/network/bindings/modulegen__gcc_ILP32.py index 0c6c5d9ff..7df963f93 100644 --- a/src/network/bindings/modulegen__gcc_ILP32.py +++ b/src/network/bindings/modulegen__gcc_ILP32.py @@ -3055,10 +3055,10 @@ def register_Ns3PcapFile_methods(root_module, cls): cls.add_method('Close', 'void', []) - ## pcap-file.h (module 'network'): static bool ns3::PcapFile::Diff(std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT) [member function] + ## pcap-file.h (module 'network'): static bool ns3::PcapFile::Diff(std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t & packets, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT) [member function] cls.add_method('Diff', 'bool', - [param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint32_t &', 'sec'), param('uint32_t &', 'usec'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT')], + [param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint32_t &', 'sec'), param('uint32_t &', 'usec'), param('uint32_t &', 'packets'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT')], is_static=True) ## pcap-file.h (module 'network'): bool ns3::PcapFile::Eof() const [member function] cls.add_method('Eof', @@ -3715,6 +3715,11 @@ def register_Ns3TypeId_methods(root_module, cls): cls.add_method('SetParent', 'ns3::TypeId', [param('ns3::TypeId', 'tid')]) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent() [member function] + cls.add_method('SetParent', + 'ns3::TypeId', + [], + template_parameters=['ns3::Object']) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetSize(std::size_t size) [member function] cls.add_method('SetSize', 'ns3::TypeId', @@ -6182,6 +6187,11 @@ def register_Ns3DataCalculator_methods(root_module, cls): 'std::string', [], is_const=True) + ## data-calculator.h (module 'stats'): static ns3::TypeId ns3::DataCalculator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## data-calculator.h (module 'stats'): void ns3::DataCalculator::Output(ns3::DataOutputCallback & callback) const [member function] cls.add_method('Output', 'void', @@ -6256,6 +6266,11 @@ def register_Ns3DataOutputInterface_methods(root_module, cls): 'std::string', [], is_const=True) + ## data-output-interface.h (module 'stats'): static ns3::TypeId ns3::DataOutputInterface::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::Output(ns3::DataCollector & dc) [member function] cls.add_method('Output', 'void', @@ -6374,10 +6389,11 @@ def register_Ns3DropTailQueue_methods(root_module, cls): cls.add_constructor([param('ns3::DropTailQueue const &', 'arg0')]) ## drop-tail-queue.h (module 'network'): ns3::DropTailQueue::DropTailQueue() [constructor] cls.add_constructor([]) - ## drop-tail-queue.h (module 'network'): ns3::Queue::QueueMode ns3::DropTailQueue::GetMode() [member function] + ## drop-tail-queue.h (module 'network'): ns3::Queue::QueueMode ns3::DropTailQueue::GetMode() const [member function] cls.add_method('GetMode', 'ns3::Queue::QueueMode', - []) + [], + is_const=True) ## drop-tail-queue.h (module 'network'): static ns3::TypeId ns3::DropTailQueue::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', @@ -7254,6 +7270,11 @@ def register_Ns3MinMaxAvgTotalCalculator__Unsigned_int_methods(root_module, cls) cls.add_constructor([param('ns3::MinMaxAvgTotalCalculator< unsigned int > const &', 'arg0')]) ## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator::MinMaxAvgTotalCalculator() [constructor] cls.add_constructor([]) + ## basic-data-calculators.h (module 'stats'): static ns3::TypeId ns3::MinMaxAvgTotalCalculator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator::Output(ns3::DataOutputCallback & callback) const [member function] cls.add_method('Output', 'void', @@ -7865,6 +7886,11 @@ def register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, cls): cls.add_method('FrameUpdate', 'void', [param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')]) + ## packet-data-calculators.h (module 'network'): static ns3::TypeId ns3::PacketSizeMinMaxAvgTotalCalculator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## packet-data-calculators.h (module 'network'): void ns3::PacketSizeMinMaxAvgTotalCalculator::PacketUpdate(std::string path, ns3::Ptr packet) [member function] cls.add_method('PacketUpdate', 'void', @@ -9235,6 +9261,11 @@ def register_Ns3SimpleChannel_methods(root_module, cls): 'void', [param('ns3::Ptr< ns3::SimpleNetDevice >', 'device')], is_virtual=True) + ## simple-channel.h (module 'network'): void ns3::SimpleChannel::BlackList(ns3::Ptr from, ns3::Ptr to) [member function] + cls.add_method('BlackList', + 'void', + [param('ns3::Ptr< ns3::SimpleNetDevice >', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'to')], + is_virtual=True) ## simple-channel.h (module 'network'): ns3::Ptr ns3::SimpleChannel::GetDevice(uint32_t i) const [member function] cls.add_method('GetDevice', 'ns3::Ptr< ns3::NetDevice >', @@ -9255,6 +9286,11 @@ def register_Ns3SimpleChannel_methods(root_module, cls): 'void', [param('ns3::Ptr< ns3::Packet >', 'p'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'sender')], is_virtual=True) + ## simple-channel.h (module 'network'): void ns3::SimpleChannel::UnBlackList(ns3::Ptr from, ns3::Ptr to) [member function] + cls.add_method('UnBlackList', + 'void', + [param('ns3::Ptr< ns3::SimpleNetDevice >', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'to')], + is_virtual=True) return def register_Ns3SimpleNetDevice_methods(root_module, cls): @@ -9614,6 +9650,11 @@ def register_Ns3CounterCalculator__Unsigned_int_methods(root_module, cls): 'unsigned int', [], is_const=True) + ## basic-data-calculators.h (module 'stats'): static ns3::TypeId ns3::CounterCalculator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## basic-data-calculators.h (module 'stats'): void ns3::CounterCalculator::Output(ns3::DataOutputCallback & callback) const [member function] cls.add_method('Output', 'void', @@ -9643,6 +9684,11 @@ def register_Ns3PacketCounterCalculator_methods(root_module, cls): cls.add_method('FrameUpdate', 'void', [param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')]) + ## packet-data-calculators.h (module 'network'): static ns3::TypeId ns3::PacketCounterCalculator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## packet-data-calculators.h (module 'network'): void ns3::PacketCounterCalculator::PacketUpdate(std::string path, ns3::Ptr packet) [member function] cls.add_method('PacketUpdate', 'void', diff --git a/src/network/bindings/modulegen__gcc_LP64.py b/src/network/bindings/modulegen__gcc_LP64.py index 0c6c5d9ff..7df963f93 100644 --- a/src/network/bindings/modulegen__gcc_LP64.py +++ b/src/network/bindings/modulegen__gcc_LP64.py @@ -3055,10 +3055,10 @@ def register_Ns3PcapFile_methods(root_module, cls): cls.add_method('Close', 'void', []) - ## pcap-file.h (module 'network'): static bool ns3::PcapFile::Diff(std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT) [member function] + ## pcap-file.h (module 'network'): static bool ns3::PcapFile::Diff(std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t & packets, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT) [member function] cls.add_method('Diff', 'bool', - [param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint32_t &', 'sec'), param('uint32_t &', 'usec'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT')], + [param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint32_t &', 'sec'), param('uint32_t &', 'usec'), param('uint32_t &', 'packets'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT')], is_static=True) ## pcap-file.h (module 'network'): bool ns3::PcapFile::Eof() const [member function] cls.add_method('Eof', @@ -3715,6 +3715,11 @@ def register_Ns3TypeId_methods(root_module, cls): cls.add_method('SetParent', 'ns3::TypeId', [param('ns3::TypeId', 'tid')]) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent() [member function] + cls.add_method('SetParent', + 'ns3::TypeId', + [], + template_parameters=['ns3::Object']) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetSize(std::size_t size) [member function] cls.add_method('SetSize', 'ns3::TypeId', @@ -6182,6 +6187,11 @@ def register_Ns3DataCalculator_methods(root_module, cls): 'std::string', [], is_const=True) + ## data-calculator.h (module 'stats'): static ns3::TypeId ns3::DataCalculator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## data-calculator.h (module 'stats'): void ns3::DataCalculator::Output(ns3::DataOutputCallback & callback) const [member function] cls.add_method('Output', 'void', @@ -6256,6 +6266,11 @@ def register_Ns3DataOutputInterface_methods(root_module, cls): 'std::string', [], is_const=True) + ## data-output-interface.h (module 'stats'): static ns3::TypeId ns3::DataOutputInterface::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::Output(ns3::DataCollector & dc) [member function] cls.add_method('Output', 'void', @@ -6374,10 +6389,11 @@ def register_Ns3DropTailQueue_methods(root_module, cls): cls.add_constructor([param('ns3::DropTailQueue const &', 'arg0')]) ## drop-tail-queue.h (module 'network'): ns3::DropTailQueue::DropTailQueue() [constructor] cls.add_constructor([]) - ## drop-tail-queue.h (module 'network'): ns3::Queue::QueueMode ns3::DropTailQueue::GetMode() [member function] + ## drop-tail-queue.h (module 'network'): ns3::Queue::QueueMode ns3::DropTailQueue::GetMode() const [member function] cls.add_method('GetMode', 'ns3::Queue::QueueMode', - []) + [], + is_const=True) ## drop-tail-queue.h (module 'network'): static ns3::TypeId ns3::DropTailQueue::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', @@ -7254,6 +7270,11 @@ def register_Ns3MinMaxAvgTotalCalculator__Unsigned_int_methods(root_module, cls) cls.add_constructor([param('ns3::MinMaxAvgTotalCalculator< unsigned int > const &', 'arg0')]) ## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator::MinMaxAvgTotalCalculator() [constructor] cls.add_constructor([]) + ## basic-data-calculators.h (module 'stats'): static ns3::TypeId ns3::MinMaxAvgTotalCalculator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator::Output(ns3::DataOutputCallback & callback) const [member function] cls.add_method('Output', 'void', @@ -7865,6 +7886,11 @@ def register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, cls): cls.add_method('FrameUpdate', 'void', [param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')]) + ## packet-data-calculators.h (module 'network'): static ns3::TypeId ns3::PacketSizeMinMaxAvgTotalCalculator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## packet-data-calculators.h (module 'network'): void ns3::PacketSizeMinMaxAvgTotalCalculator::PacketUpdate(std::string path, ns3::Ptr packet) [member function] cls.add_method('PacketUpdate', 'void', @@ -9235,6 +9261,11 @@ def register_Ns3SimpleChannel_methods(root_module, cls): 'void', [param('ns3::Ptr< ns3::SimpleNetDevice >', 'device')], is_virtual=True) + ## simple-channel.h (module 'network'): void ns3::SimpleChannel::BlackList(ns3::Ptr from, ns3::Ptr to) [member function] + cls.add_method('BlackList', + 'void', + [param('ns3::Ptr< ns3::SimpleNetDevice >', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'to')], + is_virtual=True) ## simple-channel.h (module 'network'): ns3::Ptr ns3::SimpleChannel::GetDevice(uint32_t i) const [member function] cls.add_method('GetDevice', 'ns3::Ptr< ns3::NetDevice >', @@ -9255,6 +9286,11 @@ def register_Ns3SimpleChannel_methods(root_module, cls): 'void', [param('ns3::Ptr< ns3::Packet >', 'p'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'sender')], is_virtual=True) + ## simple-channel.h (module 'network'): void ns3::SimpleChannel::UnBlackList(ns3::Ptr from, ns3::Ptr to) [member function] + cls.add_method('UnBlackList', + 'void', + [param('ns3::Ptr< ns3::SimpleNetDevice >', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'to')], + is_virtual=True) return def register_Ns3SimpleNetDevice_methods(root_module, cls): @@ -9614,6 +9650,11 @@ def register_Ns3CounterCalculator__Unsigned_int_methods(root_module, cls): 'unsigned int', [], is_const=True) + ## basic-data-calculators.h (module 'stats'): static ns3::TypeId ns3::CounterCalculator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## basic-data-calculators.h (module 'stats'): void ns3::CounterCalculator::Output(ns3::DataOutputCallback & callback) const [member function] cls.add_method('Output', 'void', @@ -9643,6 +9684,11 @@ def register_Ns3PacketCounterCalculator_methods(root_module, cls): cls.add_method('FrameUpdate', 'void', [param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')]) + ## packet-data-calculators.h (module 'network'): static ns3::TypeId ns3::PacketCounterCalculator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) ## packet-data-calculators.h (module 'network'): void ns3::PacketCounterCalculator::PacketUpdate(std::string path, ns3::Ptr packet) [member function] cls.add_method('PacketUpdate', 'void', diff --git a/src/network/utils/simple-channel.cc b/src/network/utils/simple-channel.cc index e0e8ecba3..dfee32307 100644 --- a/src/network/utils/simple-channel.cc +++ b/src/network/utils/simple-channel.cc @@ -17,6 +17,7 @@ * * Author: Mathieu Lacage */ +#include #include "simple-channel.h" #include "simple-net-device.h" #include "ns3/simulator.h" @@ -63,6 +64,14 @@ SimpleChannel::Send (Ptr p, uint16_t protocol, { continue; } + if (m_blackListedDevices.find (tmp) != m_blackListedDevices.end ()) + { + if (find (m_blackListedDevices[tmp].begin (), m_blackListedDevices[tmp].end (), sender) != + m_blackListedDevices[tmp].end () ) + { + continue; + } + } Simulator::ScheduleWithContext (tmp->GetNode ()->GetId (), m_delay, &SimpleNetDevice::Receive, tmp, p->Copy (), protocol, to, from); } @@ -81,6 +90,7 @@ SimpleChannel::GetNDevices (void) const NS_LOG_FUNCTION (this); return m_devices.size (); } + Ptr SimpleChannel::GetDevice (uint32_t i) const { @@ -88,4 +98,36 @@ SimpleChannel::GetDevice (uint32_t i) const return m_devices[i]; } +void +SimpleChannel::BlackList (Ptr from, Ptr to) +{ + if (m_blackListedDevices.find (to) != m_blackListedDevices.end ()) + { + if (find (m_blackListedDevices[to].begin (), m_blackListedDevices[to].end (), from) == + m_blackListedDevices[to].end () ) + { + m_blackListedDevices[to].push_back (from); + } + } + else + { + m_blackListedDevices[to].push_back (from); + } +} + +void +SimpleChannel::UnBlackList (Ptr from, Ptr to) +{ + if (m_blackListedDevices.find (to) != m_blackListedDevices.end ()) + { + std::vector >::iterator iter; + iter = find (m_blackListedDevices[to].begin (), m_blackListedDevices[to].end (), from); + if (iter != m_blackListedDevices[to].end () ) + { + m_blackListedDevices[to].erase (iter); + } + } +} + + } // namespace ns3 diff --git a/src/network/utils/simple-channel.h b/src/network/utils/simple-channel.h index 59f6317e4..774d81fe6 100644 --- a/src/network/utils/simple-channel.h +++ b/src/network/utils/simple-channel.h @@ -24,6 +24,7 @@ #include "ns3/nstime.h" #include "mac48-address.h" #include +#include namespace ns3 { @@ -74,6 +75,24 @@ public: */ virtual void Add (Ptr device); + /** + * Blocks the communications from a NetDevice to another NetDevice. + * The block is unidirectional + * + * \param from the device to BlackList + * \param to the device wanting to block the other one + */ + virtual void BlackList (Ptr from, Ptr to); + + /** + * Un-Blocks the communications from a NetDevice to another NetDevice. + * The block is unidirectional + * + * \param from the device to BlackList + * \param to the device wanting to block the other one + */ + virtual void UnBlackList (Ptr from, Ptr to); + // inherited from ns3::Channel virtual uint32_t GetNDevices (void) const; virtual Ptr GetDevice (uint32_t i) const; @@ -81,6 +100,7 @@ public: private: Time m_delay; //!< The assigned speed-of-light delay of the channel std::vector > m_devices; //!< devices connected by the channel + std::map, std::vector > > m_blackListedDevices; //!< devices blocked on a device }; } // namespace ns3