Bug 1872 and 1895 - DSR model improvements (credits also to Tomasz Seweryn <tomasz.seweryn7@gmail.com>)
This commit is contained in:
1 parent
47a4018630
commit
93fdddb7e3
14 files changed
+441
-431
No files matched your search
@@ -69,6 +69,7 @@ Bugs fixed
|
||||
- Bug 1855 - SixLowPanNetDevice is not correctly indexed
|
||||
- Bug 1862 - NS_LOG="Time=*|prefix_time" causes stack overflow
|
||||
- Bug 1870 - Remove unnecessary AsInt functions
|
||||
- Bug 1872 - Inside RREQ processing, in case of IP duplication, packet dropped instead of being forwarded
|
||||
- Bug 1873 - Energy source checked to be aggregated to the node
|
||||
- Bug 1874 - Ipv4L3Protocol::ProcessFragment: addressCombination and idProto identifiers not properly computed
|
||||
- Bug 1876 - enable OLSR HNA table access
|
||||
@@ -79,6 +80,7 @@ Bugs fixed
|
||||
- Bug 1889 - PointToPointNetDevice: In some cases MacTxDrop trace is not called
|
||||
- Bug 1890 - UdpClientTrace: MPEG frame size is squeezed into (insufficient) 16 bit integer
|
||||
- Bug 1891 - UdpSocketImpl::GetSockName doesn't return the IPv6 address
|
||||
- Bug 1895 - IP header Source Address changed while forwarding RREQ
|
||||
- Bug 1903 - Namespace usage in olsr-state.cc/h
|
||||
|
||||
Release 3.19
|
||||
|
||||
@@ -164,6 +164,8 @@ def register_types(module):
|
||||
module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
|
||||
## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
|
||||
module.add_class('TagBuffer', import_from_module='ns.network')
|
||||
## nstime.h (module 'core'): ns3::TimeWithUnit [class]
|
||||
module.add_class('TimeWithUnit', import_from_module='ns.core')
|
||||
## timer.h (module 'core'): ns3::Timer [class]
|
||||
module.add_class('Timer', import_from_module='ns.core')
|
||||
## timer.h (module 'core'): ns3::Timer::DestroyPolicy [enumeration]
|
||||
@@ -701,6 +703,7 @@ def register_methods(root_module):
|
||||
register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs'])
|
||||
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
|
||||
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
|
||||
register_Ns3TimeWithUnit_methods(root_module, root_module['ns3::TimeWithUnit'])
|
||||
register_Ns3Timer_methods(root_module, root_module['ns3::Timer'])
|
||||
register_Ns3TimerImpl_methods(root_module, root_module['ns3::TimerImpl'])
|
||||
register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId'])
|
||||
@@ -2090,6 +2093,11 @@ def register_Ns3Ipv6InterfaceAddress_methods(root_module, cls):
|
||||
'ns3::Ipv6InterfaceAddress::State_e',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv6-interface-address.h (module 'internet'): bool ns3::Ipv6InterfaceAddress::IsInSameSubnet(ns3::Ipv6Address b) const [member function]
|
||||
cls.add_method('IsInSameSubnet',
|
||||
'bool',
|
||||
[param('ns3::Ipv6Address', 'b')],
|
||||
is_const=True)
|
||||
## ipv6-interface-address.h (module 'internet'): void ns3::Ipv6InterfaceAddress::SetAddress(ns3::Ipv6Address address) [member function]
|
||||
cls.add_method('SetAddress',
|
||||
'void',
|
||||
@@ -2819,6 +2827,14 @@ def register_Ns3TagBuffer_methods(root_module, cls):
|
||||
[param('uint8_t', 'v')])
|
||||
return
|
||||
|
||||
def register_Ns3TimeWithUnit_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::TimeWithUnit const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::TimeWithUnit const &', 'arg0')])
|
||||
## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::Time const time, ns3::Time::Unit const unit) [constructor]
|
||||
cls.add_constructor([param('ns3::Time const', 'time'), param('ns3::Time::Unit const', 'unit')])
|
||||
return
|
||||
|
||||
def register_Ns3Timer_methods(root_module, cls):
|
||||
## timer.h (module 'core'): ns3::Timer::Timer(ns3::Timer const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Timer const &', 'arg0')])
|
||||
@@ -3336,7 +3352,6 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
|
||||
@@ -3350,6 +3365,7 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
cls.add_binary_comparison_operator('==')
|
||||
cls.add_binary_comparison_operator('>=')
|
||||
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
|
||||
@@ -4893,7 +4909,6 @@ def register_Ns3SocketSetDontFragmentTag_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right'))
|
||||
@@ -4904,6 +4919,7 @@ def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
cls.add_binary_comparison_operator('==')
|
||||
cls.add_binary_comparison_operator('>=')
|
||||
## nstime.h (module 'core'): ns3::Time::Time() [constructor]
|
||||
@@ -4928,6 +4944,11 @@ def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_constructor([param('std::string const &', 's')])
|
||||
## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & value) [constructor]
|
||||
cls.add_constructor([param('ns3::int64x64_t const &', 'value')])
|
||||
## nstime.h (module 'core'): ns3::TimeWithUnit ns3::Time::As(ns3::Time::Unit const unit) const [member function]
|
||||
cls.add_method('As',
|
||||
'ns3::TimeWithUnit',
|
||||
[param('ns3::Time::Unit const', 'unit')],
|
||||
is_const=True)
|
||||
## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function]
|
||||
cls.add_method('Compare',
|
||||
'int',
|
||||
@@ -8439,6 +8460,11 @@ def register_Ns3Ipv4L3Protocol_methods(root_module, cls):
|
||||
'bool',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True, is_virtual=True)
|
||||
## ipv4-l3-protocol.h (module 'internet'): bool ns3::Ipv4L3Protocol::IsUnicast(ns3::Ipv4Address ad) const [member function]
|
||||
cls.add_method('IsUnicast',
|
||||
'bool',
|
||||
[param('ns3::Ipv4Address', 'ad')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h (module 'internet'): bool ns3::Ipv4L3Protocol::IsUp(uint32_t i) const [member function]
|
||||
cls.add_method('IsUp',
|
||||
'bool',
|
||||
@@ -9571,10 +9597,10 @@ def register_Ns3Packet_methods(root_module, cls):
|
||||
'uint32_t',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
|
||||
is_const=True)
|
||||
## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> arg0) [member function]
|
||||
## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> nixVector) [member function]
|
||||
cls.add_method('SetNixVector',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NixVector >', 'arg0')])
|
||||
[param('ns3::Ptr< ns3::NixVector >', 'nixVector')])
|
||||
return
|
||||
|
||||
def register_Ns3ParetoRandomVariable_methods(root_module, cls):
|
||||
@@ -10462,6 +10488,14 @@ def register_Ns3DsrDsrNetworkQueue_methods(root_module, cls):
|
||||
cls.add_method('Enqueue',
|
||||
'bool',
|
||||
[param('ns3::dsr::DsrNetworkQueueEntry &', 'entry')])
|
||||
## dsr-network-queue.h (module 'dsr'): bool ns3::dsr::DsrNetworkQueue::Find(ns3::Ipv4Address nextHop) [member function]
|
||||
cls.add_method('Find',
|
||||
'bool',
|
||||
[param('ns3::Ipv4Address', 'nextHop')])
|
||||
## dsr-network-queue.h (module 'dsr'): bool ns3::dsr::DsrNetworkQueue::FindPacketWithNexthop(ns3::Ipv4Address nextHop, ns3::dsr::DsrNetworkQueueEntry & entry) [member function]
|
||||
cls.add_method('FindPacketWithNexthop',
|
||||
'bool',
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('ns3::dsr::DsrNetworkQueueEntry &', 'entry')])
|
||||
## dsr-network-queue.h (module 'dsr'): void ns3::dsr::DsrNetworkQueue::Flush() [member function]
|
||||
cls.add_method('Flush',
|
||||
'void',
|
||||
@@ -11350,6 +11384,10 @@ def register_Ns3DsrDsrRouting_methods(root_module, cls):
|
||||
cls.add_method('CancelNetworkPacketTimer',
|
||||
'void',
|
||||
[param('ns3::dsr::MaintainBuffEntry &', 'mb')])
|
||||
## dsr-routing.h (module 'dsr'): void ns3::dsr::DsrRouting::CancelPacketAllTimer(ns3::dsr::MaintainBuffEntry & mb) [member function]
|
||||
cls.add_method('CancelPacketAllTimer',
|
||||
'void',
|
||||
[param('ns3::dsr::MaintainBuffEntry &', 'mb')])
|
||||
## dsr-routing.h (module 'dsr'): void ns3::dsr::DsrRouting::CancelPacketTimerNextHop(ns3::Ipv4Address nextHop, uint8_t protocol) [member function]
|
||||
cls.add_method('CancelPacketTimerNextHop',
|
||||
'void',
|
||||
@@ -11608,10 +11646,10 @@ def register_Ns3DsrDsrRouting_methods(root_module, cls):
|
||||
cls.add_method('SendRequest',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Ipv4Address', 'source')])
|
||||
## dsr-routing.h (module 'dsr'): void ns3::dsr::DsrRouting::SendUnreachError(ns3::Ipv4Address errorHop, ns3::Ipv4Address destination, ns3::Ipv4Address originalDst, uint8_t salvage, uint8_t protocol) [member function]
|
||||
## dsr-routing.h (module 'dsr'): void ns3::dsr::DsrRouting::SendUnreachError(ns3::Ipv4Address unreachNode, ns3::Ipv4Address destination, ns3::Ipv4Address originalDst, uint8_t salvage, uint8_t protocol) [member function]
|
||||
cls.add_method('SendUnreachError',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'errorHop'), param('ns3::Ipv4Address', 'destination'), param('ns3::Ipv4Address', 'originalDst'), param('uint8_t', 'salvage'), param('uint8_t', 'protocol')])
|
||||
[param('ns3::Ipv4Address', 'unreachNode'), param('ns3::Ipv4Address', 'destination'), param('ns3::Ipv4Address', 'originalDst'), param('uint8_t', 'salvage'), param('uint8_t', 'protocol')])
|
||||
## dsr-routing.h (module 'dsr'): void ns3::dsr::DsrRouting::SetDownTarget(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, ns3::Ipv4Address, unsigned char, ns3::Ptr<ns3::Ipv4Route>, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetDownTarget',
|
||||
'void',
|
||||
|
||||
@@ -164,6 +164,8 @@ def register_types(module):
|
||||
module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
|
||||
## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
|
||||
module.add_class('TagBuffer', import_from_module='ns.network')
|
||||
## nstime.h (module 'core'): ns3::TimeWithUnit [class]
|
||||
module.add_class('TimeWithUnit', import_from_module='ns.core')
|
||||
## timer.h (module 'core'): ns3::Timer [class]
|
||||
module.add_class('Timer', import_from_module='ns.core')
|
||||
## timer.h (module 'core'): ns3::Timer::DestroyPolicy [enumeration]
|
||||
@@ -701,6 +703,7 @@ def register_methods(root_module):
|
||||
register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs'])
|
||||
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
|
||||
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
|
||||
register_Ns3TimeWithUnit_methods(root_module, root_module['ns3::TimeWithUnit'])
|
||||
register_Ns3Timer_methods(root_module, root_module['ns3::Timer'])
|
||||
register_Ns3TimerImpl_methods(root_module, root_module['ns3::TimerImpl'])
|
||||
register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId'])
|
||||
@@ -2090,6 +2093,11 @@ def register_Ns3Ipv6InterfaceAddress_methods(root_module, cls):
|
||||
'ns3::Ipv6InterfaceAddress::State_e',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv6-interface-address.h (module 'internet'): bool ns3::Ipv6InterfaceAddress::IsInSameSubnet(ns3::Ipv6Address b) const [member function]
|
||||
cls.add_method('IsInSameSubnet',
|
||||
'bool',
|
||||
[param('ns3::Ipv6Address', 'b')],
|
||||
is_const=True)
|
||||
## ipv6-interface-address.h (module 'internet'): void ns3::Ipv6InterfaceAddress::SetAddress(ns3::Ipv6Address address) [member function]
|
||||
cls.add_method('SetAddress',
|
||||
'void',
|
||||
@@ -2819,6 +2827,14 @@ def register_Ns3TagBuffer_methods(root_module, cls):
|
||||
[param('uint8_t', 'v')])
|
||||
return
|
||||
|
||||
def register_Ns3TimeWithUnit_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::TimeWithUnit const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::TimeWithUnit const &', 'arg0')])
|
||||
## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::Time const time, ns3::Time::Unit const unit) [constructor]
|
||||
cls.add_constructor([param('ns3::Time const', 'time'), param('ns3::Time::Unit const', 'unit')])
|
||||
return
|
||||
|
||||
def register_Ns3Timer_methods(root_module, cls):
|
||||
## timer.h (module 'core'): ns3::Timer::Timer(ns3::Timer const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Timer const &', 'arg0')])
|
||||
@@ -3336,7 +3352,6 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
|
||||
@@ -3350,6 +3365,7 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
cls.add_binary_comparison_operator('==')
|
||||
cls.add_binary_comparison_operator('>=')
|
||||
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
|
||||
@@ -4893,7 +4909,6 @@ def register_Ns3SocketSetDontFragmentTag_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right'))
|
||||
@@ -4904,6 +4919,7 @@ def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
cls.add_binary_comparison_operator('==')
|
||||
cls.add_binary_comparison_operator('>=')
|
||||
## nstime.h (module 'core'): ns3::Time::Time() [constructor]
|
||||
@@ -4928,6 +4944,11 @@ def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_constructor([param('std::string const &', 's')])
|
||||
## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & value) [constructor]
|
||||
cls.add_constructor([param('ns3::int64x64_t const &', 'value')])
|
||||
## nstime.h (module 'core'): ns3::TimeWithUnit ns3::Time::As(ns3::Time::Unit const unit) const [member function]
|
||||
cls.add_method('As',
|
||||
'ns3::TimeWithUnit',
|
||||
[param('ns3::Time::Unit const', 'unit')],
|
||||
is_const=True)
|
||||
## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function]
|
||||
cls.add_method('Compare',
|
||||
'int',
|
||||
@@ -8439,6 +8460,11 @@ def register_Ns3Ipv4L3Protocol_methods(root_module, cls):
|
||||
'bool',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True, is_virtual=True)
|
||||
## ipv4-l3-protocol.h (module 'internet'): bool ns3::Ipv4L3Protocol::IsUnicast(ns3::Ipv4Address ad) const [member function]
|
||||
cls.add_method('IsUnicast',
|
||||
'bool',
|
||||
[param('ns3::Ipv4Address', 'ad')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h (module 'internet'): bool ns3::Ipv4L3Protocol::IsUp(uint32_t i) const [member function]
|
||||
cls.add_method('IsUp',
|
||||
'bool',
|
||||
@@ -9571,10 +9597,10 @@ def register_Ns3Packet_methods(root_module, cls):
|
||||
'uint32_t',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
|
||||
is_const=True)
|
||||
## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> arg0) [member function]
|
||||
## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> nixVector) [member function]
|
||||
cls.add_method('SetNixVector',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NixVector >', 'arg0')])
|
||||
[param('ns3::Ptr< ns3::NixVector >', 'nixVector')])
|
||||
return
|
||||
|
||||
def register_Ns3ParetoRandomVariable_methods(root_module, cls):
|
||||
@@ -10462,6 +10488,14 @@ def register_Ns3DsrDsrNetworkQueue_methods(root_module, cls):
|
||||
cls.add_method('Enqueue',
|
||||
'bool',
|
||||
[param('ns3::dsr::DsrNetworkQueueEntry &', 'entry')])
|
||||
## dsr-network-queue.h (module 'dsr'): bool ns3::dsr::DsrNetworkQueue::Find(ns3::Ipv4Address nextHop) [member function]
|
||||
cls.add_method('Find',
|
||||
'bool',
|
||||
[param('ns3::Ipv4Address', 'nextHop')])
|
||||
## dsr-network-queue.h (module 'dsr'): bool ns3::dsr::DsrNetworkQueue::FindPacketWithNexthop(ns3::Ipv4Address nextHop, ns3::dsr::DsrNetworkQueueEntry & entry) [member function]
|
||||
cls.add_method('FindPacketWithNexthop',
|
||||
'bool',
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('ns3::dsr::DsrNetworkQueueEntry &', 'entry')])
|
||||
## dsr-network-queue.h (module 'dsr'): void ns3::dsr::DsrNetworkQueue::Flush() [member function]
|
||||
cls.add_method('Flush',
|
||||
'void',
|
||||
@@ -11350,6 +11384,10 @@ def register_Ns3DsrDsrRouting_methods(root_module, cls):
|
||||
cls.add_method('CancelNetworkPacketTimer',
|
||||
'void',
|
||||
[param('ns3::dsr::MaintainBuffEntry &', 'mb')])
|
||||
## dsr-routing.h (module 'dsr'): void ns3::dsr::DsrRouting::CancelPacketAllTimer(ns3::dsr::MaintainBuffEntry & mb) [member function]
|
||||
cls.add_method('CancelPacketAllTimer',
|
||||
'void',
|
||||
[param('ns3::dsr::MaintainBuffEntry &', 'mb')])
|
||||
## dsr-routing.h (module 'dsr'): void ns3::dsr::DsrRouting::CancelPacketTimerNextHop(ns3::Ipv4Address nextHop, uint8_t protocol) [member function]
|
||||
cls.add_method('CancelPacketTimerNextHop',
|
||||
'void',
|
||||
@@ -11608,10 +11646,10 @@ def register_Ns3DsrDsrRouting_methods(root_module, cls):
|
||||
cls.add_method('SendRequest',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Ipv4Address', 'source')])
|
||||
## dsr-routing.h (module 'dsr'): void ns3::dsr::DsrRouting::SendUnreachError(ns3::Ipv4Address errorHop, ns3::Ipv4Address destination, ns3::Ipv4Address originalDst, uint8_t salvage, uint8_t protocol) [member function]
|
||||
## dsr-routing.h (module 'dsr'): void ns3::dsr::DsrRouting::SendUnreachError(ns3::Ipv4Address unreachNode, ns3::Ipv4Address destination, ns3::Ipv4Address originalDst, uint8_t salvage, uint8_t protocol) [member function]
|
||||
cls.add_method('SendUnreachError',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'errorHop'), param('ns3::Ipv4Address', 'destination'), param('ns3::Ipv4Address', 'originalDst'), param('uint8_t', 'salvage'), param('uint8_t', 'protocol')])
|
||||
[param('ns3::Ipv4Address', 'unreachNode'), param('ns3::Ipv4Address', 'destination'), param('ns3::Ipv4Address', 'originalDst'), param('uint8_t', 'salvage'), param('uint8_t', 'protocol')])
|
||||
## dsr-routing.h (module 'dsr'): void ns3::dsr::DsrRouting::SetDownTarget(ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, ns3::Ipv4Address, unsigned char, ns3::Ptr<ns3::Ipv4Route>, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetDownTarget',
|
||||
'void',
|
||||
|
||||
+12
-2
@@ -14,7 +14,8 @@ DSR Routing Overview
|
||||
********************
|
||||
|
||||
This model implements the base specification of the Dynamic Source Routing
|
||||
(DSR) protocol. Implementation is based on :rfc:`4728`.
|
||||
(DSR) protocol. Implementation is based on :rfc:`4728`, with some extensions
|
||||
and modifications to the RFC specifications.
|
||||
|
||||
DSR operates on a on-demand behavior. Therefore, our DSR model buffers all
|
||||
packets while a route request packet (RREQ) is disseminated. We implement
|
||||
@@ -188,7 +189,16 @@ This model has been tested as follows:
|
||||
* manet-routing-compare.cc has been used to compare DSR with three of other routing protocols.
|
||||
|
||||
A paper was presented on these results at the Workshop on ns-3 in 2011.
|
||||
|
||||
|
||||
Limitations
|
||||
***********
|
||||
|
||||
The model is not fully compliant with :rfc:`4728`. As an example, Dsr fixed size header
|
||||
has been extended and it is four octects longer then the RFC specification.
|
||||
As a consequence, the DSR headers can not be correctly decoded by Wireshark.
|
||||
|
||||
The model full compliance with the RFC is planned for the future.
|
||||
|
||||
References
|
||||
**********
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ ErrorBuffer::Dequeue (Ipv4Address dst, ErrorBuffEntry & entry)
|
||||
if (i->GetDestination () == dst)
|
||||
{
|
||||
entry = *i;
|
||||
m_errorBuffer.erase (i);
|
||||
i = m_errorBuffer.erase (i);
|
||||
NS_LOG_DEBUG ("Packet size while dequeuing " << entry.GetPacket ()->GetSize ());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ MaintainBuffer::Dequeue (Ipv4Address nextHop, MaintainBuffEntry & entry)
|
||||
if (i->GetNextHop () == nextHop)
|
||||
{
|
||||
entry = *i;
|
||||
m_maintainBuffer.erase (i);
|
||||
i = m_maintainBuffer.erase (i);
|
||||
NS_LOG_DEBUG ("Packet size while dequeuing " << entry.GetPacket ()->GetSize ());
|
||||
return true;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ MaintainBuffer::AllEqual (MaintainBuffEntry & entry)
|
||||
&& (i->GetSrc () == entry.GetSrc ()) && (i->GetDst () == entry.GetDst ())
|
||||
&& (i->GetAckId () == entry.GetAckId ()) && (i->GetSegsLeft () == entry.GetSegsLeft ()))
|
||||
{
|
||||
m_maintainBuffer.erase (i); // Erase the same maintain buffer entry for the received packet
|
||||
i = m_maintainBuffer.erase (i); // Erase the same maintain buffer entry for the received packet
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@ MaintainBuffer::NetworkEqual (MaintainBuffEntry & entry)
|
||||
&& (i->GetSrc () == entry.GetSrc ()) && (i->GetDst () == entry.GetDst ())
|
||||
&& (i->GetAckId () == entry.GetAckId ()))
|
||||
{
|
||||
m_maintainBuffer.erase (i); // Erase the same maintain buffer entry for the received packet
|
||||
i = m_maintainBuffer.erase (i); // Erase the same maintain buffer entry for the received packet
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@ MaintainBuffer::PromiscEqual (MaintainBuffEntry & entry)
|
||||
&& (i->GetSegsLeft () == entry.GetSegsLeft ()) && (i->GetAckId () == entry.GetAckId ())
|
||||
)
|
||||
{
|
||||
m_maintainBuffer.erase (i); // Erase the same maintain buffer entry for the promisc received packet
|
||||
i = m_maintainBuffer.erase (i); // Erase the same maintain buffer entry for the promisc received packet
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ MaintainBuffer::LinkEqual (MaintainBuffEntry & entry)
|
||||
&& (i->GetNextHop () == entry.GetNextHop ())
|
||||
)
|
||||
{
|
||||
m_maintainBuffer.erase (i); // Erase the same maintain buffer entry for the promisc received packet
|
||||
i = m_maintainBuffer.erase (i); // Erase the same maintain buffer entry for the promisc received packet
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,12 +55,18 @@ struct LinkKey
|
||||
* Compare maintain Buffer entries
|
||||
* \param o
|
||||
* \return true if equal
|
||||
*/
|
||||
bool operator < (LinkKey const & o) const
|
||||
*/
|
||||
bool operator < (const LinkKey & o) const
|
||||
{
|
||||
return ((m_source < o.m_source) && (m_destination < o.m_destination)
|
||||
&& (m_ourAdd < o.m_nextHop) && (m_nextHop < o.m_nextHop)
|
||||
);
|
||||
if (m_source < o.m_source) return true;
|
||||
if (o.m_source < m_source) return false;
|
||||
if (m_destination < o.m_destination) return true;
|
||||
if (o.m_destination < m_destination) return false;
|
||||
if (m_ourAdd < o.m_ourAdd) return true;
|
||||
if (o.m_ourAdd < m_ourAdd) return false;
|
||||
if (m_nextHop < o.m_nextHop) return true;
|
||||
if (o.m_nextHop < m_nextHop) return false;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -77,11 +83,19 @@ struct NetworkKey
|
||||
* \param o
|
||||
* \return true if equal
|
||||
*/
|
||||
bool operator < (NetworkKey const & o) const
|
||||
bool operator < (const NetworkKey & o) const
|
||||
{
|
||||
return ((m_ackId < o.m_ackId) && (m_ourAdd < o.m_ourAdd) && (m_nextHop < o.m_nextHop) && (m_source < o.m_source)
|
||||
&& (m_destination < o.m_destination)
|
||||
);
|
||||
if (m_ackId < o.m_ackId) return true;
|
||||
if (o.m_ackId < m_ackId) return false;
|
||||
if (m_source < o.m_source) return true;
|
||||
if (o.m_source < m_source) return false;
|
||||
if (m_destination < o.m_destination) return true;
|
||||
if (o.m_destination < m_destination) return false;
|
||||
if (m_ourAdd < o.m_ourAdd) return true;
|
||||
if (o.m_ourAdd < m_ourAdd) return false;
|
||||
if (m_nextHop < o.m_nextHop) return true;
|
||||
if (o.m_nextHop < m_nextHop) return false;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -97,11 +111,17 @@ struct PassiveKey
|
||||
* \param o
|
||||
* \return true if equal
|
||||
*/
|
||||
bool operator < (PassiveKey const & o) const
|
||||
bool operator < (const PassiveKey & o) const
|
||||
{
|
||||
return ((m_ackId < o.m_ackId) && (m_source < o.m_source)
|
||||
&& (m_destination < o.m_destination) && (m_segsLeft < o.m_segsLeft)
|
||||
);
|
||||
if (m_ackId < o.m_ackId) return true;
|
||||
if (o.m_ackId < m_ackId) return false;
|
||||
if (m_source < o.m_source) return true;
|
||||
if (o.m_source < m_source) return false;
|
||||
if (m_destination < o.m_destination) return true;
|
||||
if (o.m_destination < m_destination) return false;
|
||||
if (m_segsLeft < o.m_segsLeft) return true;
|
||||
if (o.m_segsLeft < m_segsLeft) return false;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -98,6 +98,36 @@ DsrNetworkQueue::GetMaxNetworkDelay (void) const
|
||||
return m_maxDelay;
|
||||
}
|
||||
|
||||
bool
|
||||
DsrNetworkQueue::FindPacketWithNexthop (Ipv4Address nextHop, DsrNetworkQueueEntry & entry)
|
||||
{
|
||||
Cleanup ();
|
||||
for (std::vector<DsrNetworkQueueEntry>::iterator i = m_dsrNetworkQueue.begin (); i != m_dsrNetworkQueue.end (); ++i)
|
||||
{
|
||||
if (i->GetNextHopAddress () == nextHop)
|
||||
{
|
||||
entry = *i;
|
||||
i = m_dsrNetworkQueue.erase (i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
DsrNetworkQueue::Find (Ipv4Address nextHop)
|
||||
{
|
||||
Cleanup ();
|
||||
for (std::vector<DsrNetworkQueueEntry>::iterator i = m_dsrNetworkQueue.begin (); i != m_dsrNetworkQueue.end (); ++i)
|
||||
{
|
||||
if (i->GetNextHopAddress () == nextHop)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
DsrNetworkQueue::Enqueue (DsrNetworkQueueEntry & entry)
|
||||
{
|
||||
|
||||
@@ -151,6 +151,8 @@ public:
|
||||
DsrNetworkQueue (uint32_t maxLen, Time maxDelay);
|
||||
~DsrNetworkQueue ();
|
||||
|
||||
bool FindPacketWithNexthop (Ipv4Address nextHop, DsrNetworkQueueEntry & entry);
|
||||
bool Find (Ipv4Address nextHop);
|
||||
/**
|
||||
* Push entry in queue, if there is no entry with the same
|
||||
* packet and destination address in queue.
|
||||
|
||||
@@ -493,9 +493,9 @@ uint8_t DsrOptionRreq::Process (Ptr<Packet> packet, Ptr<Packet> dsrP, Ipv4Addres
|
||||
* \ when the ip source address is equal to the address of our own, this is request packet originated
|
||||
* \ by the node itself, discard it
|
||||
*/
|
||||
if (srcAddress == ipv4Address)
|
||||
if (source == ipv4Address)
|
||||
{
|
||||
NS_LOG_DEBUG ("Discard the packet");
|
||||
NS_LOG_DEBUG ("Discard the packet since it was originated from same source address");
|
||||
m_dropTrace (packet); // call the drop trace to show in the tracing
|
||||
return 0;
|
||||
}
|
||||
@@ -599,6 +599,14 @@ uint8_t DsrOptionRreq::Process (Ptr<Packet> packet, Ptr<Packet> dsrP, Ipv4Addres
|
||||
{
|
||||
// A node ignores all RREQs received from any node in its blacklist
|
||||
RouteCacheEntry toPrev;
|
||||
bool isRouteInCache = dsr->LookupRoute (targetAddress,
|
||||
toPrev);
|
||||
RouteCacheEntry::IP_VECTOR ip = toPrev.GetVector (); // The route from our own route cache to dst
|
||||
PrintVector (ip);
|
||||
std::vector<Ipv4Address> saveRoute (nodeList);
|
||||
PrintVector (saveRoute);
|
||||
bool areThereDuplicates = IfDuplicates (ip,
|
||||
saveRoute);
|
||||
/*
|
||||
* When the reverse route is created or updated, the following actions on the route are also carried out:
|
||||
* 3. the next hop in the routing table becomes the node from which the RREQ was received
|
||||
@@ -618,7 +626,8 @@ uint8_t DsrOptionRreq::Process (Ptr<Packet> packet, Ptr<Packet> dsrP, Ipv4Addres
|
||||
{
|
||||
NS_LOG_DEBUG ("These two nodes are neighbors");
|
||||
m_finalRoute.clear ();
|
||||
m_finalRoute.push_back (srcAddress); // push back the request originator's address
|
||||
/// TODO has changed the srcAddress to source, should not matter either way, check later
|
||||
m_finalRoute.push_back (source); // push back the request originator's address
|
||||
m_finalRoute.push_back (ipv4Address); // push back our own address
|
||||
nextHop = srcAddress;
|
||||
}
|
||||
@@ -692,10 +701,14 @@ uint8_t DsrOptionRreq::Process (Ptr<Packet> packet, Ptr<Packet> dsrP, Ipv4Addres
|
||||
DsrOptionSRHeader sourceRoute;
|
||||
NS_LOG_DEBUG ("The route length " << m_finalRoute.size ());
|
||||
sourceRoute.SetNodesAddress (m_finalRoute);
|
||||
if (dsr->IsLinkCache ())
|
||||
{
|
||||
dsr->UseExtends (m_finalRoute);
|
||||
}
|
||||
|
||||
/// TODO !!!!!!!!!!!!!!
|
||||
/// Think about this part, we just added the route,
|
||||
/// probability no need to increase stability now?????
|
||||
// if (dsr->IsLinkCache ())
|
||||
// {
|
||||
// dsr->UseExtends (m_finalRoute);
|
||||
// }
|
||||
sourceRoute.SetSegmentsLeft ((m_finalRoute.size () - 2));
|
||||
// The salvage value here is 0
|
||||
sourceRoute.SetSalvage (0);
|
||||
@@ -733,18 +746,12 @@ uint8_t DsrOptionRreq::Process (Ptr<Packet> packet, Ptr<Packet> dsrP, Ipv4Addres
|
||||
/*
|
||||
* (ii) or it has an active route to the destination, send reply based on request header and route cache,
|
||||
* need to delay based on a random value from d = H * (h - 1 + r), which can avoid possible route
|
||||
* reply storm.
|
||||
* reply storm. Also, verify if two vectors do not contain duplicates (part of the route to the
|
||||
* destination from route cache and route collected so far). If so, do not use the route found
|
||||
* and forward the route request.
|
||||
*/
|
||||
else if (dsr->LookupRoute (targetAddress, toPrev))
|
||||
else if (isRouteInCache && !areThereDuplicates)
|
||||
{
|
||||
RouteCacheEntry::IP_VECTOR ip = toPrev.GetVector (); // The route from our own route cache to dst
|
||||
PrintVector (ip);
|
||||
std::vector<Ipv4Address> saveRoute (nodeList);
|
||||
PrintVector (saveRoute);
|
||||
// Verify if the two vector contains duplicates, if so, do not use
|
||||
// the route found and forward the route request
|
||||
if (!(IfDuplicates (ip, saveRoute)))
|
||||
{
|
||||
m_finalRoute.clear (); // Clear the final route vector
|
||||
/**
|
||||
* push back the intermediate node address from the source to this node
|
||||
@@ -796,10 +803,10 @@ uint8_t DsrOptionRreq::Process (Ptr<Packet> packet, Ptr<Packet> dsrP, Ipv4Addres
|
||||
PrintVector (saveRoute);
|
||||
|
||||
sourceRoute.SetNodesAddress (saveRoute);
|
||||
if (dsr->IsLinkCache ())
|
||||
{
|
||||
dsr->UseExtends (saveRoute);
|
||||
}
|
||||
// if (dsr->IsLinkCache ())
|
||||
// {
|
||||
// dsr->UseExtends (saveRoute);
|
||||
// }
|
||||
sourceRoute.SetSegmentsLeft ((saveRoute.size () - 2));
|
||||
uint8_t salvage = 0;
|
||||
sourceRoute.SetSalvage (salvage);
|
||||
@@ -835,7 +842,6 @@ uint8_t DsrOptionRreq::Process (Ptr<Packet> packet, Ptr<Packet> dsrP, Ipv4Addres
|
||||
* Need to first pin down the next hop address before removing duplicates
|
||||
*/
|
||||
Ipv4Address nextHop = ReverseSearchNextHop (ipv4Address, m_finalRoute);
|
||||
NS_LOG_DEBUG ("The nextHop address " << nextHop);
|
||||
/*
|
||||
* First remove the duplicate ip address to automatically shorten the route, and then reversely
|
||||
* search the next hop address
|
||||
@@ -866,11 +872,6 @@ uint8_t DsrOptionRreq::Process (Ptr<Packet> packet, Ptr<Packet> dsrP, Ipv4Addres
|
||||
newPacket->AddHeader (dsrRoutingHeader);
|
||||
dsr->ScheduleCachedReply (newPacket, ipv4Address, nextHop, m_ipv4Route, hops);
|
||||
isPromisc = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_DEBUG ("There is duplicate ip addresses in the two route parts");
|
||||
}
|
||||
return rreq.GetSerializedSize ();
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -116,7 +116,7 @@ PassiveBuffer::AllEqual (PassiveBuffEntry & entry)
|
||||
&& (i->GetDestination () == entry.GetDestination ()) && (i->GetIdentification () == entry.GetIdentification ()) && (i->GetFragmentOffset () == entry.GetFragmentOffset ())
|
||||
&& (i->GetSegsLeft () == entry.GetSegsLeft () + 1))
|
||||
{
|
||||
m_passiveBuffer.erase (i); // Erase the same maintain buffer entry for the received packet
|
||||
i = m_passiveBuffer.erase (i); // Erase the same maintain buffer entry for the received packet
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ PassiveBuffer::Dequeue (Ipv4Address dst, PassiveBuffEntry & entry)
|
||||
if (i->GetDestination () == dst)
|
||||
{
|
||||
entry = *i;
|
||||
m_passiveBuffer.erase (i);
|
||||
i = m_passiveBuffer.erase (i);
|
||||
NS_LOG_DEBUG ("Packet size while dequeuing " << entry.GetPacket ()->GetSize ());
|
||||
return true;
|
||||
}
|
||||
|
||||
+229
-366
@@ -52,6 +52,7 @@
|
||||
#include "ns3/node-list.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/pointer.h"
|
||||
#include "ns3/timer.h"
|
||||
#include "ns3/object-vector.h"
|
||||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/ipv4-header.h"
|
||||
@@ -275,7 +276,7 @@ TypeId DsrRouting::GetTypeId ()
|
||||
MakeUintegerAccessor (&DsrRouting::m_numPriorityQueues),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("LinkAcknowledgment","Enable Link layer acknowledgment mechanism",
|
||||
BooleanValue (false),
|
||||
BooleanValue (true),
|
||||
MakeBooleanAccessor (&DsrRouting::m_linkAck),
|
||||
MakeBooleanChecker ())
|
||||
.AddTraceSource ("Tx", "Send DSR packet.",
|
||||
@@ -421,7 +422,8 @@ void DsrRouting::Start ()
|
||||
routeCache->SetUseExtends (m_useExtends);
|
||||
routeCache->ScheduleTimer ();
|
||||
// The call back to handle link error and send error message to appropriate nodes
|
||||
routeCache->SetCallback (MakeCallback (&DsrRouting::SendRerrWhenBreaksLinkToNextHop, this));
|
||||
/// TODO whether this SendRerrWhenBreaksLinkToNextHop is used or not
|
||||
// routeCache->SetCallback (MakeCallback (&DsrRouting::SendRerrWhenBreaksLinkToNextHop, this));
|
||||
SetRouteCache (routeCache);
|
||||
// Set the main address as the current ip address
|
||||
m_mainAddress = addr;
|
||||
@@ -477,14 +479,14 @@ void DsrRouting::NotifyDataReceipt (std::string context, Ptr<const Packet> p)
|
||||
/// \todo this is a hard-coded check, need to find a better way to work on this
|
||||
if (newP->GetSize () == 4)
|
||||
{
|
||||
NS_LOG_WARN ("WifiMacTrailer left, skip this packet");
|
||||
// NS_LOG_WARN ("WifiMacTrailer left, skip this packet");
|
||||
return;
|
||||
}
|
||||
|
||||
LlcSnapHeader llc;
|
||||
if(!newP->PeekHeader (llc))
|
||||
{
|
||||
NS_LOG_WARN ("llc snap header not present");
|
||||
// NS_LOG_WARN ("llc snap header not present");
|
||||
NS_ASSERT (newP->GetSize() < 64);
|
||||
return;
|
||||
}
|
||||
@@ -498,7 +500,7 @@ void DsrRouting::NotifyDataReceipt (std::string context, Ptr<const Packet> p)
|
||||
ArpHeader arp;
|
||||
if(newP->PeekHeader (arp))
|
||||
{
|
||||
NS_LOG_WARN ("arp header present, skip this packet");
|
||||
// NS_LOG_WARN ("arp header present, skip this packet");
|
||||
NS_ASSERT (newP->GetSize() < 64);
|
||||
return;
|
||||
}
|
||||
@@ -535,6 +537,8 @@ void DsrRouting::NotifyDataReceipt (std::string context, Ptr<const Packet> p)
|
||||
newEntry.SetNextHop (ourAddress);
|
||||
/// Get the previous node's maintenance buffer and passive ack
|
||||
Ptr<Node> node = GetNodeWithAddress (previousHop);
|
||||
NS_LOG_DEBUG ("The previous node " << previousHop);
|
||||
|
||||
Ptr<dsr::DsrRouting> dsr = node->GetObject<dsr::DsrRouting> ();
|
||||
dsr->CancelLinkPacketTimer (newEntry);
|
||||
}
|
||||
@@ -841,151 +845,6 @@ DsrRouting::GetPriority (DsrMessageType messageType)
|
||||
}
|
||||
}
|
||||
|
||||
void DsrRouting::SendRerrWhenBreaksLinkToNextHop (Ipv4Address nextHop, uint8_t protocol)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << nextHop << (uint32_t)protocol);
|
||||
MaintainBuffEntry entry;
|
||||
// Find the packet in send buffer
|
||||
if (m_maintainBuffer.Find (nextHop))
|
||||
{
|
||||
NS_LOG_DEBUG ("Trying to dequeue");
|
||||
|
||||
if (m_maintainBuffer.Dequeue (nextHop, entry))
|
||||
{
|
||||
NS_LOG_DEBUG ("creating new packet");
|
||||
/*
|
||||
* Copy the packet and save a copy to the send buffer.
|
||||
* if only queue the original packet to the buffer,
|
||||
* when dequeue the packet, it turns to be empty.
|
||||
*/
|
||||
Ptr<Packet> dequeP = ConstCast<Packet> (entry.GetPacket ());
|
||||
Ptr<Packet> newPacket = dequeP->Copy ();
|
||||
Ptr<Packet> p = dequeP->Copy ();
|
||||
|
||||
Ipv4Address source = entry.GetSrc ();
|
||||
Ipv4Address destination = entry.GetDst ();
|
||||
|
||||
DsrRoutingHeader dsrRoutingHeader;
|
||||
p->RemoveHeader (dsrRoutingHeader);
|
||||
Ptr<Packet> cleanP = p->Copy ();
|
||||
uint8_t offset = dsrRoutingHeader.GetDsrOptionsOffset ();
|
||||
newPacket->RemoveAtStart (offset);
|
||||
|
||||
// Get the number of routers' address field
|
||||
uint8_t buf[2];
|
||||
newPacket->CopyData (buf, sizeof(buf));
|
||||
uint8_t numberAddress = (buf[1] - 2) / 4;
|
||||
|
||||
DsrOptionSRHeader sourceRoute;
|
||||
sourceRoute.SetNumberAddress (numberAddress);
|
||||
newPacket->RemoveHeader (sourceRoute);
|
||||
uint8_t salvage = sourceRoute.GetSalvage ();
|
||||
|
||||
DsrOptionAckReqHeader ackReq;
|
||||
newPacket->RemoveHeader (ackReq);
|
||||
/*
|
||||
* Get the node list address
|
||||
*/
|
||||
std::vector<Ipv4Address> nodeList = sourceRoute.GetNodesAddress ();
|
||||
Ipv4Address address1 = nodeList[1];
|
||||
Ipv4Address nextHop = SearchNextHop (m_mainAddress, nodeList);
|
||||
NS_LOG_DEBUG ("The next hop address" << nextHop);
|
||||
if (nextHop == "0.0.0.0")
|
||||
{
|
||||
PacketNewRoute (cleanP, m_mainAddress, destination, protocol);
|
||||
return;
|
||||
}
|
||||
RouteCacheEntry salvageRoute;
|
||||
bool findRoute = m_routeCache->LookupRoute (destination, salvageRoute);
|
||||
// Check the salvage value in header, if salvage is needed, we should find alternative route
|
||||
if (findRoute && (salvage < m_maxSalvageCount))
|
||||
{
|
||||
// Need to salvage the packet instead of discard it
|
||||
std::vector<Ipv4Address> nodeList = salvageRoute.GetVector ();
|
||||
DsrOptionSRHeader newSR;
|
||||
newSR.SetNodesAddress (nodeList);
|
||||
newSR.SetSegmentsLeft ((nodeList.size () - 2));
|
||||
newSR.SetSalvage (salvage + 1);
|
||||
/// When found a route and use it, UseExtends to the link cache
|
||||
if (m_routeCache->IsLinkCache ())
|
||||
{
|
||||
m_routeCache->UseExtends (nodeList);
|
||||
}
|
||||
NetworkKey networkKey;
|
||||
networkKey.m_ackId = entry.GetAckId ();
|
||||
networkKey.m_ourAdd = entry.GetOurAdd ();
|
||||
networkKey.m_nextHop = entry.GetNextHop ();
|
||||
networkKey.m_source = entry.GetSrc ();
|
||||
networkKey.m_destination = entry.GetDst ();
|
||||
|
||||
PassiveKey passiveKey;
|
||||
passiveKey.m_ackId = 0;
|
||||
passiveKey.m_source = entry.GetSrc ();
|
||||
passiveKey.m_destination = entry.GetDst ();
|
||||
passiveKey.m_segsLeft = entry.GetSegsLeft ();
|
||||
|
||||
LinkKey linkKey;
|
||||
linkKey.m_source = entry.GetSrc ();
|
||||
linkKey.m_destination = entry.GetDst ();
|
||||
linkKey.m_ourAdd = entry.GetOurAdd ();
|
||||
linkKey.m_nextHop = entry.GetNextHop ();
|
||||
|
||||
m_addressForwardCnt[networkKey] = 0;
|
||||
m_passiveCnt[passiveKey] = 0;
|
||||
m_linkCnt[linkKey] = 0;
|
||||
|
||||
if (m_linkAck)
|
||||
{
|
||||
ScheduleLinkPacketRetry (entry, protocol);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("Not using link acknowledgment");
|
||||
if (nextHop != destination)
|
||||
{
|
||||
SchedulePassivePacketRetry (entry, protocol);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is the first network retry
|
||||
ScheduleNetworkPacketRetry (entry, true, protocol);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* This code block create a packet and attach a route error option to it
|
||||
*/
|
||||
m_routeCache->DeleteAllRoutesIncludeLink (source, nextHop, m_mainAddress);
|
||||
/*
|
||||
* If the salvage is not 0, use the first address in the route as the error dst in error header
|
||||
* otherwise use the source of packet as the error destination
|
||||
*/
|
||||
Ipv4Address errorDst;
|
||||
if (salvage)
|
||||
{
|
||||
errorDst = address1;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorDst = source;
|
||||
}
|
||||
SendUnreachError (nextHop, errorDst, destination, salvage, protocol);
|
||||
/*
|
||||
* here we cancel the packet retransmission time for all the packets have next hop address
|
||||
* as nextHop
|
||||
*/
|
||||
}
|
||||
if (m_maintainBuffer.GetSize () != 0 && m_maintainBuffer.Find (nextHop))
|
||||
{
|
||||
Simulator::Schedule (MilliSeconds (m_uniformRandomVariable->GetInteger (0,100)),
|
||||
&DsrRouting::SendRerrWhenBreaksLinkToNextHop,this,nextHop,protocol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DsrRouting::SendBuffTimerExpire ()
|
||||
{
|
||||
if (m_sendBuffTimer.IsRunning ())
|
||||
@@ -1092,19 +951,19 @@ void DsrRouting::CheckSendBuffer ()
|
||||
Ptr<dsr::DsrNetworkQueue> dsrNetworkQueue = i->second;
|
||||
NS_LOG_LOGIC ("Will be inserting into priority queue number: " << priority);
|
||||
|
||||
m_downTarget (newPacket, m_mainAddress, nextHop, GetProtocolNumber (), m_ipv4Route);
|
||||
//m_downTarget (newPacket, m_mainAddress, nextHop, GetProtocolNumber (), m_ipv4Route);
|
||||
|
||||
/// \todo New DsrNetworkQueueEntry
|
||||
// DsrNetworkQueueEntry newEntry (newPacket, m_mainAddress, nextHop, Simulator::Now (), m_ipv4Route);
|
||||
//
|
||||
// if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
// {
|
||||
// Scheduler (priority);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
// }
|
||||
DsrNetworkQueueEntry newEntry (newPacket, m_mainAddress, nextHop, Simulator::Now (), m_ipv4Route);
|
||||
|
||||
if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
{
|
||||
Scheduler (priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1388,9 +1247,9 @@ DsrRouting::PacketNewRoute (Ptr<Packet> packet,
|
||||
}
|
||||
|
||||
void
|
||||
DsrRouting::SendUnreachError (Ipv4Address errorHop, Ipv4Address destination, Ipv4Address originalDst, uint8_t salvage, uint8_t protocol)
|
||||
DsrRouting::SendUnreachError (Ipv4Address unreachNode, Ipv4Address destination, Ipv4Address originalDst, uint8_t salvage, uint8_t protocol)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << errorHop << destination << originalDst << (uint32_t)salvage << (uint32_t)protocol);
|
||||
NS_LOG_FUNCTION (this << unreachNode << destination << originalDst << (uint32_t)salvage << (uint32_t)protocol);
|
||||
DsrRoutingHeader dsrRoutingHeader;
|
||||
dsrRoutingHeader.SetNextHeader (protocol);
|
||||
dsrRoutingHeader.SetMessageType (1);
|
||||
@@ -1400,42 +1259,52 @@ DsrRouting::SendUnreachError (Ipv4Address errorHop, Ipv4Address destination, Ipv
|
||||
DsrOptionRerrUnreachHeader rerrUnreachHeader;
|
||||
rerrUnreachHeader.SetErrorType (1);
|
||||
rerrUnreachHeader.SetErrorSrc (m_mainAddress);
|
||||
rerrUnreachHeader.SetUnreachNode (errorHop);
|
||||
rerrUnreachHeader.SetUnreachNode (unreachNode);
|
||||
rerrUnreachHeader.SetErrorDst (destination);
|
||||
rerrUnreachHeader.SetOriginalDst (originalDst);
|
||||
rerrUnreachHeader.SetSalvage (salvage); // Set the value about whether to salvage a packet or not
|
||||
uint8_t rerrLength = rerrUnreachHeader.GetLength ();
|
||||
|
||||
|
||||
RouteCacheEntry toDst;
|
||||
bool findRoute = m_routeCache->LookupRoute (destination, toDst);
|
||||
// Queue the packet if there is no route pre-existing
|
||||
Ptr<Packet> newPacket = Create<Packet> ();
|
||||
if (!findRoute)
|
||||
{
|
||||
NS_LOG_INFO (Simulator::Now ().GetSeconds ()
|
||||
<< "s " << m_mainAddress << " there is no route for this packet, queue the packet");
|
||||
if (destination == m_mainAddress)
|
||||
{
|
||||
NS_LOG_INFO ("We are the error source, send request to original dst " << originalDst);
|
||||
// Send error request message if we are the source node
|
||||
SendErrorRequest (rerrUnreachHeader, protocol);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_INFO (Simulator::Now ().GetSeconds ()
|
||||
<< "s " << m_mainAddress << " there is no route for this packet, queue the packet");
|
||||
|
||||
dsrRoutingHeader.SetPayloadLength (rerrLength + 2);
|
||||
dsrRoutingHeader.AddDsrOption (rerrUnreachHeader);
|
||||
newPacket->AddHeader (dsrRoutingHeader);
|
||||
Ptr<Packet> p = newPacket->Copy ();
|
||||
// Save the error packet in the error buffer
|
||||
ErrorBuffEntry newEntry (p, destination, m_mainAddress, errorHop, m_sendBufferTimeout, protocol);
|
||||
bool result = m_errorBuffer.Enqueue (newEntry); // Enqueue the packet in send buffer
|
||||
if (result)
|
||||
{
|
||||
NS_LOG_INFO (Simulator::Now ().GetSeconds ()
|
||||
<< "s Add packet PID: " << p->GetUid () << " to queue. Packet: " << *p);
|
||||
NS_LOG_LOGIC ("Send RREQ to" << destination);
|
||||
if ((m_addressReqTimer.find (destination) == m_addressReqTimer.end ()) && (m_nonPropReqTimer.find (destination) == m_nonPropReqTimer.end ()))
|
||||
{
|
||||
NS_LOG_DEBUG ("When there is no existing route request for " << destination << ", initialize one");
|
||||
/*
|
||||
* Call the send request function, it will update the request table entry and ttl there
|
||||
*/
|
||||
SendInitialRequest (m_mainAddress, destination, protocol);
|
||||
}
|
||||
}
|
||||
dsrRoutingHeader.SetPayloadLength (rerrLength + 2);
|
||||
dsrRoutingHeader.AddDsrOption (rerrUnreachHeader);
|
||||
newPacket->AddHeader (dsrRoutingHeader);
|
||||
Ptr<Packet> p = newPacket->Copy ();
|
||||
// Save the error packet in the error buffer
|
||||
ErrorBuffEntry newEntry (p, destination, m_mainAddress, unreachNode, m_sendBufferTimeout, protocol);
|
||||
bool result = m_errorBuffer.Enqueue (newEntry); // Enqueue the packet in send buffer
|
||||
if (result)
|
||||
{
|
||||
NS_LOG_INFO (Simulator::Now ().GetSeconds ()
|
||||
<< "s Add packet PID: " << p->GetUid () << " to queue. Packet: " << *p);
|
||||
NS_LOG_LOGIC ("Send RREQ to" << destination);
|
||||
if ((m_addressReqTimer.find (destination) == m_addressReqTimer.end ()) && (m_nonPropReqTimer.find (destination) == m_nonPropReqTimer.end ()))
|
||||
{
|
||||
NS_LOG_DEBUG ("When there is no existing route request for " << destination << ", initialize one");
|
||||
/*
|
||||
* Call the send request function, it will update the request table entry and ttl there
|
||||
*/
|
||||
SendInitialRequest (m_mainAddress, destination, protocol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1473,19 +1342,19 @@ DsrRouting::SendUnreachError (Ipv4Address errorHop, Ipv4Address destination, Ipv
|
||||
Ptr<dsr::DsrNetworkQueue> dsrNetworkQueue = i->second;
|
||||
NS_LOG_DEBUG ("Will be inserting into priority queue " << dsrNetworkQueue << " number: " << priority);
|
||||
|
||||
m_downTarget (newPacket, m_mainAddress, nextHop, GetProtocolNumber (), m_ipv4Route);
|
||||
//m_downTarget (newPacket, m_mainAddress, nextHop, GetProtocolNumber (), m_ipv4Route);
|
||||
|
||||
/// \todo New DsrNetworkQueueEntry
|
||||
// DsrNetworkQueueEntry newEntry (newPacket, m_mainAddress, nextHop, Simulator::Now (), m_ipv4Route);
|
||||
//
|
||||
// if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
// {
|
||||
// Scheduler (priority);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
// }
|
||||
DsrNetworkQueueEntry newEntry (newPacket, m_mainAddress, nextHop, Simulator::Now (), m_ipv4Route);
|
||||
|
||||
if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
{
|
||||
Scheduler (priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1518,19 +1387,19 @@ DsrRouting::ForwardErrPacket (DsrOptionRerrUnreachHeader &rerr,
|
||||
Ptr<dsr::DsrNetworkQueue> dsrNetworkQueue = i->second;
|
||||
NS_LOG_DEBUG ("Will be inserting into priority queue " << dsrNetworkQueue << " number: " << priority);
|
||||
|
||||
m_downTarget (packet, m_mainAddress, nextHop, GetProtocolNumber (), route);
|
||||
//m_downTarget (packet, m_mainAddress, nextHop, GetProtocolNumber (), route);
|
||||
|
||||
/// \todo New DsrNetworkQueueEntry
|
||||
// DsrNetworkQueueEntry newEntry (packet, m_mainAddress, nextHop, Simulator::Now (), route);
|
||||
//
|
||||
// if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
// {
|
||||
// Scheduler (priority);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
// }
|
||||
DsrNetworkQueueEntry newEntry (packet, m_mainAddress, nextHop, Simulator::Now (), route);
|
||||
|
||||
if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
{
|
||||
Scheduler (priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1730,19 +1599,19 @@ DsrRouting::SendPacket (Ptr<Packet> packet, Ipv4Address source, Ipv4Address next
|
||||
Ptr<dsr::DsrNetworkQueue> dsrNetworkQueue = i->second;
|
||||
NS_LOG_INFO ("Will be inserting into priority queue number: " << priority);
|
||||
|
||||
m_downTarget (packet, source, nextHop, GetProtocolNumber (), m_ipv4Route);
|
||||
//m_downTarget (packet, source, nextHop, GetProtocolNumber (), m_ipv4Route);
|
||||
|
||||
/// \todo New DsrNetworkQueueEntry
|
||||
// DsrNetworkQueueEntry newEntry (packet, source, nextHop, Simulator::Now (), m_ipv4Route);
|
||||
//
|
||||
// if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
// {
|
||||
// Scheduler (priority);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
// }
|
||||
DsrNetworkQueueEntry newEntry (packet, source, nextHop, Simulator::Now (), m_ipv4Route);
|
||||
|
||||
if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
{
|
||||
Scheduler (priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1878,6 +1747,12 @@ DsrRouting::SendPacketFromBuffer (DsrOptionSRHeader const &sourceRoute, Ipv4Addr
|
||||
if (m_sendBuffer.Find (destination))
|
||||
{
|
||||
NS_LOG_DEBUG ("destination over here " << destination);
|
||||
|
||||
/// When found a route and use it, UseExtends to the link cache
|
||||
if (m_routeCache->IsLinkCache ())
|
||||
{
|
||||
m_routeCache->UseExtends (nodeList);
|
||||
}
|
||||
SendBuffEntry entry;
|
||||
if (m_sendBuffer.Dequeue (destination, entry))
|
||||
{
|
||||
@@ -2036,19 +1911,19 @@ DsrRouting::SendPacketFromBuffer (DsrOptionSRHeader const &sourceRoute, Ipv4Addr
|
||||
Ptr<dsr::DsrNetworkQueue> dsrNetworkQueue = i->second;
|
||||
NS_LOG_DEBUG ("Will be inserting into priority queue " << dsrNetworkQueue << " number: " << priority);
|
||||
|
||||
m_downTarget (newPacket, m_mainAddress, nextHop, GetProtocolNumber (), m_ipv4Route);
|
||||
//m_downTarget (newPacket, m_mainAddress, nextHop, GetProtocolNumber (), m_ipv4Route);
|
||||
|
||||
/// \todo New DsrNetworkQueueEntry
|
||||
// DsrNetworkQueueEntry newEntry (newPacket, m_mainAddress, nextHop, Simulator::Now (), m_ipv4Route);
|
||||
//
|
||||
// if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
// {
|
||||
// Scheduler (priority);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
// }
|
||||
DsrNetworkQueueEntry newEntry (newPacket, m_mainAddress, nextHop, Simulator::Now (), m_ipv4Route);
|
||||
|
||||
if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
{
|
||||
Scheduler (priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2136,6 +2011,32 @@ DsrRouting::CancelPassiveTimer (Ptr<Packet> packet, Ipv4Address source, Ipv4Addr
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
DsrRouting::CallCancelPacketTimer (uint16_t ackId, Ipv4Header const& ipv4Header, Ipv4Address realSrc, Ipv4Address realDst)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << (uint32_t)ackId << ipv4Header << realSrc << realDst);
|
||||
Ipv4Address sender = ipv4Header.GetDestination ();
|
||||
Ipv4Address receiver = ipv4Header.GetSource ();
|
||||
/*
|
||||
* Create a packet to fill maintenance buffer, not used to compare with maintainance entry
|
||||
* The reason is ack header doesn't have the original packet copy
|
||||
*/
|
||||
Ptr<Packet> mainP = Create<Packet> ();
|
||||
MaintainBuffEntry newEntry (/*Packet=*/ mainP, /*ourAddress=*/ sender, /*nextHop=*/ receiver,
|
||||
/*source=*/ realSrc, /*destination=*/ realDst, /*ackId=*/ ackId,
|
||||
/*SegsLeft=*/ 0, /*expire time=*/ Simulator::Now ());
|
||||
CancelNetworkPacketTimer (newEntry); // Only need to cancel network packet timer
|
||||
}
|
||||
|
||||
void
|
||||
DsrRouting::CancelPacketAllTimer (MaintainBuffEntry & mb)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
CancelLinkPacketTimer (mb);
|
||||
CancelNetworkPacketTimer (mb);
|
||||
CancelPassivePacketTimer (mb);
|
||||
}
|
||||
|
||||
void
|
||||
DsrRouting::CancelLinkPacketTimer (MaintainBuffEntry & mb)
|
||||
{
|
||||
@@ -2148,15 +2049,15 @@ DsrRouting::CancelLinkPacketTimer (MaintainBuffEntry & mb)
|
||||
/*
|
||||
* Here we have found the entry for send retries, so we get the value and increase it by one
|
||||
*/
|
||||
/// TODO need to think about this part
|
||||
m_linkCnt[linkKey] = 0;
|
||||
m_linkCnt.erase (linkKey);
|
||||
|
||||
NS_LOG_INFO ("ourAdd " << mb.GetOurAdd () << " nextHop " << mb.GetNextHop ()
|
||||
<< " source " << mb.GetSrc () << " destination " << mb.GetDst ()
|
||||
);
|
||||
// Find the link acknowledgment timer
|
||||
// TODO if find the linkkey, we need to remove it
|
||||
|
||||
// Find the network acknowledgment timer
|
||||
std::map<LinkKey, Timer>::const_iterator i =
|
||||
m_linkAckTimer.find (linkKey);
|
||||
m_linkAckTimer.find (linkKey);
|
||||
if (i == m_linkAckTimer.end ())
|
||||
{
|
||||
NS_LOG_INFO ("did not find the link timer");
|
||||
@@ -2176,6 +2077,7 @@ DsrRouting::CancelLinkPacketTimer (MaintainBuffEntry & mb)
|
||||
}
|
||||
m_linkAckTimer.erase (linkKey);
|
||||
}
|
||||
|
||||
// Erase the maintenance entry
|
||||
// yet this does not check the segments left value here
|
||||
NS_LOG_DEBUG ("The link buffer size " << m_maintainBuffer.GetSize());
|
||||
@@ -2185,23 +2087,6 @@ DsrRouting::CancelLinkPacketTimer (MaintainBuffEntry & mb)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DsrRouting::CallCancelPacketTimer (uint16_t ackId, Ipv4Header const& ipv4Header, Ipv4Address realSrc, Ipv4Address realDst)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << (uint32_t)ackId << ipv4Header << realSrc << realDst);
|
||||
Ipv4Address sender = ipv4Header.GetDestination ();
|
||||
Ipv4Address receiver = ipv4Header.GetSource ();
|
||||
/*
|
||||
* Create a packet to fill maintenance buffer, not used to compare with maintainance entry
|
||||
* The reason is ack header doesn't have the original packet copy
|
||||
*/
|
||||
Ptr<Packet> mainP = Create<Packet> ();
|
||||
MaintainBuffEntry newEntry (/*Packet=*/ mainP, /*ourAddress=*/ sender, /*nextHop=*/ receiver,
|
||||
/*source=*/ realSrc, /*destination=*/ realDst, /*ackId=*/ ackId,
|
||||
/*SegsLeft=*/ 0, /*expire time=*/ Simulator::Now ());
|
||||
CancelNetworkPacketTimer (newEntry);
|
||||
}
|
||||
|
||||
void
|
||||
DsrRouting::CancelNetworkPacketTimer (MaintainBuffEntry & mb)
|
||||
{
|
||||
@@ -2292,16 +2177,61 @@ void
|
||||
DsrRouting::CancelPacketTimerNextHop (Ipv4Address nextHop, uint8_t protocol)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << nextHop << (uint32_t)protocol);
|
||||
|
||||
MaintainBuffEntry entry;
|
||||
std::vector<Ipv4Address> previousErrorDst;
|
||||
if (m_maintainBuffer.Dequeue (nextHop, entry))
|
||||
{
|
||||
Ptr<const Packet> packet = entry.GetPacket ()->Copy ();
|
||||
Ipv4Address source = entry.GetSrc ();
|
||||
Ipv4Address destination = entry.GetDst ();
|
||||
|
||||
Ptr<Packet> dsrP = entry.GetPacket ()->Copy ();
|
||||
Ptr<Packet> p = dsrP->Copy ();
|
||||
Ptr<Packet> packet = dsrP->Copy ();
|
||||
DsrRoutingHeader dsrRoutingHeader;
|
||||
dsrP->RemoveHeader (dsrRoutingHeader); // Remove the dsr header in whole
|
||||
uint32_t offset = dsrRoutingHeader.GetDsrOptionsOffset ();
|
||||
p->RemoveAtStart (offset);
|
||||
|
||||
// Get the number of routers' address field
|
||||
uint8_t buf[2];
|
||||
p->CopyData (buf, sizeof(buf));
|
||||
uint8_t numberAddress = (buf[1] - 2) / 4;
|
||||
NS_LOG_DEBUG ("The number of addresses " << (uint32_t)numberAddress);
|
||||
DsrOptionSRHeader sourceRoute;
|
||||
sourceRoute.SetNumberAddress (numberAddress);
|
||||
p->RemoveHeader (sourceRoute);
|
||||
std::vector<Ipv4Address> nodeList = sourceRoute.GetNodesAddress ();
|
||||
uint8_t salvage = sourceRoute.GetSalvage ();
|
||||
Ipv4Address address1 = nodeList[1];
|
||||
PrintVector (nodeList);
|
||||
|
||||
/*
|
||||
* If the salvage is not 0, use the first address in the route as the error dst in error header
|
||||
* otherwise use the source of packet as the error destination
|
||||
*/
|
||||
Ipv4Address errorDst;
|
||||
if (salvage)
|
||||
{
|
||||
errorDst = address1;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorDst = source;
|
||||
}
|
||||
/// TODO if the errorDst is not seen before
|
||||
if (std::find(previousErrorDst.begin(), previousErrorDst.end(), destination)==previousErrorDst.end())
|
||||
{
|
||||
NS_LOG_DEBUG ("have not seen this dst before " << errorDst << " in " << previousErrorDst.size());
|
||||
SendUnreachError (nextHop, errorDst, destination, salvage, protocol);
|
||||
previousErrorDst.push_back(errorDst);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cancel the packet timer and then salvage the data packet
|
||||
*/
|
||||
CancelNetworkPacketTimer (entry);
|
||||
|
||||
CancelPacketAllTimer (entry);
|
||||
SalvagePacket (packet, source, destination, protocol);
|
||||
|
||||
if (m_maintainBuffer.GetSize () && m_maintainBuffer.Find (nextHop))
|
||||
@@ -2315,6 +2245,7 @@ DsrRouting::CancelPacketTimerNextHop (Ipv4Address nextHop, uint8_t protocol)
|
||||
{
|
||||
NS_LOG_INFO ("Maintenance buffer entry not found");
|
||||
}
|
||||
/// TODO need to think about whether we need the network queue entry or not
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2388,19 +2319,19 @@ DsrRouting::SalvagePacket (Ptr<const Packet> packet, Ipv4Address source, Ipv4Add
|
||||
Ptr<dsr::DsrNetworkQueue> dsrNetworkQueue = i->second;
|
||||
NS_LOG_DEBUG ("Will be inserting into priority queue " << dsrNetworkQueue << " number: " << priority);
|
||||
|
||||
m_downTarget (p, m_mainAddress, nextHop, GetProtocolNumber (), m_ipv4Route);
|
||||
//m_downTarget (p, m_mainAddress, nextHop, GetProtocolNumber (), m_ipv4Route);
|
||||
|
||||
/// \todo New DsrNetworkQueueEntry
|
||||
// DsrNetworkQueueEntry newEntry (p, m_mainAddress, nextHop, Simulator::Now (), m_ipv4Route);
|
||||
//
|
||||
// if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
// {
|
||||
// Scheduler (priority);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
// }
|
||||
DsrNetworkQueueEntry newEntry (p, m_mainAddress, nextHop, Simulator::Now (), m_ipv4Route);
|
||||
|
||||
if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
{
|
||||
Scheduler (priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark the next hop address in blacklist
|
||||
@@ -2589,7 +2520,6 @@ DsrRouting::LinkScheduleTimerExpire (MaintainBuffEntry & mb,
|
||||
{
|
||||
NS_LOG_FUNCTION (this << (uint32_t)protocol);
|
||||
Ipv4Address nextHop = mb.GetNextHop ();
|
||||
Ipv4Address source = mb.GetSrc ();
|
||||
Ptr<const Packet> packet = mb.GetPacket ();
|
||||
SetRoute (nextHop, m_mainAddress);
|
||||
Ptr<Packet> p = packet->Copy ();
|
||||
@@ -2618,46 +2548,14 @@ DsrRouting::LinkScheduleTimerExpire (MaintainBuffEntry & mb,
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_DEBUG ("We may need to send error messages now");
|
||||
Ptr<Packet> dsrP = mb.GetPacket ()->Copy ();
|
||||
// The packet retries time has exceed the max maintenance retransmission times
|
||||
DsrRoutingHeader dsrRoutingHeader;
|
||||
dsrP->RemoveHeader (dsrRoutingHeader); // Remove the dsr header in whole
|
||||
uint32_t offset = dsrRoutingHeader.GetDsrOptionsOffset ();
|
||||
p->RemoveAtStart (offset);
|
||||
|
||||
// Get the number of routers' address field
|
||||
uint8_t buf[2];
|
||||
p->CopyData (buf, sizeof(buf));
|
||||
uint8_t numberAddress = (buf[1] - 2) / 4;
|
||||
NS_LOG_DEBUG ("The number of addresses " << (uint32_t)numberAddress);
|
||||
DsrOptionSRHeader sourceRoute;
|
||||
sourceRoute.SetNumberAddress (numberAddress);
|
||||
p->RemoveHeader (sourceRoute);
|
||||
std::vector<Ipv4Address> nodeList = sourceRoute.GetNodesAddress ();
|
||||
uint8_t salvage = sourceRoute.GetSalvage ();
|
||||
Ipv4Address address1 = nodeList[1];
|
||||
PrintVector (nodeList);
|
||||
NS_LOG_INFO ("We need to send error messages now");
|
||||
|
||||
// Delete all the routes including the links
|
||||
m_routeCache->DeleteAllRoutesIncludeLink (m_mainAddress, nextHop, m_mainAddress);
|
||||
/*
|
||||
* If the salvage is not 0, use the first address in the route as the error dst in error header
|
||||
* otherwise use the source of packet as the error destination
|
||||
*/
|
||||
Ipv4Address errorDst;
|
||||
if (salvage)
|
||||
{
|
||||
errorDst = address1;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorDst = source;
|
||||
}
|
||||
SendUnreachError (nextHop, errorDst, mb.GetDst (), salvage, protocol);
|
||||
/*
|
||||
* here we cancel the packet retransmission time for all the packets have next hop address as nextHop
|
||||
* Also salvage the packet for the all the packet destined for the nextHop address
|
||||
* this is also responsible for send unreachable error back to source
|
||||
*/
|
||||
CancelPacketTimerNextHop (nextHop, protocol);
|
||||
}
|
||||
@@ -2733,43 +2631,8 @@ DsrRouting::NetworkScheduleTimerExpire (MaintainBuffEntry & mb,
|
||||
|
||||
if (m_sendRetries >= m_maxMaintRexmt)
|
||||
{
|
||||
Ptr<Packet> dsrP = mb.GetPacket ()->Copy ();
|
||||
// The packet retries time has exceed the max maintenance retransmission times
|
||||
NS_LOG_LOGIC ("Packet transmissions to " << nextHop << " has been attempted SendRetries times for " << networkKey.m_ackId);
|
||||
DsrRoutingHeader dsrRoutingHeader;
|
||||
dsrP->RemoveHeader (dsrRoutingHeader); // Remove the dsr header in whole
|
||||
uint32_t offset = dsrRoutingHeader.GetDsrOptionsOffset ();
|
||||
p->RemoveAtStart (offset);
|
||||
|
||||
// Get the number of routers' address field
|
||||
uint8_t buf[2];
|
||||
p->CopyData (buf, sizeof(buf));
|
||||
uint8_t numberAddress = (buf[1] - 2) / 4;
|
||||
NS_LOG_DEBUG ("The number of addresses " << (uint32_t)numberAddress);
|
||||
DsrOptionSRHeader sourceRoute;
|
||||
sourceRoute.SetNumberAddress (numberAddress);
|
||||
p->RemoveHeader (sourceRoute);
|
||||
std::vector<Ipv4Address> nodeList = sourceRoute.GetNodesAddress ();
|
||||
uint8_t salvage = sourceRoute.GetSalvage ();
|
||||
Ipv4Address address1 = nodeList[1];
|
||||
PrintVector (nodeList);
|
||||
|
||||
// Delete all the routes including the links
|
||||
m_routeCache->DeleteAllRoutesIncludeLink (m_mainAddress, nextHop, m_mainAddress);
|
||||
/*
|
||||
* If the salvage is not 0, use the first address in the route as the error dst in error header
|
||||
* otherwise use the source of packet as the error destination
|
||||
*/
|
||||
Ipv4Address errorDst;
|
||||
if (salvage)
|
||||
{
|
||||
errorDst = address1;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorDst = source;
|
||||
}
|
||||
SendUnreachError (nextHop, errorDst, dst, salvage, protocol);
|
||||
/*
|
||||
* here we cancel the packet retransmission time for all the packets have next hop address as nextHop
|
||||
* Also salvage the packet for the all the packet destined for the nextHop address
|
||||
@@ -3225,18 +3088,18 @@ DsrRouting::SendRequest (Ptr<Packet> packet,
|
||||
Ptr<dsr::DsrNetworkQueue> dsrNetworkQueue = i->second;
|
||||
NS_LOG_LOGIC ("Inserting into priority queue number: " << priority);
|
||||
|
||||
m_downTarget (packet, source, m_broadcast, GetProtocolNumber (), 0);
|
||||
//m_downTarget (packet, source, m_broadcast, GetProtocolNumber (), 0);
|
||||
|
||||
/// \todo New DsrNetworkQueueEntry
|
||||
// DsrNetworkQueueEntry newEntry (packet, source, m_broadcast, Simulator::Now (), 0);
|
||||
// if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
// {
|
||||
// Scheduler (priority);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
// }
|
||||
DsrNetworkQueueEntry newEntry (packet, source, m_broadcast, Simulator::Now (), 0);
|
||||
if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
{
|
||||
Scheduler (priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3331,18 +3194,18 @@ DsrRouting::SendReply (Ptr<Packet> packet,
|
||||
Ptr<dsr::DsrNetworkQueue> dsrNetworkQueue = i->second;
|
||||
NS_LOG_INFO ("Inserting into priority queue number: " << priority);
|
||||
|
||||
m_downTarget (packet, source, nextHop, GetProtocolNumber (), route);
|
||||
//m_downTarget (packet, source, nextHop, GetProtocolNumber (), route);
|
||||
|
||||
/// \todo New DsrNetworkQueueEntry
|
||||
// DsrNetworkQueueEntry newEntry (packet, source, nextHop, Simulator::Now (), route);
|
||||
// if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
// {
|
||||
// Scheduler (priority);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
// }
|
||||
DsrNetworkQueueEntry newEntry (packet, source, nextHop, Simulator::Now (), route);
|
||||
if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
{
|
||||
Scheduler (priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3408,18 +3271,18 @@ DsrRouting::SendAck (uint16_t ackId,
|
||||
|
||||
NS_LOG_LOGIC ("Will be inserting into priority queue " << dsrNetworkQueue << " number: " << priority);
|
||||
|
||||
m_downTarget (packet, m_mainAddress, destination, GetProtocolNumber (), route);
|
||||
//m_downTarget (packet, m_mainAddress, destination, GetProtocolNumber (), route);
|
||||
|
||||
/// \todo New DsrNetworkQueueEntry
|
||||
// DsrNetworkQueueEntry newEntry (packet, m_mainAddress, destination, Simulator::Now (), route);
|
||||
// if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
// {
|
||||
// Scheduler (priority);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
// }
|
||||
DsrNetworkQueueEntry newEntry (packet, m_mainAddress, destination, Simulator::Now (), route);
|
||||
if (dsrNetworkQueue->Enqueue (newEntry))
|
||||
{
|
||||
Scheduler (priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_INFO ("Packet dropped as dsr network queue is full");
|
||||
}
|
||||
}
|
||||
|
||||
enum IpL4Protocol::RxStatus
|
||||
|
||||
@@ -254,8 +254,7 @@ public:
|
||||
/**
|
||||
* \brief This function is responsible for sending error packets in case of break link to next hop
|
||||
*/
|
||||
void SendUnreachError (Ipv4Address errorHop, Ipv4Address destination, Ipv4Address originalDst, uint8_t salvage, uint8_t protocol);
|
||||
/**
|
||||
void SendUnreachError (Ipv4Address unreachNode, Ipv4Address destination, Ipv4Address originalDst, uint8_t salvage, uint8_t protocol); /**
|
||||
* \brief This function is responsible for forwarding error packets along the route
|
||||
*/
|
||||
void ForwardErrPacket (DsrOptionRerrUnreachHeader &rerr,
|
||||
@@ -304,6 +303,11 @@ public:
|
||||
*/
|
||||
bool PassiveEntryCheck (Ptr<Packet> packet, Ipv4Address source, Ipv4Address destination, uint8_t segsLeft,
|
||||
uint16_t fragmentOffset, uint16_t identification, bool saveEntry);
|
||||
|
||||
/**
|
||||
* \brief Cancel all the packet timers
|
||||
*/
|
||||
void CancelPacketAllTimer (MaintainBuffEntry & mb);
|
||||
/**
|
||||
* \brief Cancel the passive timer
|
||||
*/
|
||||
@@ -752,6 +756,8 @@ private:
|
||||
|
||||
GraReply m_graReply; ///< The gratuitous route reply.
|
||||
|
||||
DsrNetworkQueue m_networkQueue; ///< The network queue.
|
||||
|
||||
std::vector<Ipv4Address> m_clearList; ///< The node that is clear to send packet to
|
||||
|
||||
std::vector<Ipv4Address> m_addresses; ///< The bind ipv4 addresses with next hop, src, destination address in sequence
|
||||
|
||||
@@ -111,7 +111,7 @@ SendBuffer::Dequeue (Ipv4Address dst, SendBuffEntry & entry)
|
||||
if (i->GetDestination () == dst)
|
||||
{
|
||||
entry = *i;
|
||||
m_sendBuffer.erase (i);
|
||||
i = m_sendBuffer.erase (i);
|
||||
NS_LOG_DEBUG ("Packet size while dequeuing " << entry.GetPacket ()->GetSize ());
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user