# HG changeset patch # User Tommaso Pecorella # Date 1474587244 -7200 # Parent a5b85bc17689baf7c00d72a626ee43be60eadc41 # Parent a5b85bc17689baf7c00d72a626ee43be60eadc41 Printing a packet can raise an assert diff --git a/src/internet/model/icmpv4.cc b/src/internet/model/icmpv4.cc --- a/src/internet/model/icmpv4.cc +++ b/src/internet/model/icmpv4.cc @@ -247,24 +247,26 @@ Icmpv4Echo::Deserialize (Buffer::Iterator start) { NS_LOG_FUNCTION (this << &start); + + uint32_t optionalPayloadSize = start.GetRemainingSize () -4; + NS_ASSERT (start.GetRemainingSize () >= 4); + m_identifier = start.ReadNtohU16 (); m_sequence = start.ReadNtohU16 (); - NS_ASSERT (start.GetSize () >= 4); - uint32_t size = start.GetSize () - 4; - if (size != m_dataSize) + if (optionalPayloadSize != m_dataSize) { delete [] m_data; - m_data = new uint8_t[size]; - m_dataSize = size; + m_dataSize = optionalPayloadSize; + m_data = new uint8_t[m_dataSize]; } start.Read (m_data, m_dataSize); - return m_dataSize; + return m_dataSize+4; } void Icmpv4Echo::Print (std::ostream &os) const { NS_LOG_FUNCTION (this << &os); - os << "identifier=" << m_identifier << ", sequence=" << m_sequence; + os << "identifier=" << m_identifier << ", sequence=" << m_sequence << ", data size=" << m_dataSize; } diff --git a/src/internet/model/icmpv6-header.cc b/src/internet/model/icmpv6-header.cc --- a/src/internet/model/icmpv6-header.cc +++ b/src/internet/model/icmpv6-header.cc @@ -1123,7 +1123,7 @@ uint32_t Icmpv6DestinationUnreachable::Deserialize (Buffer::Iterator start) { NS_LOG_FUNCTION (this << &start); - uint16_t length = start.GetSize () - 8; + uint16_t length = start.GetRemainingSize () - 8; uint8_t* data = new uint8_t[length]; Buffer::Iterator i = start; @@ -1234,7 +1234,7 @@ uint32_t Icmpv6TooBig::Deserialize (Buffer::Iterator start) { NS_LOG_FUNCTION (this << &start); - uint16_t length = start.GetSize () - 8; + uint16_t length = start.GetRemainingSize () - 8; uint8_t* data = new uint8_t[length]; Buffer::Iterator i = start; @@ -1334,7 +1334,7 @@ { NS_LOG_FUNCTION (this << &start); - uint16_t length = start.GetSize () - 8; + uint16_t length = start.GetRemainingSize () - 8; uint8_t* data = new uint8_t[length]; Buffer::Iterator i = start; @@ -1445,7 +1445,7 @@ uint32_t Icmpv6ParameterError::Deserialize (Buffer::Iterator start) { NS_LOG_FUNCTION (this << &start); - uint16_t length = start.GetSize () - 8; + uint16_t length = start.GetRemainingSize () - 8; uint8_t* data = new uint8_t[length]; Buffer::Iterator i = start; diff --git a/src/internet/model/rip-header.cc b/src/internet/model/rip-header.cc --- a/src/internet/model/rip-header.cc +++ b/src/internet/model/rip-header.cc @@ -225,7 +225,7 @@ uint16_t temp16 = i.ReadU16 (); NS_ASSERT_MSG (temp16 == 0, "RIP received a message with invalid filled flags, aborting."); - uint8_t rteNumber = (i.GetSize () - 4)/20; + uint8_t rteNumber = i.GetRemainingSize ()/20; for (uint8_t n=0; n >', 'ns3::Ptr< ns3::Packet >', container_type=u'list') module.add_container('std::vector< ns3::Ipv6Address >', 'ns3::Ipv6Address', container_type=u'vector') module.add_container('std::list< unsigned int >', 'unsigned int', container_type=u'list') - typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyTxEndCallback') - typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyTxEndCallback*') - typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyTxEndCallback&') typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned short, short >', u'ns3::SequenceNumber16') typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned short, short >*', u'ns3::SequenceNumber16*') typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned short, short >&', u'ns3::SequenceNumber16&') @@ -524,6 +527,9 @@ typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyTxStartCallback') typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyTxStartCallback*') typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyTxStartCallback&') + typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyTxEndCallback') + typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyTxEndCallback*') + typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyTxEndCallback&') typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyRxEndOkCallback') typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyRxEndOkCallback*') typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyRxEndOkCallback&') @@ -625,6 +631,9 @@ typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) *', u'ns3::TracedValueCallback::Time') typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) **', u'ns3::TracedValueCallback::Time*') typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) *&', u'ns3::TracedValueCallback::Time&') + typehandlers.add_type_alias(u'void ( * ) ( ) *', u'ns3::TracedValueCallback::Void') + typehandlers.add_type_alias(u'void ( * ) ( ) **', u'ns3::TracedValueCallback::Void*') + typehandlers.add_type_alias(u'void ( * ) ( ) *&', u'ns3::TracedValueCallback::Void&') def register_types_ns3_addressUtils(module): root_module = module.get_root() @@ -771,6 +780,8 @@ register_Ns3DropTailQueue_methods(root_module, root_module['ns3::DropTailQueue']) register_Ns3DynamicQueueLimits_methods(root_module, root_module['ns3::DynamicQueueLimits']) register_Ns3EmpiricalRandomVariable_methods(root_module, root_module['ns3::EmpiricalRandomVariable']) + register_Ns3EmptyAttributeAccessor_methods(root_module, root_module['ns3::EmptyAttributeAccessor']) + register_Ns3EmptyAttributeChecker_methods(root_module, root_module['ns3::EmptyAttributeChecker']) register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue']) register_Ns3EnumChecker_methods(root_module, root_module['ns3::EnumChecker']) register_Ns3EnumValue_methods(root_module, root_module['ns3::EnumValue']) @@ -1256,6 +1267,11 @@ 'uint32_t', [param('ns3::Buffer::Iterator const &', 'o')], is_const=True) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetRemainingSize() const [member function] + cls.add_method('GetRemainingSize', + 'uint32_t', + [], + is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', @@ -3694,23 +3710,23 @@ cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor] cls.add_constructor([param('ns3::TypeId const &', 'o')]) - ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr accessor, ns3::Ptr checker) [member function] + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr accessor, ns3::Ptr checker, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SUPPORTED, std::string const & supportMsg="") [member function] cls.add_method('AddAttribute', 'ns3::TypeId', - [param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) - ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr accessor, ns3::Ptr checker) [member function] + [param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')]) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr accessor, ns3::Ptr checker, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SUPPORTED, std::string const & supportMsg="") [member function] cls.add_method('AddAttribute', 'ns3::TypeId', - [param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) + [param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr accessor) [member function] cls.add_method('AddTraceSource', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')], deprecated=True) - ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr accessor, std::string callback) [member function] + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr accessor, std::string callback, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SUPPORTED, std::string const & supportMsg="") [member function] cls.add_method('AddTraceSource', 'ns3::TypeId', - [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor'), param('std::string', 'callback')]) + [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor'), param('std::string', 'callback'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function] cls.add_method('GetAttribute', 'ns3::TypeId::AttributeInformation', @@ -3825,6 +3841,11 @@ 'ns3::Ptr< ns3::TraceSourceAccessor const >', [param('std::string', 'name')], is_const=True) + ## type-id.h (module 'core'): ns3::Ptr ns3::TypeId::LookupTraceSourceByName(std::string name, ns3::TypeId::TraceSourceInformation * info) const [member function] + cls.add_method('LookupTraceSourceByName', + 'ns3::Ptr< ns3::TraceSourceAccessor const >', + [param('std::string', 'name'), param('ns3::TypeId::TraceSourceInformation *', 'info')], + is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function] cls.add_method('MustHideFromDocumentation', 'bool', @@ -3851,10 +3872,10 @@ cls.add_method('SetSize', 'ns3::TypeId', [param('std::size_t', 'size')]) - ## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function] + ## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t uid) [member function] cls.add_method('SetUid', 'void', - [param('uint16_t', 'tid')]) + [param('uint16_t', 'uid')]) return def register_Ns3TypeIdAttributeInformation_methods(root_module, cls): @@ -3876,6 +3897,10 @@ cls.add_instance_attribute('name', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable] cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::supportLevel [variable] + cls.add_instance_attribute('supportLevel', 'ns3::TypeId::SupportLevel', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::supportMsg [variable] + cls.add_instance_attribute('supportMsg', 'std::string', is_const=False) return def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls): @@ -3891,6 +3916,10 @@ cls.add_instance_attribute('help', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::supportLevel [variable] + cls.add_instance_attribute('supportLevel', 'ns3::TypeId::SupportLevel', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::supportMsg [variable] + cls.add_instance_attribute('supportMsg', 'std::string', is_const=False) return def register_Ns3Empty_methods(root_module, cls): @@ -6828,6 +6857,70 @@ visibility='private', is_virtual=True) return +def register_Ns3EmptyAttributeAccessor_methods(root_module, cls): + ## attribute.h (module 'core'): ns3::EmptyAttributeAccessor::EmptyAttributeAccessor(ns3::EmptyAttributeAccessor const & arg0) [copy constructor] + cls.add_constructor([param('ns3::EmptyAttributeAccessor const &', 'arg0')]) + ## attribute.h (module 'core'): ns3::EmptyAttributeAccessor::EmptyAttributeAccessor() [constructor] + cls.add_constructor([]) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function] + cls.add_method('Get', + 'bool', + [param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::HasGetter() const [member function] + cls.add_method('HasGetter', + 'bool', + [], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::HasSetter() const [member function] + cls.add_method('HasSetter', + 'bool', + [], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function] + cls.add_method('Set', + 'bool', + [param('ns3::ObjectBase *', 'object'), param('ns3::AttributeValue const &', 'value')], + is_const=True, is_virtual=True) + return + +def register_Ns3EmptyAttributeChecker_methods(root_module, cls): + ## attribute.h (module 'core'): ns3::EmptyAttributeChecker::EmptyAttributeChecker(ns3::EmptyAttributeChecker const & arg0) [copy constructor] + cls.add_constructor([param('ns3::EmptyAttributeChecker const &', 'arg0')]) + ## attribute.h (module 'core'): ns3::EmptyAttributeChecker::EmptyAttributeChecker() [constructor] + cls.add_constructor([]) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::Check(ns3::AttributeValue const & value) const [member function] + cls.add_method('Check', + 'bool', + [param('ns3::AttributeValue const &', 'value')], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function] + cls.add_method('Copy', + 'bool', + [param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): ns3::Ptr ns3::EmptyAttributeChecker::Create() const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::AttributeValue >', + [], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): std::string ns3::EmptyAttributeChecker::GetUnderlyingTypeInformation() const [member function] + cls.add_method('GetUnderlyingTypeInformation', + 'std::string', + [], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): std::string ns3::EmptyAttributeChecker::GetValueTypeName() const [member function] + cls.add_method('GetValueTypeName', + 'std::string', + [], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::HasUnderlyingTypeInformation() const [member function] + cls.add_method('HasUnderlyingTypeInformation', + 'bool', + [], + is_const=True, is_virtual=True) + return + def register_Ns3EmptyAttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')]) diff --git a/src/network/bindings/modulegen__gcc_LP64.py b/src/network/bindings/modulegen__gcc_LP64.py --- a/src/network/bindings/modulegen__gcc_LP64.py +++ b/src/network/bindings/modulegen__gcc_LP64.py @@ -178,6 +178,8 @@ module.add_class('TypeId', import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration] module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core') + ## type-id.h (module 'core'): ns3::TypeId::SupportLevel [enumeration] + module.add_enum('SupportLevel', ['SUPPORTED', 'DEPRECATED', 'OBSOLETE'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct] module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct] @@ -356,6 +358,10 @@ module.add_class('DynamicQueueLimits', parent=root_module['ns3::QueueLimits']) ## random-variable-stream.h (module 'core'): ns3::EmpiricalRandomVariable [class] module.add_class('EmpiricalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## attribute.h (module 'core'): ns3::EmptyAttributeAccessor [class] + module.add_class('EmptyAttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::AttributeAccessor']) + ## attribute.h (module 'core'): ns3::EmptyAttributeChecker [class] + module.add_class('EmptyAttributeChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## attribute.h (module 'core'): ns3::EmptyAttributeValue [class] module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## enum.h (module 'core'): ns3::EnumChecker [class] @@ -503,9 +509,6 @@ module.add_container('std::list< ns3::Ptr< ns3::Packet > >', 'ns3::Ptr< ns3::Packet >', container_type=u'list') module.add_container('std::vector< ns3::Ipv6Address >', 'ns3::Ipv6Address', container_type=u'vector') module.add_container('std::list< unsigned int >', 'unsigned int', container_type=u'list') - typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyTxEndCallback') - typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyTxEndCallback*') - typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyTxEndCallback&') typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned short, short >', u'ns3::SequenceNumber16') typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned short, short >*', u'ns3::SequenceNumber16*') typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned short, short >&', u'ns3::SequenceNumber16&') @@ -524,6 +527,9 @@ typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyTxStartCallback') typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyTxStartCallback*') typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyTxStartCallback&') + typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyTxEndCallback') + typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyTxEndCallback*') + typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyTxEndCallback&') typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyRxEndOkCallback') typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyRxEndOkCallback*') typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyRxEndOkCallback&') @@ -625,6 +631,9 @@ typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) *', u'ns3::TracedValueCallback::Time') typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) **', u'ns3::TracedValueCallback::Time*') typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) *&', u'ns3::TracedValueCallback::Time&') + typehandlers.add_type_alias(u'void ( * ) ( ) *', u'ns3::TracedValueCallback::Void') + typehandlers.add_type_alias(u'void ( * ) ( ) **', u'ns3::TracedValueCallback::Void*') + typehandlers.add_type_alias(u'void ( * ) ( ) *&', u'ns3::TracedValueCallback::Void&') def register_types_ns3_addressUtils(module): root_module = module.get_root() @@ -771,6 +780,8 @@ register_Ns3DropTailQueue_methods(root_module, root_module['ns3::DropTailQueue']) register_Ns3DynamicQueueLimits_methods(root_module, root_module['ns3::DynamicQueueLimits']) register_Ns3EmpiricalRandomVariable_methods(root_module, root_module['ns3::EmpiricalRandomVariable']) + register_Ns3EmptyAttributeAccessor_methods(root_module, root_module['ns3::EmptyAttributeAccessor']) + register_Ns3EmptyAttributeChecker_methods(root_module, root_module['ns3::EmptyAttributeChecker']) register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue']) register_Ns3EnumChecker_methods(root_module, root_module['ns3::EnumChecker']) register_Ns3EnumValue_methods(root_module, root_module['ns3::EnumValue']) @@ -1256,6 +1267,11 @@ 'uint32_t', [param('ns3::Buffer::Iterator const &', 'o')], is_const=True) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetRemainingSize() const [member function] + cls.add_method('GetRemainingSize', + 'uint32_t', + [], + is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', @@ -3694,23 +3710,23 @@ cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor] cls.add_constructor([param('ns3::TypeId const &', 'o')]) - ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr accessor, ns3::Ptr checker) [member function] + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr accessor, ns3::Ptr checker, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SUPPORTED, std::string const & supportMsg="") [member function] cls.add_method('AddAttribute', 'ns3::TypeId', - [param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) - ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr accessor, ns3::Ptr checker) [member function] + [param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')]) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr accessor, ns3::Ptr checker, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SUPPORTED, std::string const & supportMsg="") [member function] cls.add_method('AddAttribute', 'ns3::TypeId', - [param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) + [param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr accessor) [member function] cls.add_method('AddTraceSource', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')], deprecated=True) - ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr accessor, std::string callback) [member function] + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr accessor, std::string callback, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SUPPORTED, std::string const & supportMsg="") [member function] cls.add_method('AddTraceSource', 'ns3::TypeId', - [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor'), param('std::string', 'callback')]) + [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor'), param('std::string', 'callback'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function] cls.add_method('GetAttribute', 'ns3::TypeId::AttributeInformation', @@ -3825,6 +3841,11 @@ 'ns3::Ptr< ns3::TraceSourceAccessor const >', [param('std::string', 'name')], is_const=True) + ## type-id.h (module 'core'): ns3::Ptr ns3::TypeId::LookupTraceSourceByName(std::string name, ns3::TypeId::TraceSourceInformation * info) const [member function] + cls.add_method('LookupTraceSourceByName', + 'ns3::Ptr< ns3::TraceSourceAccessor const >', + [param('std::string', 'name'), param('ns3::TypeId::TraceSourceInformation *', 'info')], + is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function] cls.add_method('MustHideFromDocumentation', 'bool', @@ -3851,10 +3872,10 @@ cls.add_method('SetSize', 'ns3::TypeId', [param('std::size_t', 'size')]) - ## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function] + ## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t uid) [member function] cls.add_method('SetUid', 'void', - [param('uint16_t', 'tid')]) + [param('uint16_t', 'uid')]) return def register_Ns3TypeIdAttributeInformation_methods(root_module, cls): @@ -3876,6 +3897,10 @@ cls.add_instance_attribute('name', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable] cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::supportLevel [variable] + cls.add_instance_attribute('supportLevel', 'ns3::TypeId::SupportLevel', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::supportMsg [variable] + cls.add_instance_attribute('supportMsg', 'std::string', is_const=False) return def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls): @@ -3891,6 +3916,10 @@ cls.add_instance_attribute('help', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::supportLevel [variable] + cls.add_instance_attribute('supportLevel', 'ns3::TypeId::SupportLevel', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::supportMsg [variable] + cls.add_instance_attribute('supportMsg', 'std::string', is_const=False) return def register_Ns3Empty_methods(root_module, cls): @@ -6828,6 +6857,70 @@ visibility='private', is_virtual=True) return +def register_Ns3EmptyAttributeAccessor_methods(root_module, cls): + ## attribute.h (module 'core'): ns3::EmptyAttributeAccessor::EmptyAttributeAccessor(ns3::EmptyAttributeAccessor const & arg0) [copy constructor] + cls.add_constructor([param('ns3::EmptyAttributeAccessor const &', 'arg0')]) + ## attribute.h (module 'core'): ns3::EmptyAttributeAccessor::EmptyAttributeAccessor() [constructor] + cls.add_constructor([]) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function] + cls.add_method('Get', + 'bool', + [param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::HasGetter() const [member function] + cls.add_method('HasGetter', + 'bool', + [], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::HasSetter() const [member function] + cls.add_method('HasSetter', + 'bool', + [], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function] + cls.add_method('Set', + 'bool', + [param('ns3::ObjectBase *', 'object'), param('ns3::AttributeValue const &', 'value')], + is_const=True, is_virtual=True) + return + +def register_Ns3EmptyAttributeChecker_methods(root_module, cls): + ## attribute.h (module 'core'): ns3::EmptyAttributeChecker::EmptyAttributeChecker(ns3::EmptyAttributeChecker const & arg0) [copy constructor] + cls.add_constructor([param('ns3::EmptyAttributeChecker const &', 'arg0')]) + ## attribute.h (module 'core'): ns3::EmptyAttributeChecker::EmptyAttributeChecker() [constructor] + cls.add_constructor([]) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::Check(ns3::AttributeValue const & value) const [member function] + cls.add_method('Check', + 'bool', + [param('ns3::AttributeValue const &', 'value')], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function] + cls.add_method('Copy', + 'bool', + [param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): ns3::Ptr ns3::EmptyAttributeChecker::Create() const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::AttributeValue >', + [], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): std::string ns3::EmptyAttributeChecker::GetUnderlyingTypeInformation() const [member function] + cls.add_method('GetUnderlyingTypeInformation', + 'std::string', + [], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): std::string ns3::EmptyAttributeChecker::GetValueTypeName() const [member function] + cls.add_method('GetValueTypeName', + 'std::string', + [], + is_const=True, is_virtual=True) + ## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::HasUnderlyingTypeInformation() const [member function] + cls.add_method('HasUnderlyingTypeInformation', + 'bool', + [], + is_const=True, is_virtual=True) + return + def register_Ns3EmptyAttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')]) diff --git a/src/network/model/buffer.cc b/src/network/model/buffer.cc --- a/src/network/model/buffer.cc +++ b/src/network/model/buffer.cc @@ -1161,6 +1161,13 @@ return m_dataEnd - m_dataStart; } +uint32_t +Buffer::Iterator::GetRemainingSize (void) const +{ + NS_LOG_FUNCTION (this); + return m_dataEnd - m_current; +} + std::string Buffer::Iterator::GetReadErrorMessage (void) const diff --git a/src/network/model/buffer.h b/src/network/model/buffer.h --- a/src/network/model/buffer.h +++ b/src/network/model/buffer.h @@ -376,6 +376,11 @@ */ uint32_t GetSize (void) const; + /** + * \returns the size left to read of the underlying buffer we are iterating + */ + uint32_t GetRemainingSize (void) const; + private: friend class Buffer; /**