merge with ns-3-dev

This commit is contained in:
Gustavo J. A. M. Carneiro
2009-09-16 15:27:54 +01:00
32 changed files with 3266 additions and 407 deletions

View File

@@ -197,6 +197,7 @@ def register_types(module):
root_module['ns3::TracedValue< unsigned int >'].implicitly_converts_to(root_module['ns3::EnumValue'])
module.add_container('std::list< ns3::Ptr< ns3::RadvdPrefix > >', 'ns3::Ptr< ns3::RadvdPrefix >', container_type='list')
module.add_container('std::list< ns3::Ptr< ns3::Packet > >', 'ns3::Ptr< ns3::Packet >', container_type='list')
module.add_container('std::vector< ns3::Ptr< ns3::FlowProbe > >', 'ns3::Ptr< ns3::FlowProbe >', container_type='vector')
module.add_container('std::vector< ns3::Ptr< ns3::NetDevice > >', 'ns3::Ptr< ns3::NetDevice >', container_type='vector')
typehandlers.add_type_alias('ns3::Vector3D', 'ns3::Vector')
typehandlers.add_type_alias('ns3::Vector3D*', 'ns3::Vector*')

View File

@@ -0,0 +1,434 @@
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
## histogram.h: ns3::Histogram [class]
module.add_class('Histogram')
## flow-classifier.h: ns3::FlowClassifier [class]
module.add_class('FlowClassifier', parent=root_module['ns3::RefCountBase'])
## flow-probe.h: ns3::FlowProbe [class]
module.add_class('FlowProbe', parent=root_module['ns3::RefCountBase'])
## flow-probe.h: ns3::FlowProbe::FlowStats [struct]
module.add_class('FlowStats', outer_class=root_module['ns3::FlowProbe'])
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier [class]
module.add_class('Ipv4FlowClassifier', parent=root_module['ns3::FlowClassifier'])
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::FiveTuple [struct]
module.add_class('FiveTuple', outer_class=root_module['ns3::Ipv4FlowClassifier'])
## ipv4-flow-probe.h: ns3::Ipv4FlowProbe [class]
module.add_class('Ipv4FlowProbe', parent=root_module['ns3::FlowProbe'])
## ipv4-flow-probe.h: ns3::Ipv4FlowProbe::DropReason [enumeration]
module.add_enum('DropReason', ['DROP_NO_ROUTE', 'DROP_TTL_EXPIRE', 'DROP_BAD_CHECKSUM', 'DROP_INVALID_REASON'], outer_class=root_module['ns3::Ipv4FlowProbe'])
## flow-monitor.h: ns3::FlowMonitor [class]
module.add_class('FlowMonitor', parent=root_module['ns3::Object'])
## flow-monitor.h: ns3::FlowMonitor::FlowStats [struct]
module.add_class('FlowStats', outer_class=root_module['ns3::FlowMonitor'])
module.add_container('std::map< unsigned int, ns3::FlowProbe::FlowStats >', ('unsigned int', 'ns3::FlowProbe::FlowStats'), container_type='map')
module.add_container('std::map< unsigned int, ns3::FlowMonitor::FlowStats >', ('unsigned int', 'ns3::FlowMonitor::FlowStats'), container_type='map')
typehandlers.add_type_alias('uint32_t', 'ns3::FlowPacketId')
typehandlers.add_type_alias('uint32_t*', 'ns3::FlowPacketId*')
typehandlers.add_type_alias('uint32_t&', 'ns3::FlowPacketId&')
typehandlers.add_type_alias('uint32_t', 'ns3::FlowId')
typehandlers.add_type_alias('uint32_t*', 'ns3::FlowId*')
typehandlers.add_type_alias('uint32_t&', 'ns3::FlowId&')
## Register a nested module for the namespace Config
nested_module = module.add_cpp_namespace('Config')
register_types_ns3_Config(nested_module)
## Register a nested module for the namespace TimeStepPrecision
nested_module = module.add_cpp_namespace('TimeStepPrecision')
register_types_ns3_TimeStepPrecision(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace dot11s
nested_module = module.add_cpp_namespace('dot11s')
register_types_ns3_dot11s(nested_module)
## Register a nested module for the namespace flame
nested_module = module.add_cpp_namespace('flame')
register_types_ns3_flame(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
register_types_ns3_internal(nested_module)
## Register a nested module for the namespace olsr
nested_module = module.add_cpp_namespace('olsr')
register_types_ns3_olsr(nested_module)
def register_types_ns3_Config(module):
root_module = module.get_root()
def register_types_ns3_TimeStepPrecision(module):
root_module = module.get_root()
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_dot11s(module):
root_module = module.get_root()
def register_types_ns3_flame(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
def register_types_ns3_olsr(module):
root_module = module.get_root()
def register_methods(root_module):
register_Ns3Histogram_methods(root_module, root_module['ns3::Histogram'])
register_Ns3FlowClassifier_methods(root_module, root_module['ns3::FlowClassifier'])
register_Ns3FlowProbe_methods(root_module, root_module['ns3::FlowProbe'])
register_Ns3FlowProbeFlowStats_methods(root_module, root_module['ns3::FlowProbe::FlowStats'])
register_Ns3Ipv4FlowClassifier_methods(root_module, root_module['ns3::Ipv4FlowClassifier'])
register_Ns3Ipv4FlowClassifierFiveTuple_methods(root_module, root_module['ns3::Ipv4FlowClassifier::FiveTuple'])
register_Ns3Ipv4FlowProbe_methods(root_module, root_module['ns3::Ipv4FlowProbe'])
register_Ns3FlowMonitor_methods(root_module, root_module['ns3::FlowMonitor'])
register_Ns3FlowMonitorFlowStats_methods(root_module, root_module['ns3::FlowMonitor::FlowStats'])
return
def register_Ns3Histogram_methods(root_module, cls):
## histogram.h: ns3::Histogram::Histogram(ns3::Histogram const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Histogram const &', 'arg0')])
## histogram.h: ns3::Histogram::Histogram(double binWidth) [constructor]
cls.add_constructor([param('double', 'binWidth')])
## histogram.h: ns3::Histogram::Histogram() [constructor]
cls.add_constructor([])
## histogram.h: void ns3::Histogram::AddValue(double value) [member function]
cls.add_method('AddValue',
'void',
[param('double', 'value')])
## histogram.h: uint32_t ns3::Histogram::GetBinCount(uint32_t index) [member function]
cls.add_method('GetBinCount',
'uint32_t',
[param('uint32_t', 'index')])
## histogram.h: double ns3::Histogram::GetBinEnd(uint32_t index) [member function]
cls.add_method('GetBinEnd',
'double',
[param('uint32_t', 'index')])
## histogram.h: double ns3::Histogram::GetBinStart(uint32_t index) [member function]
cls.add_method('GetBinStart',
'double',
[param('uint32_t', 'index')])
## histogram.h: double ns3::Histogram::GetBinWidth(uint32_t index) const [member function]
cls.add_method('GetBinWidth',
'double',
[param('uint32_t', 'index')],
is_const=True)
## histogram.h: uint32_t ns3::Histogram::GetNBins() const [member function]
cls.add_method('GetNBins',
'uint32_t',
[],
is_const=True)
## histogram.h: void ns3::Histogram::SerializeToXmlStream(std::ostream & os, int indent, std::string elementName) const [member function]
cls.add_method('SerializeToXmlStream',
'void',
[param('std::ostream &', 'os'), param('int', 'indent'), param('std::string', 'elementName')],
is_const=True)
## histogram.h: void ns3::Histogram::SetDefaultBinWidth(double binWidth) [member function]
cls.add_method('SetDefaultBinWidth',
'void',
[param('double', 'binWidth')])
return
def register_Ns3FlowClassifier_methods(root_module, cls):
## flow-classifier.h: ns3::FlowClassifier::FlowClassifier(ns3::FlowClassifier const & arg0) [copy constructor]
cls.add_constructor([param('ns3::FlowClassifier const &', 'arg0')])
## flow-classifier.h: ns3::FlowClassifier::FlowClassifier() [constructor]
cls.add_constructor([])
## flow-classifier.h: void ns3::FlowClassifier::SerializeToXmlStream(std::ostream & os, int indent) const [member function]
cls.add_method('SerializeToXmlStream',
'void',
[param('std::ostream &', 'os'), param('int', 'indent')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## flow-classifier.h: ns3::FlowId ns3::FlowClassifier::GetNewFlowId() [member function]
cls.add_method('GetNewFlowId',
'ns3::FlowId',
[],
visibility='protected')
return
def register_Ns3FlowProbe_methods(root_module, cls):
## flow-probe.h: ns3::FlowProbe::FlowProbe(ns3::FlowProbe const & arg0) [copy constructor]
cls.add_constructor([param('ns3::FlowProbe const &', 'arg0')])
## flow-probe.h: void ns3::FlowProbe::AddPacketDropStats(ns3::FlowId flowId, uint32_t packetSize, uint32_t reasonCode) [member function]
cls.add_method('AddPacketDropStats',
'void',
[param('ns3::FlowId', 'flowId'), param('uint32_t', 'packetSize'), param('uint32_t', 'reasonCode')])
## flow-probe.h: void ns3::FlowProbe::AddPacketStats(ns3::FlowId flowId, uint32_t packetSize, ns3::Time delayFromFirstProbe) [member function]
cls.add_method('AddPacketStats',
'void',
[param('ns3::FlowId', 'flowId'), param('uint32_t', 'packetSize'), param('ns3::Time', 'delayFromFirstProbe')])
## flow-probe.h: std::map<unsigned int, ns3::FlowProbe::FlowStats, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, ns3::FlowProbe::FlowStats> > > ns3::FlowProbe::GetStats() const [member function]
cls.add_method('GetStats',
'std::map< unsigned int, ns3::FlowProbe::FlowStats >',
[],
is_const=True)
## flow-probe.h: void ns3::FlowProbe::SerializeToXmlStream(std::ostream & os, int indent, uint32_t index) const [member function]
cls.add_method('SerializeToXmlStream',
'void',
[param('std::ostream &', 'os'), param('int', 'indent'), param('uint32_t', 'index')],
is_const=True)
## flow-probe.h: ns3::FlowProbe::FlowProbe(ns3::Ptr<ns3::FlowMonitor> flowMonitor) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::FlowMonitor >', 'flowMonitor')],
visibility='protected')
return
def register_Ns3FlowProbeFlowStats_methods(root_module, cls):
## flow-probe.h: ns3::FlowProbe::FlowStats::FlowStats(ns3::FlowProbe::FlowStats const & arg0) [copy constructor]
cls.add_constructor([param('ns3::FlowProbe::FlowStats const &', 'arg0')])
## flow-probe.h: ns3::FlowProbe::FlowStats::FlowStats() [constructor]
cls.add_constructor([])
## flow-probe.h: ns3::FlowProbe::FlowStats::bytes [variable]
cls.add_instance_attribute('bytes', 'uint64_t', is_const=False)
## flow-probe.h: ns3::FlowProbe::FlowStats::bytesDropped [variable]
cls.add_instance_attribute('bytesDropped', 'std::vector< unsigned long >', is_const=False)
## flow-probe.h: ns3::FlowProbe::FlowStats::delayFromFirstProbeSum [variable]
cls.add_instance_attribute('delayFromFirstProbeSum', 'ns3::Time', is_const=False)
## flow-probe.h: ns3::FlowProbe::FlowStats::packets [variable]
cls.add_instance_attribute('packets', 'uint32_t', is_const=False)
## flow-probe.h: ns3::FlowProbe::FlowStats::packetsDropped [variable]
cls.add_instance_attribute('packetsDropped', 'std::vector< unsigned int >', is_const=False)
return
def register_Ns3Ipv4FlowClassifier_methods(root_module, cls):
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::Ipv4FlowClassifier(ns3::Ipv4FlowClassifier const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4FlowClassifier const &', 'arg0')])
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::Ipv4FlowClassifier() [constructor]
cls.add_constructor([])
## ipv4-flow-classifier.h: bool ns3::Ipv4FlowClassifier::Classify(ns3::Ipv4Header const & ipHeader, ns3::Ptr<ns3::Packet const> ipPayload, uint32_t * out_flowId, uint32_t * out_packetId) [member function]
cls.add_method('Classify',
'bool',
[param('ns3::Ipv4Header const &', 'ipHeader'), param('ns3::Ptr< ns3::Packet const >', 'ipPayload'), param('uint32_t *', 'out_flowId'), param('uint32_t *', 'out_packetId')])
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::FiveTuple ns3::Ipv4FlowClassifier::FindFlow(ns3::FlowId flowId) const [member function]
cls.add_method('FindFlow',
'ns3::Ipv4FlowClassifier::FiveTuple',
[param('ns3::FlowId', 'flowId')],
is_const=True)
## ipv4-flow-classifier.h: void ns3::Ipv4FlowClassifier::SerializeToXmlStream(std::ostream & os, int indent) const [member function]
cls.add_method('SerializeToXmlStream',
'void',
[param('std::ostream &', 'os'), param('int', 'indent')],
is_const=True, is_virtual=True)
return
def register_Ns3Ipv4FlowClassifierFiveTuple_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('==')
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::FiveTuple::FiveTuple() [constructor]
cls.add_constructor([])
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::FiveTuple::FiveTuple(ns3::Ipv4FlowClassifier::FiveTuple const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4FlowClassifier::FiveTuple const &', 'arg0')])
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::FiveTuple::destinationAddress [variable]
cls.add_instance_attribute('destinationAddress', 'ns3::Ipv4Address', is_const=False)
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::FiveTuple::destinationPort [variable]
cls.add_instance_attribute('destinationPort', 'uint16_t', is_const=False)
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::FiveTuple::protocol [variable]
cls.add_instance_attribute('protocol', 'uint8_t', is_const=False)
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::FiveTuple::sourceAddress [variable]
cls.add_instance_attribute('sourceAddress', 'ns3::Ipv4Address', is_const=False)
## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::FiveTuple::sourcePort [variable]
cls.add_instance_attribute('sourcePort', 'uint16_t', is_const=False)
return
def register_Ns3Ipv4FlowProbe_methods(root_module, cls):
## ipv4-flow-probe.h: ns3::Ipv4FlowProbe::Ipv4FlowProbe(ns3::Ipv4FlowProbe const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4FlowProbe const &', 'arg0')])
## ipv4-flow-probe.h: ns3::Ipv4FlowProbe::Ipv4FlowProbe(ns3::Ptr<ns3::FlowMonitor> monitor, ns3::Ptr<ns3::Ipv4FlowClassifier> classifier, ns3::Ptr<ns3::Node> node) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::FlowMonitor >', 'monitor'), param('ns3::Ptr< ns3::Ipv4FlowClassifier >', 'classifier'), param('ns3::Ptr< ns3::Node >', 'node')])
return
def register_Ns3FlowMonitor_methods(root_module, cls):
## flow-monitor.h: ns3::FlowMonitor::FlowMonitor(ns3::FlowMonitor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::FlowMonitor const &', 'arg0')])
## flow-monitor.h: ns3::FlowMonitor::FlowMonitor() [constructor]
cls.add_constructor([])
## flow-monitor.h: void ns3::FlowMonitor::AddProbe(ns3::Ptr<ns3::FlowProbe> probe) [member function]
cls.add_method('AddProbe',
'void',
[param('ns3::Ptr< ns3::FlowProbe >', 'probe')])
## flow-monitor.h: void ns3::FlowMonitor::CheckForLostPackets() [member function]
cls.add_method('CheckForLostPackets',
'void',
[])
## flow-monitor.h: void ns3::FlowMonitor::CheckForLostPackets(ns3::Time maxDelay) [member function]
cls.add_method('CheckForLostPackets',
'void',
[param('ns3::Time', 'maxDelay')])
## flow-monitor.h: std::vector<ns3::Ptr<ns3::FlowProbe>, std::allocator<ns3::Ptr<ns3::FlowProbe> > > ns3::FlowMonitor::GetAllProbes() const [member function]
cls.add_method('GetAllProbes',
'std::vector< ns3::Ptr< ns3::FlowProbe > >',
[],
is_const=True)
## flow-monitor.h: std::map<unsigned int, ns3::FlowMonitor::FlowStats, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, ns3::FlowMonitor::FlowStats> > > ns3::FlowMonitor::GetFlowStats() const [member function]
cls.add_method('GetFlowStats',
'std::map< unsigned int, ns3::FlowMonitor::FlowStats >',
[],
is_const=True)
## flow-monitor.h: ns3::TypeId ns3::FlowMonitor::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## flow-monitor.h: static ns3::TypeId ns3::FlowMonitor::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## flow-monitor.h: void ns3::FlowMonitor::ReportDrop(ns3::Ptr<ns3::FlowProbe> probe, ns3::FlowId flowId, ns3::FlowPacketId packetId, uint32_t packetSize, uint32_t reasonCode) [member function]
cls.add_method('ReportDrop',
'void',
[param('ns3::Ptr< ns3::FlowProbe >', 'probe'), param('ns3::FlowId', 'flowId'), param('ns3::FlowPacketId', 'packetId'), param('uint32_t', 'packetSize'), param('uint32_t', 'reasonCode')])
## flow-monitor.h: void ns3::FlowMonitor::ReportFirstTx(ns3::Ptr<ns3::FlowProbe> probe, ns3::FlowId flowId, ns3::FlowPacketId packetId, uint32_t packetSize) [member function]
cls.add_method('ReportFirstTx',
'void',
[param('ns3::Ptr< ns3::FlowProbe >', 'probe'), param('ns3::FlowId', 'flowId'), param('ns3::FlowPacketId', 'packetId'), param('uint32_t', 'packetSize')])
## flow-monitor.h: void ns3::FlowMonitor::ReportForwarding(ns3::Ptr<ns3::FlowProbe> probe, ns3::FlowId flowId, ns3::FlowPacketId packetId, uint32_t packetSize) [member function]
cls.add_method('ReportForwarding',
'void',
[param('ns3::Ptr< ns3::FlowProbe >', 'probe'), param('ns3::FlowId', 'flowId'), param('ns3::FlowPacketId', 'packetId'), param('uint32_t', 'packetSize')])
## flow-monitor.h: void ns3::FlowMonitor::ReportLastRx(ns3::Ptr<ns3::FlowProbe> probe, ns3::FlowId flowId, ns3::FlowPacketId packetId, uint32_t packetSize) [member function]
cls.add_method('ReportLastRx',
'void',
[param('ns3::Ptr< ns3::FlowProbe >', 'probe'), param('ns3::FlowId', 'flowId'), param('ns3::FlowPacketId', 'packetId'), param('uint32_t', 'packetSize')])
## flow-monitor.h: void ns3::FlowMonitor::SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes) [member function]
cls.add_method('SerializeToXmlFile',
'void',
[param('std::string', 'fileName'), param('bool', 'enableHistograms'), param('bool', 'enableProbes')])
## flow-monitor.h: void ns3::FlowMonitor::SerializeToXmlStream(std::ostream & os, int indent, bool enableHistograms, bool enableProbes) [member function]
cls.add_method('SerializeToXmlStream',
'void',
[param('std::ostream &', 'os'), param('int', 'indent'), param('bool', 'enableHistograms'), param('bool', 'enableProbes')])
## flow-monitor.h: std::string ns3::FlowMonitor::SerializeToXmlString(int indent, bool enableHistograms, bool enableProbes) [member function]
cls.add_method('SerializeToXmlString',
'std::string',
[param('int', 'indent'), param('bool', 'enableHistograms'), param('bool', 'enableProbes')])
## flow-monitor.h: void ns3::FlowMonitor::SetFlowClassifier(ns3::Ptr<ns3::FlowClassifier> classifier) [member function]
cls.add_method('SetFlowClassifier',
'void',
[param('ns3::Ptr< ns3::FlowClassifier >', 'classifier')])
## flow-monitor.h: void ns3::FlowMonitor::Start(ns3::Time const & time) [member function]
cls.add_method('Start',
'void',
[param('ns3::Time const &', 'time')])
## flow-monitor.h: void ns3::FlowMonitor::StartRightNow() [member function]
cls.add_method('StartRightNow',
'void',
[])
## flow-monitor.h: void ns3::FlowMonitor::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')])
## flow-monitor.h: void ns3::FlowMonitor::StopRightNow() [member function]
cls.add_method('StopRightNow',
'void',
[])
## flow-monitor.h: void ns3::FlowMonitor::NotifyConstructionCompleted() [member function]
cls.add_method('NotifyConstructionCompleted',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3FlowMonitorFlowStats_methods(root_module, cls):
## flow-monitor.h: ns3::FlowMonitor::FlowStats::FlowStats() [constructor]
cls.add_constructor([])
## flow-monitor.h: ns3::FlowMonitor::FlowStats::FlowStats(ns3::FlowMonitor::FlowStats const & arg0) [copy constructor]
cls.add_constructor([param('ns3::FlowMonitor::FlowStats const &', 'arg0')])
## flow-monitor.h: ns3::FlowMonitor::FlowStats::bytesDropped [variable]
cls.add_instance_attribute('bytesDropped', 'std::vector< unsigned long >', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::delayHistogram [variable]
cls.add_instance_attribute('delayHistogram', 'ns3::Histogram', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::delaySum [variable]
cls.add_instance_attribute('delaySum', 'ns3::Time', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::jitterHistogram [variable]
cls.add_instance_attribute('jitterHistogram', 'ns3::Histogram', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::jitterSum [variable]
cls.add_instance_attribute('jitterSum', 'ns3::Time', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::lastDelay [variable]
cls.add_instance_attribute('lastDelay', 'ns3::Time', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::lostPackets [variable]
cls.add_instance_attribute('lostPackets', 'uint32_t', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::packetSizeHistogram [variable]
cls.add_instance_attribute('packetSizeHistogram', 'ns3::Histogram', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::packetsDropped [variable]
cls.add_instance_attribute('packetsDropped', 'std::vector< unsigned int >', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::rxBytes [variable]
cls.add_instance_attribute('rxBytes', 'uint64_t', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::rxPackets [variable]
cls.add_instance_attribute('rxPackets', 'uint32_t', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::timeFirstRxPacket [variable]
cls.add_instance_attribute('timeFirstRxPacket', 'ns3::Time', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::timeFirstTxPacket [variable]
cls.add_instance_attribute('timeFirstTxPacket', 'ns3::Time', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::timeLastRxPacket [variable]
cls.add_instance_attribute('timeLastRxPacket', 'ns3::Time', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::timeLastTxPacket [variable]
cls.add_instance_attribute('timeLastTxPacket', 'ns3::Time', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::timesForwarded [variable]
cls.add_instance_attribute('timesForwarded', 'uint32_t', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::txBytes [variable]
cls.add_instance_attribute('txBytes', 'uint64_t', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::txPackets [variable]
cls.add_instance_attribute('txPackets', 'uint32_t', is_const=False)
return
def register_functions(root_module):
module = root_module
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_dot11s(module.get_submodule('dot11s'), root_module)
register_functions_ns3_flame(module.get_submodule('flame'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
return
def register_functions_ns3_Config(module, root_module):
return
def register_functions_ns3_TimeStepPrecision(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_dot11s(module, root_module):
return
def register_functions_ns3_flame(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return
def register_functions_ns3_olsr(module, root_module):
return

View File

@@ -13,6 +13,8 @@ def register_types(module):
module.add_class('CsmaHelper', allow_subclassing=False)
## emu-helper.h: ns3::EmuHelper [class]
module.add_class('EmuHelper', allow_subclassing=False)
## flow-monitor-helper.h: ns3::FlowMonitorHelper [class]
module.add_class('FlowMonitorHelper', allow_subclassing=False)
## internet-stack-helper.h: ns3::InternetStackHelper [class]
module.add_class('InternetStackHelper', allow_subclassing=False)
## ipv4-address-helper.h: ns3::Ipv4AddressHelper [class]
@@ -170,6 +172,7 @@ def register_methods(root_module):
register_Ns3BridgeHelper_methods(root_module, root_module['ns3::BridgeHelper'])
register_Ns3CsmaHelper_methods(root_module, root_module['ns3::CsmaHelper'])
register_Ns3EmuHelper_methods(root_module, root_module['ns3::EmuHelper'])
register_Ns3FlowMonitorHelper_methods(root_module, root_module['ns3::FlowMonitorHelper'])
register_Ns3InternetStackHelper_methods(root_module, root_module['ns3::InternetStackHelper'])
register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
@@ -505,6 +508,37 @@ def register_Ns3EmuHelper_methods(root_module, cls):
[param('std::string', 'type'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()')])
return
def register_Ns3FlowMonitorHelper_methods(root_module, cls):
## flow-monitor-helper.h: ns3::FlowMonitorHelper::FlowMonitorHelper(ns3::FlowMonitorHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::FlowMonitorHelper const &', 'arg0')])
## flow-monitor-helper.h: ns3::FlowMonitorHelper::FlowMonitorHelper() [constructor]
cls.add_constructor([])
## flow-monitor-helper.h: ns3::Ptr<ns3::FlowClassifier> ns3::FlowMonitorHelper::GetClassifier() [member function]
cls.add_method('GetClassifier',
'ns3::Ptr< ns3::FlowClassifier >',
[])
## flow-monitor-helper.h: ns3::Ptr<ns3::FlowMonitor> ns3::FlowMonitorHelper::GetMonitor() [member function]
cls.add_method('GetMonitor',
'ns3::Ptr< ns3::FlowMonitor >',
[])
## flow-monitor-helper.h: ns3::Ptr<ns3::FlowMonitor> ns3::FlowMonitorHelper::Install(ns3::NodeContainer nodes) [member function]
cls.add_method('Install',
'ns3::Ptr< ns3::FlowMonitor >',
[param('ns3::NodeContainer', 'nodes')])
## flow-monitor-helper.h: ns3::Ptr<ns3::FlowMonitor> ns3::FlowMonitorHelper::Install(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('Install',
'ns3::Ptr< ns3::FlowMonitor >',
[param('ns3::Ptr< ns3::Node >', 'node')])
## flow-monitor-helper.h: ns3::Ptr<ns3::FlowMonitor> ns3::FlowMonitorHelper::InstallAll() [member function]
cls.add_method('InstallAll',
'ns3::Ptr< ns3::FlowMonitor >',
[])
## flow-monitor-helper.h: void ns3::FlowMonitorHelper::SetMonitorAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
cls.add_method('SetMonitorAttribute',
'void',
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
return
def register_Ns3InternetStackHelper_methods(root_module, cls):
## internet-stack-helper.h: ns3::InternetStackHelper::InternetStackHelper(ns3::InternetStackHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::InternetStackHelper const &', 'arg0')])

View File

@@ -73,10 +73,16 @@ def register_types(module):
module.add_class('Icmpv6Echo', parent=root_module['ns3::Icmpv6Header'])
## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol [class]
module.add_class('Ipv4L3Protocol', parent=root_module['ns3::Ipv4'])
## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol::DropReason [enumeration]
module.add_enum('DropReason', ['DROP_TTL_EXPIRED', 'DROP_NO_ROUTE', 'DROP_BAD_CHECKSUM', 'DROP_INTERFACE_DOWN', 'DROP_ROUTE_ERROR'], outer_class=root_module['ns3::Ipv4L3Protocol'])
## ipv4-l4-protocol.h: ns3::Ipv4L4Protocol [class]
module.add_class('Ipv4L4Protocol', parent=root_module['ns3::Object'])
## ipv4-l4-protocol.h: ns3::Ipv4L4Protocol::RxStatus [enumeration]
module.add_enum('RxStatus', ['RX_OK', 'RX_CSUM_FAILED', 'RX_ENDPOINT_UNREACH'], outer_class=root_module['ns3::Ipv4L4Protocol'])
## ipv6-l3-protocol.h: ns3::Ipv6L3Protocol [class]
module.add_class('Ipv6L3Protocol', parent=root_module['ns3::Ipv6'])
## ipv6-l3-protocol.h: ns3::Ipv6L3Protocol::DropReason [enumeration]
module.add_enum('DropReason', ['DROP_TTL_EXPIRED', 'DROP_NO_ROUTE', 'DROP_BAD_CHECKSUM', 'DROP_INTERFACE_DOWN', 'DROP_ROUTE_ERROR'], outer_class=root_module['ns3::Ipv6L3Protocol'])
## tcp-l4-protocol.h: ns3::TcpL4Protocol [class]
module.add_class('TcpL4Protocol', parent=root_module['ns3::Ipv4L4Protocol'])
## udp-l4-protocol.h: ns3::UdpL4Protocol [class]
@@ -182,6 +188,7 @@ def register_methods(root_module):
register_Ns3Icmpv6Echo_methods(root_module, root_module['ns3::Icmpv6Echo'])
register_Ns3Ipv4L3Protocol_methods(root_module, root_module['ns3::Ipv4L3Protocol'])
register_Ns3Ipv4L4Protocol_methods(root_module, root_module['ns3::Ipv4L4Protocol'])
register_Ns3Ipv6L3Protocol_methods(root_module, root_module['ns3::Ipv6L3Protocol'])
register_Ns3TcpL4Protocol_methods(root_module, root_module['ns3::TcpL4Protocol'])
register_Ns3UdpL4Protocol_methods(root_module, root_module['ns3::UdpL4Protocol'])
register_Ns3Icmpv4L4Protocol_methods(root_module, root_module['ns3::Icmpv4L4Protocol'])
@@ -1996,6 +2003,193 @@ def register_Ns3Ipv4L4Protocol_methods(root_module, cls):
is_virtual=True)
return
def register_Ns3Ipv6L3Protocol_methods(root_module, cls):
## ipv6-l3-protocol.h: ns3::Ipv6L3Protocol::PROT_NUMBER [variable]
cls.add_static_attribute('PROT_NUMBER', 'uint16_t const', is_const=True)
## ipv6-l3-protocol.h: static ns3::TypeId ns3::Ipv6L3Protocol::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv6-l3-protocol.h: ns3::Ipv6L3Protocol::Ipv6L3Protocol() [constructor]
cls.add_constructor([])
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::Insert(ns3::Ptr<ns3::Ipv6L4Protocol> protocol) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Ptr< ns3::Ipv6L4Protocol >', 'protocol')])
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::Remove(ns3::Ptr<ns3::Ipv6L4Protocol> protocol) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Ptr< ns3::Ipv6L4Protocol >', 'protocol')])
## ipv6-l3-protocol.h: ns3::Ptr<ns3::Ipv6L4Protocol> ns3::Ipv6L3Protocol::GetProtocol(int protocolNumber) const [member function]
cls.add_method('GetProtocol',
'ns3::Ptr< ns3::Ipv6L4Protocol >',
[param('int', 'protocolNumber')],
is_const=True)
## ipv6-l3-protocol.h: ns3::Ptr<ns3::Socket> ns3::Ipv6L3Protocol::CreateRawSocket() [member function]
cls.add_method('CreateRawSocket',
'ns3::Ptr< ns3::Socket >',
[])
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::DeleteRawSocket(ns3::Ptr<ns3::Socket> socket) [member function]
cls.add_method('DeleteRawSocket',
'void',
[param('ns3::Ptr< ns3::Socket >', 'socket')])
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::SetDefaultTtl(uint8_t ttl) [member function]
cls.add_method('SetDefaultTtl',
'void',
[param('uint8_t', 'ttl')])
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::Receive(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<ns3::Packet const> p, uint16_t protocol, ns3::Address const & from, ns3::Address const & to, ns3::NetDevice::PacketType packetType) [member function]
cls.add_method('Receive',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'p'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'from'), param('ns3::Address const &', 'to'), param('ns3::NetDevice::PacketType', 'packetType')])
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::Send(ns3::Ptr<ns3::Packet> packet, ns3::Ipv6Address source, ns3::Ipv6Address destination, uint8_t protocol, ns3::Ptr<ns3::Ipv6Route> route) [member function]
cls.add_method('Send',
'void',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Ipv6Address', 'source'), param('ns3::Ipv6Address', 'destination'), param('uint8_t', 'protocol'), param('ns3::Ptr< ns3::Ipv6Route >', 'route')])
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::SetRoutingProtocol(ns3::Ptr<ns3::Ipv6RoutingProtocol> routingProtocol) [member function]
cls.add_method('SetRoutingProtocol',
'void',
[param('ns3::Ptr< ns3::Ipv6RoutingProtocol >', 'routingProtocol')],
is_virtual=True)
## ipv6-l3-protocol.h: ns3::Ptr<ns3::Ipv6RoutingProtocol> ns3::Ipv6L3Protocol::GetRoutingProtocol() const [member function]
cls.add_method('GetRoutingProtocol',
'ns3::Ptr< ns3::Ipv6RoutingProtocol >',
[],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: uint32_t ns3::Ipv6L3Protocol::AddInterface(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('AddInterface',
'uint32_t',
[param('ns3::Ptr< ns3::NetDevice >', 'device')],
is_virtual=True)
## ipv6-l3-protocol.h: ns3::Ptr<ns3::Ipv6Interface> ns3::Ipv6L3Protocol::GetInterface(uint32_t i) const [member function]
cls.add_method('GetInterface',
'ns3::Ptr< ns3::Ipv6Interface >',
[param('uint32_t', 'i')],
is_const=True)
## ipv6-l3-protocol.h: uint32_t ns3::Ipv6L3Protocol::GetNInterfaces() const [member function]
cls.add_method('GetNInterfaces',
'uint32_t',
[],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: int32_t ns3::Ipv6L3Protocol::GetInterfaceForAddress(ns3::Ipv6Address addr) const [member function]
cls.add_method('GetInterfaceForAddress',
'int32_t',
[param('ns3::Ipv6Address', 'addr')],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: int32_t ns3::Ipv6L3Protocol::GetInterfaceForPrefix(ns3::Ipv6Address addr, ns3::Ipv6Prefix mask) const [member function]
cls.add_method('GetInterfaceForPrefix',
'int32_t',
[param('ns3::Ipv6Address', 'addr'), param('ns3::Ipv6Prefix', 'mask')],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: int32_t ns3::Ipv6L3Protocol::GetInterfaceForDevice(ns3::Ptr<const ns3::NetDevice> device) const [member function]
cls.add_method('GetInterfaceForDevice',
'int32_t',
[param('ns3::Ptr< ns3::NetDevice const >', 'device')],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: bool ns3::Ipv6L3Protocol::AddAddress(uint32_t i, ns3::Ipv6InterfaceAddress address) [member function]
cls.add_method('AddAddress',
'bool',
[param('uint32_t', 'i'), param('ns3::Ipv6InterfaceAddress', 'address')],
is_virtual=True)
## ipv6-l3-protocol.h: ns3::Ipv6InterfaceAddress ns3::Ipv6L3Protocol::GetAddress(uint32_t interfaceIndex, uint32_t addressIndex) const [member function]
cls.add_method('GetAddress',
'ns3::Ipv6InterfaceAddress',
[param('uint32_t', 'interfaceIndex'), param('uint32_t', 'addressIndex')],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: uint32_t ns3::Ipv6L3Protocol::GetNAddresses(uint32_t interface) const [member function]
cls.add_method('GetNAddresses',
'uint32_t',
[param('uint32_t', 'interface')],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: bool ns3::Ipv6L3Protocol::RemoveAddress(uint32_t interfaceIndex, uint32_t addressIndex) [member function]
cls.add_method('RemoveAddress',
'bool',
[param('uint32_t', 'interfaceIndex'), param('uint32_t', 'addressIndex')],
is_virtual=True)
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::SetMetric(uint32_t i, uint16_t metric) [member function]
cls.add_method('SetMetric',
'void',
[param('uint32_t', 'i'), param('uint16_t', 'metric')],
is_virtual=True)
## ipv6-l3-protocol.h: uint16_t ns3::Ipv6L3Protocol::GetMetric(uint32_t i) const [member function]
cls.add_method('GetMetric',
'uint16_t',
[param('uint32_t', 'i')],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: uint16_t ns3::Ipv6L3Protocol::GetMtu(uint32_t i) const [member function]
cls.add_method('GetMtu',
'uint16_t',
[param('uint32_t', 'i')],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: bool ns3::Ipv6L3Protocol::IsUp(uint32_t i) const [member function]
cls.add_method('IsUp',
'bool',
[param('uint32_t', 'i')],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::SetUp(uint32_t i) [member function]
cls.add_method('SetUp',
'void',
[param('uint32_t', 'i')],
is_virtual=True)
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::SetDown(uint32_t i) [member function]
cls.add_method('SetDown',
'void',
[param('uint32_t', 'i')],
is_virtual=True)
## ipv6-l3-protocol.h: bool ns3::Ipv6L3Protocol::IsForwarding(uint32_t i) const [member function]
cls.add_method('IsForwarding',
'bool',
[param('uint32_t', 'i')],
is_const=True, is_virtual=True)
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::SetForwarding(uint32_t i, bool val) [member function]
cls.add_method('SetForwarding',
'void',
[param('uint32_t', 'i'), param('bool', 'val')],
is_virtual=True)
## ipv6-l3-protocol.h: ns3::Ptr<ns3::NetDevice> ns3::Ipv6L3Protocol::GetNetDevice(uint32_t i) [member function]
cls.add_method('GetNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'i')],
is_virtual=True)
## ipv6-l3-protocol.h: ns3::Ptr<ns3::Icmpv6L4Protocol> ns3::Ipv6L3Protocol::GetIcmpv6() const [member function]
cls.add_method('GetIcmpv6',
'ns3::Ptr< ns3::Icmpv6L4Protocol >',
[],
is_const=True)
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::AddAutoconfiguredAddress(uint32_t interface, ns3::Ipv6Address network, ns3::Ipv6Prefix mask, uint8_t flags, uint32_t validTime, uint32_t preferredTime, ns3::Ipv6Address defaultRouter=ns3::Ipv6Address::GetZero( )) [member function]
cls.add_method('AddAutoconfiguredAddress',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'mask'), param('uint8_t', 'flags'), param('uint32_t', 'validTime'), param('uint32_t', 'preferredTime'), param('ns3::Ipv6Address', 'defaultRouter', default_value='ns3::Ipv6Address::GetZero( )')])
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::RemoveAutoconfiguredAddress(uint32_t interface, ns3::Ipv6Address network, ns3::Ipv6Prefix mask, ns3::Ipv6Address defaultRouter) [member function]
cls.add_method('RemoveAutoconfiguredAddress',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'mask'), param('ns3::Ipv6Address', 'defaultRouter')])
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
## ipv6-l3-protocol.h: void ns3::Ipv6L3Protocol::SetIpForward(bool forward) [member function]
cls.add_method('SetIpForward',
'void',
[param('bool', 'forward')],
visibility='private', is_virtual=True)
## ipv6-l3-protocol.h: bool ns3::Ipv6L3Protocol::GetIpForward() const [member function]
cls.add_method('GetIpForward',
'bool',
[],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3TcpL4Protocol_methods(root_module, cls):
## tcp-l4-protocol.h: ns3::TcpL4Protocol::PROT_NUMBER [variable]
cls.add_static_attribute('PROT_NUMBER', 'uint8_t const', is_const=True)

View File

@@ -16,27 +16,28 @@ import ns3_module_core
import ns3_module_simulator
import ns3_module_mobility
import ns3_module_common
import ns3_module_contrib
import ns3_module_node
import ns3_module_tap_bridge
import ns3_module_v4ping
import ns3_module_static_routing
import ns3_module_packet_sink
import ns3_module_stats
import ns3_module_onoff
import ns3_module_contrib
import ns3_module_point_to_point
import ns3_module_internet_stack
import ns3_module_tap_bridge
import ns3_module_csma
import ns3_module_list_routing
import ns3_module_virtual_net_device
import ns3_module_wifi
import ns3_module_static_routing
import ns3_module_v4ping
import ns3_module_virtual_net_device
import ns3_module_packet_sink
import ns3_module_global_routing
import ns3_module_stats
import ns3_module_list_routing
import ns3_module_emu
import ns3_module_bridge
import ns3_module_global_routing
import ns3_module_onoff
import ns3_module_udp_echo
import ns3_module_olsr
import ns3_module_radvd
import ns3_module_ping6
import ns3_module_olsr
import ns3_module_flow_monitor
import ns3_module_radvd
import ns3_module_mesh
import ns3_module_helper
import ns3_module_dot11s
@@ -93,17 +94,6 @@ def register_types(module):
ns3_module_common__local.register_types(module)
root_module.end_section('ns3_module_common')
root_module.begin_section('ns3_module_contrib')
ns3_module_contrib.register_types(module)
try:
import ns3_module_contrib__local
except ImportError:
pass
else:
ns3_module_contrib__local.register_types(module)
root_module.end_section('ns3_module_contrib')
root_module.begin_section('ns3_module_node')
ns3_module_node.register_types(module)
@@ -115,72 +105,17 @@ def register_types(module):
ns3_module_node__local.register_types(module)
root_module.end_section('ns3_module_node')
root_module.begin_section('ns3_module_tap_bridge')
ns3_module_tap_bridge.register_types(module)
root_module.begin_section('ns3_module_contrib')
ns3_module_contrib.register_types(module)
try:
import ns3_module_tap_bridge__local
import ns3_module_contrib__local
except ImportError:
pass
else:
ns3_module_tap_bridge__local.register_types(module)
ns3_module_contrib__local.register_types(module)
root_module.end_section('ns3_module_tap_bridge')
root_module.begin_section('ns3_module_v4ping')
ns3_module_v4ping.register_types(module)
try:
import ns3_module_v4ping__local
except ImportError:
pass
else:
ns3_module_v4ping__local.register_types(module)
root_module.end_section('ns3_module_v4ping')
root_module.begin_section('ns3_module_static_routing')
ns3_module_static_routing.register_types(module)
try:
import ns3_module_static_routing__local
except ImportError:
pass
else:
ns3_module_static_routing__local.register_types(module)
root_module.end_section('ns3_module_static_routing')
root_module.begin_section('ns3_module_packet_sink')
ns3_module_packet_sink.register_types(module)
try:
import ns3_module_packet_sink__local
except ImportError:
pass
else:
ns3_module_packet_sink__local.register_types(module)
root_module.end_section('ns3_module_packet_sink')
root_module.begin_section('ns3_module_stats')
ns3_module_stats.register_types(module)
try:
import ns3_module_stats__local
except ImportError:
pass
else:
ns3_module_stats__local.register_types(module)
root_module.end_section('ns3_module_stats')
root_module.begin_section('ns3_module_onoff')
ns3_module_onoff.register_types(module)
try:
import ns3_module_onoff__local
except ImportError:
pass
else:
ns3_module_onoff__local.register_types(module)
root_module.end_section('ns3_module_onoff')
root_module.end_section('ns3_module_contrib')
root_module.begin_section('ns3_module_point_to_point')
ns3_module_point_to_point.register_types(module)
@@ -203,6 +138,17 @@ def register_types(module):
ns3_module_internet_stack__local.register_types(module)
root_module.end_section('ns3_module_internet_stack')
root_module.begin_section('ns3_module_tap_bridge')
ns3_module_tap_bridge.register_types(module)
try:
import ns3_module_tap_bridge__local
except ImportError:
pass
else:
ns3_module_tap_bridge__local.register_types(module)
root_module.end_section('ns3_module_tap_bridge')
root_module.begin_section('ns3_module_csma')
ns3_module_csma.register_types(module)
@@ -214,28 +160,6 @@ def register_types(module):
ns3_module_csma__local.register_types(module)
root_module.end_section('ns3_module_csma')
root_module.begin_section('ns3_module_list_routing')
ns3_module_list_routing.register_types(module)
try:
import ns3_module_list_routing__local
except ImportError:
pass
else:
ns3_module_list_routing__local.register_types(module)
root_module.end_section('ns3_module_list_routing')
root_module.begin_section('ns3_module_virtual_net_device')
ns3_module_virtual_net_device.register_types(module)
try:
import ns3_module_virtual_net_device__local
except ImportError:
pass
else:
ns3_module_virtual_net_device__local.register_types(module)
root_module.end_section('ns3_module_virtual_net_device')
root_module.begin_section('ns3_module_wifi')
ns3_module_wifi.register_types(module)
@@ -247,6 +171,83 @@ def register_types(module):
ns3_module_wifi__local.register_types(module)
root_module.end_section('ns3_module_wifi')
root_module.begin_section('ns3_module_static_routing')
ns3_module_static_routing.register_types(module)
try:
import ns3_module_static_routing__local
except ImportError:
pass
else:
ns3_module_static_routing__local.register_types(module)
root_module.end_section('ns3_module_static_routing')
root_module.begin_section('ns3_module_v4ping')
ns3_module_v4ping.register_types(module)
try:
import ns3_module_v4ping__local
except ImportError:
pass
else:
ns3_module_v4ping__local.register_types(module)
root_module.end_section('ns3_module_v4ping')
root_module.begin_section('ns3_module_virtual_net_device')
ns3_module_virtual_net_device.register_types(module)
try:
import ns3_module_virtual_net_device__local
except ImportError:
pass
else:
ns3_module_virtual_net_device__local.register_types(module)
root_module.end_section('ns3_module_virtual_net_device')
root_module.begin_section('ns3_module_packet_sink')
ns3_module_packet_sink.register_types(module)
try:
import ns3_module_packet_sink__local
except ImportError:
pass
else:
ns3_module_packet_sink__local.register_types(module)
root_module.end_section('ns3_module_packet_sink')
root_module.begin_section('ns3_module_global_routing')
ns3_module_global_routing.register_types(module)
try:
import ns3_module_global_routing__local
except ImportError:
pass
else:
ns3_module_global_routing__local.register_types(module)
root_module.end_section('ns3_module_global_routing')
root_module.begin_section('ns3_module_stats')
ns3_module_stats.register_types(module)
try:
import ns3_module_stats__local
except ImportError:
pass
else:
ns3_module_stats__local.register_types(module)
root_module.end_section('ns3_module_stats')
root_module.begin_section('ns3_module_list_routing')
ns3_module_list_routing.register_types(module)
try:
import ns3_module_list_routing__local
except ImportError:
pass
else:
ns3_module_list_routing__local.register_types(module)
root_module.end_section('ns3_module_list_routing')
root_module.begin_section('ns3_module_emu')
ns3_module_emu.register_types(module)
@@ -269,17 +270,17 @@ def register_types(module):
ns3_module_bridge__local.register_types(module)
root_module.end_section('ns3_module_bridge')
root_module.begin_section('ns3_module_global_routing')
ns3_module_global_routing.register_types(module)
root_module.begin_section('ns3_module_onoff')
ns3_module_onoff.register_types(module)
try:
import ns3_module_global_routing__local
import ns3_module_onoff__local
except ImportError:
pass
else:
ns3_module_global_routing__local.register_types(module)
ns3_module_onoff__local.register_types(module)
root_module.end_section('ns3_module_global_routing')
root_module.end_section('ns3_module_onoff')
root_module.begin_section('ns3_module_udp_echo')
ns3_module_udp_echo.register_types(module)
@@ -291,28 +292,6 @@ def register_types(module):
ns3_module_udp_echo__local.register_types(module)
root_module.end_section('ns3_module_udp_echo')
root_module.begin_section('ns3_module_olsr')
ns3_module_olsr.register_types(module)
try:
import ns3_module_olsr__local
except ImportError:
pass
else:
ns3_module_olsr__local.register_types(module)
root_module.end_section('ns3_module_olsr')
root_module.begin_section('ns3_module_radvd')
ns3_module_radvd.register_types(module)
try:
import ns3_module_radvd__local
except ImportError:
pass
else:
ns3_module_radvd__local.register_types(module)
root_module.end_section('ns3_module_radvd')
root_module.begin_section('ns3_module_ping6')
ns3_module_ping6.register_types(module)
@@ -324,6 +303,39 @@ def register_types(module):
ns3_module_ping6__local.register_types(module)
root_module.end_section('ns3_module_ping6')
root_module.begin_section('ns3_module_olsr')
ns3_module_olsr.register_types(module)
try:
import ns3_module_olsr__local
except ImportError:
pass
else:
ns3_module_olsr__local.register_types(module)
root_module.end_section('ns3_module_olsr')
root_module.begin_section('ns3_module_flow_monitor')
ns3_module_flow_monitor.register_types(module)
try:
import ns3_module_flow_monitor__local
except ImportError:
pass
else:
ns3_module_flow_monitor__local.register_types(module)
root_module.end_section('ns3_module_flow_monitor')
root_module.begin_section('ns3_module_radvd')
ns3_module_radvd.register_types(module)
try:
import ns3_module_radvd__local
except ImportError:
pass
else:
ns3_module_radvd__local.register_types(module)
root_module.end_section('ns3_module_radvd')
root_module.begin_section('ns3_module_mesh')
ns3_module_mesh.register_types(module)
@@ -370,6 +382,7 @@ def register_types(module):
root_module.end_section('ns3_module_flame')
module.add_container('std::vector< unsigned int >', 'unsigned int', container_type='vector')
module.add_container('std::vector< bool >', 'bool', container_type='vector')
module.add_container('std::vector< unsigned long >', 'long unsigned int', container_type='vector')
module.add_container('std::list< unsigned int >', 'unsigned int', container_type='list')
module.add_container('std::list< std::pair< ns3::Ptr< ns3::Packet >, ns3::AmsduSubframeHeader > >', 'std::pair< ns3::Ptr< ns3::Packet >, ns3::AmsduSubframeHeader >', container_type='list')
@@ -489,17 +502,6 @@ def register_methods(root_module):
ns3_module_common__local.register_methods(root_module)
root_module.end_section('ns3_module_common')
root_module.begin_section('ns3_module_contrib')
ns3_module_contrib.register_methods(root_module)
try:
import ns3_module_contrib__local
except ImportError:
pass
else:
ns3_module_contrib__local.register_methods(root_module)
root_module.end_section('ns3_module_contrib')
root_module.begin_section('ns3_module_node')
ns3_module_node.register_methods(root_module)
@@ -511,72 +513,17 @@ def register_methods(root_module):
ns3_module_node__local.register_methods(root_module)
root_module.end_section('ns3_module_node')
root_module.begin_section('ns3_module_tap_bridge')
ns3_module_tap_bridge.register_methods(root_module)
root_module.begin_section('ns3_module_contrib')
ns3_module_contrib.register_methods(root_module)
try:
import ns3_module_tap_bridge__local
import ns3_module_contrib__local
except ImportError:
pass
else:
ns3_module_tap_bridge__local.register_methods(root_module)
ns3_module_contrib__local.register_methods(root_module)
root_module.end_section('ns3_module_tap_bridge')
root_module.begin_section('ns3_module_v4ping')
ns3_module_v4ping.register_methods(root_module)
try:
import ns3_module_v4ping__local
except ImportError:
pass
else:
ns3_module_v4ping__local.register_methods(root_module)
root_module.end_section('ns3_module_v4ping')
root_module.begin_section('ns3_module_static_routing')
ns3_module_static_routing.register_methods(root_module)
try:
import ns3_module_static_routing__local
except ImportError:
pass
else:
ns3_module_static_routing__local.register_methods(root_module)
root_module.end_section('ns3_module_static_routing')
root_module.begin_section('ns3_module_packet_sink')
ns3_module_packet_sink.register_methods(root_module)
try:
import ns3_module_packet_sink__local
except ImportError:
pass
else:
ns3_module_packet_sink__local.register_methods(root_module)
root_module.end_section('ns3_module_packet_sink')
root_module.begin_section('ns3_module_stats')
ns3_module_stats.register_methods(root_module)
try:
import ns3_module_stats__local
except ImportError:
pass
else:
ns3_module_stats__local.register_methods(root_module)
root_module.end_section('ns3_module_stats')
root_module.begin_section('ns3_module_onoff')
ns3_module_onoff.register_methods(root_module)
try:
import ns3_module_onoff__local
except ImportError:
pass
else:
ns3_module_onoff__local.register_methods(root_module)
root_module.end_section('ns3_module_onoff')
root_module.end_section('ns3_module_contrib')
root_module.begin_section('ns3_module_point_to_point')
ns3_module_point_to_point.register_methods(root_module)
@@ -599,6 +546,17 @@ def register_methods(root_module):
ns3_module_internet_stack__local.register_methods(root_module)
root_module.end_section('ns3_module_internet_stack')
root_module.begin_section('ns3_module_tap_bridge')
ns3_module_tap_bridge.register_methods(root_module)
try:
import ns3_module_tap_bridge__local
except ImportError:
pass
else:
ns3_module_tap_bridge__local.register_methods(root_module)
root_module.end_section('ns3_module_tap_bridge')
root_module.begin_section('ns3_module_csma')
ns3_module_csma.register_methods(root_module)
@@ -610,28 +568,6 @@ def register_methods(root_module):
ns3_module_csma__local.register_methods(root_module)
root_module.end_section('ns3_module_csma')
root_module.begin_section('ns3_module_list_routing')
ns3_module_list_routing.register_methods(root_module)
try:
import ns3_module_list_routing__local
except ImportError:
pass
else:
ns3_module_list_routing__local.register_methods(root_module)
root_module.end_section('ns3_module_list_routing')
root_module.begin_section('ns3_module_virtual_net_device')
ns3_module_virtual_net_device.register_methods(root_module)
try:
import ns3_module_virtual_net_device__local
except ImportError:
pass
else:
ns3_module_virtual_net_device__local.register_methods(root_module)
root_module.end_section('ns3_module_virtual_net_device')
root_module.begin_section('ns3_module_wifi')
ns3_module_wifi.register_methods(root_module)
@@ -643,6 +579,83 @@ def register_methods(root_module):
ns3_module_wifi__local.register_methods(root_module)
root_module.end_section('ns3_module_wifi')
root_module.begin_section('ns3_module_static_routing')
ns3_module_static_routing.register_methods(root_module)
try:
import ns3_module_static_routing__local
except ImportError:
pass
else:
ns3_module_static_routing__local.register_methods(root_module)
root_module.end_section('ns3_module_static_routing')
root_module.begin_section('ns3_module_v4ping')
ns3_module_v4ping.register_methods(root_module)
try:
import ns3_module_v4ping__local
except ImportError:
pass
else:
ns3_module_v4ping__local.register_methods(root_module)
root_module.end_section('ns3_module_v4ping')
root_module.begin_section('ns3_module_virtual_net_device')
ns3_module_virtual_net_device.register_methods(root_module)
try:
import ns3_module_virtual_net_device__local
except ImportError:
pass
else:
ns3_module_virtual_net_device__local.register_methods(root_module)
root_module.end_section('ns3_module_virtual_net_device')
root_module.begin_section('ns3_module_packet_sink')
ns3_module_packet_sink.register_methods(root_module)
try:
import ns3_module_packet_sink__local
except ImportError:
pass
else:
ns3_module_packet_sink__local.register_methods(root_module)
root_module.end_section('ns3_module_packet_sink')
root_module.begin_section('ns3_module_global_routing')
ns3_module_global_routing.register_methods(root_module)
try:
import ns3_module_global_routing__local
except ImportError:
pass
else:
ns3_module_global_routing__local.register_methods(root_module)
root_module.end_section('ns3_module_global_routing')
root_module.begin_section('ns3_module_stats')
ns3_module_stats.register_methods(root_module)
try:
import ns3_module_stats__local
except ImportError:
pass
else:
ns3_module_stats__local.register_methods(root_module)
root_module.end_section('ns3_module_stats')
root_module.begin_section('ns3_module_list_routing')
ns3_module_list_routing.register_methods(root_module)
try:
import ns3_module_list_routing__local
except ImportError:
pass
else:
ns3_module_list_routing__local.register_methods(root_module)
root_module.end_section('ns3_module_list_routing')
root_module.begin_section('ns3_module_emu')
ns3_module_emu.register_methods(root_module)
@@ -665,17 +678,17 @@ def register_methods(root_module):
ns3_module_bridge__local.register_methods(root_module)
root_module.end_section('ns3_module_bridge')
root_module.begin_section('ns3_module_global_routing')
ns3_module_global_routing.register_methods(root_module)
root_module.begin_section('ns3_module_onoff')
ns3_module_onoff.register_methods(root_module)
try:
import ns3_module_global_routing__local
import ns3_module_onoff__local
except ImportError:
pass
else:
ns3_module_global_routing__local.register_methods(root_module)
ns3_module_onoff__local.register_methods(root_module)
root_module.end_section('ns3_module_global_routing')
root_module.end_section('ns3_module_onoff')
root_module.begin_section('ns3_module_udp_echo')
ns3_module_udp_echo.register_methods(root_module)
@@ -687,28 +700,6 @@ def register_methods(root_module):
ns3_module_udp_echo__local.register_methods(root_module)
root_module.end_section('ns3_module_udp_echo')
root_module.begin_section('ns3_module_olsr')
ns3_module_olsr.register_methods(root_module)
try:
import ns3_module_olsr__local
except ImportError:
pass
else:
ns3_module_olsr__local.register_methods(root_module)
root_module.end_section('ns3_module_olsr')
root_module.begin_section('ns3_module_radvd')
ns3_module_radvd.register_methods(root_module)
try:
import ns3_module_radvd__local
except ImportError:
pass
else:
ns3_module_radvd__local.register_methods(root_module)
root_module.end_section('ns3_module_radvd')
root_module.begin_section('ns3_module_ping6')
ns3_module_ping6.register_methods(root_module)
@@ -720,6 +711,39 @@ def register_methods(root_module):
ns3_module_ping6__local.register_methods(root_module)
root_module.end_section('ns3_module_ping6')
root_module.begin_section('ns3_module_olsr')
ns3_module_olsr.register_methods(root_module)
try:
import ns3_module_olsr__local
except ImportError:
pass
else:
ns3_module_olsr__local.register_methods(root_module)
root_module.end_section('ns3_module_olsr')
root_module.begin_section('ns3_module_flow_monitor')
ns3_module_flow_monitor.register_methods(root_module)
try:
import ns3_module_flow_monitor__local
except ImportError:
pass
else:
ns3_module_flow_monitor__local.register_methods(root_module)
root_module.end_section('ns3_module_flow_monitor')
root_module.begin_section('ns3_module_radvd')
ns3_module_radvd.register_methods(root_module)
try:
import ns3_module_radvd__local
except ImportError:
pass
else:
ns3_module_radvd__local.register_methods(root_module)
root_module.end_section('ns3_module_radvd')
root_module.begin_section('ns3_module_mesh')
ns3_module_mesh.register_methods(root_module)
@@ -812,17 +836,6 @@ def register_functions(root_module):
ns3_module_common__local.register_functions(root_module)
root_module.end_section('ns3_module_common')
root_module.begin_section('ns3_module_contrib')
ns3_module_contrib.register_functions(root_module)
try:
import ns3_module_contrib__local
except ImportError:
pass
else:
ns3_module_contrib__local.register_functions(root_module)
root_module.end_section('ns3_module_contrib')
root_module.begin_section('ns3_module_node')
ns3_module_node.register_functions(root_module)
@@ -834,72 +847,17 @@ def register_functions(root_module):
ns3_module_node__local.register_functions(root_module)
root_module.end_section('ns3_module_node')
root_module.begin_section('ns3_module_tap_bridge')
ns3_module_tap_bridge.register_functions(root_module)
root_module.begin_section('ns3_module_contrib')
ns3_module_contrib.register_functions(root_module)
try:
import ns3_module_tap_bridge__local
import ns3_module_contrib__local
except ImportError:
pass
else:
ns3_module_tap_bridge__local.register_functions(root_module)
ns3_module_contrib__local.register_functions(root_module)
root_module.end_section('ns3_module_tap_bridge')
root_module.begin_section('ns3_module_v4ping')
ns3_module_v4ping.register_functions(root_module)
try:
import ns3_module_v4ping__local
except ImportError:
pass
else:
ns3_module_v4ping__local.register_functions(root_module)
root_module.end_section('ns3_module_v4ping')
root_module.begin_section('ns3_module_static_routing')
ns3_module_static_routing.register_functions(root_module)
try:
import ns3_module_static_routing__local
except ImportError:
pass
else:
ns3_module_static_routing__local.register_functions(root_module)
root_module.end_section('ns3_module_static_routing')
root_module.begin_section('ns3_module_packet_sink')
ns3_module_packet_sink.register_functions(root_module)
try:
import ns3_module_packet_sink__local
except ImportError:
pass
else:
ns3_module_packet_sink__local.register_functions(root_module)
root_module.end_section('ns3_module_packet_sink')
root_module.begin_section('ns3_module_stats')
ns3_module_stats.register_functions(root_module)
try:
import ns3_module_stats__local
except ImportError:
pass
else:
ns3_module_stats__local.register_functions(root_module)
root_module.end_section('ns3_module_stats')
root_module.begin_section('ns3_module_onoff')
ns3_module_onoff.register_functions(root_module)
try:
import ns3_module_onoff__local
except ImportError:
pass
else:
ns3_module_onoff__local.register_functions(root_module)
root_module.end_section('ns3_module_onoff')
root_module.end_section('ns3_module_contrib')
root_module.begin_section('ns3_module_point_to_point')
ns3_module_point_to_point.register_functions(root_module)
@@ -922,6 +880,17 @@ def register_functions(root_module):
ns3_module_internet_stack__local.register_functions(root_module)
root_module.end_section('ns3_module_internet_stack')
root_module.begin_section('ns3_module_tap_bridge')
ns3_module_tap_bridge.register_functions(root_module)
try:
import ns3_module_tap_bridge__local
except ImportError:
pass
else:
ns3_module_tap_bridge__local.register_functions(root_module)
root_module.end_section('ns3_module_tap_bridge')
root_module.begin_section('ns3_module_csma')
ns3_module_csma.register_functions(root_module)
@@ -933,28 +902,6 @@ def register_functions(root_module):
ns3_module_csma__local.register_functions(root_module)
root_module.end_section('ns3_module_csma')
root_module.begin_section('ns3_module_list_routing')
ns3_module_list_routing.register_functions(root_module)
try:
import ns3_module_list_routing__local
except ImportError:
pass
else:
ns3_module_list_routing__local.register_functions(root_module)
root_module.end_section('ns3_module_list_routing')
root_module.begin_section('ns3_module_virtual_net_device')
ns3_module_virtual_net_device.register_functions(root_module)
try:
import ns3_module_virtual_net_device__local
except ImportError:
pass
else:
ns3_module_virtual_net_device__local.register_functions(root_module)
root_module.end_section('ns3_module_virtual_net_device')
root_module.begin_section('ns3_module_wifi')
ns3_module_wifi.register_functions(root_module)
@@ -966,6 +913,83 @@ def register_functions(root_module):
ns3_module_wifi__local.register_functions(root_module)
root_module.end_section('ns3_module_wifi')
root_module.begin_section('ns3_module_static_routing')
ns3_module_static_routing.register_functions(root_module)
try:
import ns3_module_static_routing__local
except ImportError:
pass
else:
ns3_module_static_routing__local.register_functions(root_module)
root_module.end_section('ns3_module_static_routing')
root_module.begin_section('ns3_module_v4ping')
ns3_module_v4ping.register_functions(root_module)
try:
import ns3_module_v4ping__local
except ImportError:
pass
else:
ns3_module_v4ping__local.register_functions(root_module)
root_module.end_section('ns3_module_v4ping')
root_module.begin_section('ns3_module_virtual_net_device')
ns3_module_virtual_net_device.register_functions(root_module)
try:
import ns3_module_virtual_net_device__local
except ImportError:
pass
else:
ns3_module_virtual_net_device__local.register_functions(root_module)
root_module.end_section('ns3_module_virtual_net_device')
root_module.begin_section('ns3_module_packet_sink')
ns3_module_packet_sink.register_functions(root_module)
try:
import ns3_module_packet_sink__local
except ImportError:
pass
else:
ns3_module_packet_sink__local.register_functions(root_module)
root_module.end_section('ns3_module_packet_sink')
root_module.begin_section('ns3_module_global_routing')
ns3_module_global_routing.register_functions(root_module)
try:
import ns3_module_global_routing__local
except ImportError:
pass
else:
ns3_module_global_routing__local.register_functions(root_module)
root_module.end_section('ns3_module_global_routing')
root_module.begin_section('ns3_module_stats')
ns3_module_stats.register_functions(root_module)
try:
import ns3_module_stats__local
except ImportError:
pass
else:
ns3_module_stats__local.register_functions(root_module)
root_module.end_section('ns3_module_stats')
root_module.begin_section('ns3_module_list_routing')
ns3_module_list_routing.register_functions(root_module)
try:
import ns3_module_list_routing__local
except ImportError:
pass
else:
ns3_module_list_routing__local.register_functions(root_module)
root_module.end_section('ns3_module_list_routing')
root_module.begin_section('ns3_module_emu')
ns3_module_emu.register_functions(root_module)
@@ -988,17 +1012,17 @@ def register_functions(root_module):
ns3_module_bridge__local.register_functions(root_module)
root_module.end_section('ns3_module_bridge')
root_module.begin_section('ns3_module_global_routing')
ns3_module_global_routing.register_functions(root_module)
root_module.begin_section('ns3_module_onoff')
ns3_module_onoff.register_functions(root_module)
try:
import ns3_module_global_routing__local
import ns3_module_onoff__local
except ImportError:
pass
else:
ns3_module_global_routing__local.register_functions(root_module)
ns3_module_onoff__local.register_functions(root_module)
root_module.end_section('ns3_module_global_routing')
root_module.end_section('ns3_module_onoff')
root_module.begin_section('ns3_module_udp_echo')
ns3_module_udp_echo.register_functions(root_module)
@@ -1010,28 +1034,6 @@ def register_functions(root_module):
ns3_module_udp_echo__local.register_functions(root_module)
root_module.end_section('ns3_module_udp_echo')
root_module.begin_section('ns3_module_olsr')
ns3_module_olsr.register_functions(root_module)
try:
import ns3_module_olsr__local
except ImportError:
pass
else:
ns3_module_olsr__local.register_functions(root_module)
root_module.end_section('ns3_module_olsr')
root_module.begin_section('ns3_module_radvd')
ns3_module_radvd.register_functions(root_module)
try:
import ns3_module_radvd__local
except ImportError:
pass
else:
ns3_module_radvd__local.register_functions(root_module)
root_module.end_section('ns3_module_radvd')
root_module.begin_section('ns3_module_ping6')
ns3_module_ping6.register_functions(root_module)
@@ -1043,6 +1045,39 @@ def register_functions(root_module):
ns3_module_ping6__local.register_functions(root_module)
root_module.end_section('ns3_module_ping6')
root_module.begin_section('ns3_module_olsr')
ns3_module_olsr.register_functions(root_module)
try:
import ns3_module_olsr__local
except ImportError:
pass
else:
ns3_module_olsr__local.register_functions(root_module)
root_module.end_section('ns3_module_olsr')
root_module.begin_section('ns3_module_flow_monitor')
ns3_module_flow_monitor.register_functions(root_module)
try:
import ns3_module_flow_monitor__local
except ImportError:
pass
else:
ns3_module_flow_monitor__local.register_functions(root_module)
root_module.end_section('ns3_module_flow_monitor')
root_module.begin_section('ns3_module_radvd')
ns3_module_radvd.register_functions(root_module)
try:
import ns3_module_radvd__local
except ImportError:
pass
else:
ns3_module_radvd__local.register_functions(root_module)
root_module.end_section('ns3_module_radvd')
root_module.begin_section('ns3_module_mesh')
ns3_module_mesh.register_functions(root_module)

View File

@@ -69,6 +69,8 @@ main (int argc, char *argv[])
// Allow the user to override any of the defaults and the above
// DefaultValue::Bind ()s at run-time, via command-line arguments
CommandLine cmd;
bool enableFlowMonitor = false;
cmd.AddValue("EnableMonitor", "Enable Flow Monitor", enableFlowMonitor);
cmd.Parse (argc, argv);
// Here, we will explicitly create four nodes. In more sophisticated
@@ -148,10 +150,24 @@ main (int argc, char *argv[])
PointToPointHelper::EnablePcapAll ("simple-global-routing");
PointToPointHelper::EnableAsciiAll (ascii);
// Flow Monitor
Ptr<FlowMonitor> flowmon;
if (enableFlowMonitor)
{
FlowMonitorHelper flowmonHelper;
flowmon = flowmonHelper.InstallAll ();
}
NS_LOG_INFO ("Run Simulation.");
Simulator::Stop (Seconds (11));
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
if (enableFlowMonitor)
{
flowmon->SerializeToXmlFile ("simple-global-routing.flowmon", false, false);
}
Simulator::Destroy ();
return 0;
}

View File

@@ -0,0 +1,43 @@
* One FlowMonitor per simulation
* One FlowClassifier per simulation
- Assigns integer simulation unique identifiers to each flow
- Contains a classification method that maps parameters
(e.g. packets or packet headers) to the corresponding flow
identifier;
- FlowClassifier is abstract, needs a concrete subclass
> Ipv4FlowClassifier
* Typically (but not necessarily) one FlowProbe node
- Is responsible for acquiring the packet data
- Works with FlowClassifier
- FlowProbe is abstract, needs a concrete subclass
> Ipv4FlowProbe
- Ipv4FlowProbe needs a matching classifier, Ipv4FlowClassifier
* One ProbeFlowStats object per simulation flow per FlowProbe
- Indexed by the FlowId
- Bytes
- Packets
- Delay from first probe until the packet is received in this probe
* One EndToEndFlowStats object per flow per FlowMonitor
- Lost packets
- Lost bytes
- Bytes
- Packets
- End-to-end delays
TODO:
1. Configurable time when to start/stop monitor. ***DONE***
2. Possibly, detect packet losses also via "drop" trace sources
3. FlowMonitor::FlowStats: add time duration metrics: first flow timestamp, last flow timestamp
> to calculate bitrates... ***DONE***
4. Measure delay jitter
5. Histogram for delays/jitters/packet sizes

View File

@@ -0,0 +1,40 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#include "flow-classifier.h"
namespace ns3 {
FlowClassifier::FlowClassifier ()
:
m_lastNewFlowId (0)
{
}
FlowId
FlowClassifier::GetNewFlowId ()
{
return ++m_lastNewFlowId;
}
} // namespace ns3

View File

@@ -0,0 +1,61 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#ifndef __FLOW_CLASSIFIER_H__
#define __FLOW_CLASSIFIER_H__
#include "ns3/ref-count-base.h"
#include <ostream>
namespace ns3 {
typedef uint32_t FlowId;
typedef uint32_t FlowPacketId;
/// provides a method to translate raw packet data into abstract
/// ``flow identifier'' and ``packet identifier'' parameters. These
/// identifiers are unsigned 32-bit integers that uniquely identify a
/// flow and a packet within that flow, respectively, for the whole
/// simulation, regardless of the point in which the packet was
/// captured. These abstract identifiers are used in the
/// communication between FlowProbe and FlowMonitor, and all collected
/// statistics reference only those abstract identifiers in order to
/// keep the core architecture generic and not tied down to any
/// particular flow capture method or classification system.
class FlowClassifier : public RefCountBase
{
FlowId m_lastNewFlowId;
public:
FlowClassifier ();
virtual void SerializeToXmlStream (std::ostream &os, int indent) const = 0;
protected:
FlowId GetNewFlowId ();
};
} // namespace ns3
#endif

View File

@@ -0,0 +1,468 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#include "flow-monitor.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
#include "ns3/double.h"
#include <fstream>
#include <sstream>
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
#define PERIODIC_CHECK_INTERVAL (Seconds (1))
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("FlowMonitor");
NS_OBJECT_ENSURE_REGISTERED (FlowMonitor);
TypeId
FlowMonitor::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::FlowMonitor")
.SetParent<Object> ()
.AddConstructor<FlowMonitor> ()
.AddAttribute ("MaxPerHopDelay", ("The maximum per-hop delay that should be considered. "
"Packets still not received after this delay are to be considered lost."),
TimeValue (Seconds (10.0)),
MakeTimeAccessor (&FlowMonitor::m_maxPerHopDelay),
MakeTimeChecker ())
.AddAttribute ("StartTime", ("The time when the monitoring starts."),
TimeValue (Seconds (0.0)),
MakeTimeAccessor (&FlowMonitor::Start),
MakeTimeChecker ())
.AddAttribute ("DelayBinWidth", ("The width used in the delay histogram."),
DoubleValue (0.001),
MakeDoubleAccessor (&FlowMonitor::m_delayBinWidth),
MakeDoubleChecker <double> ())
.AddAttribute ("JitterBinWidth", ("The width used in the jitter histogram."),
DoubleValue (0.001),
MakeDoubleAccessor (&FlowMonitor::m_jitterBinWidth),
MakeDoubleChecker <double> ())
.AddAttribute ("PacketSizeBinWidth", ("The width used in the packetSize histogram."),
DoubleValue (20),
MakeDoubleAccessor (&FlowMonitor::m_packetSizeBinWidth),
MakeDoubleChecker <double> ())
;
return tid;
}
TypeId
FlowMonitor::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
FlowMonitor::FlowMonitor ()
: m_enabled (false)
{
// m_histogramBinWidth=DEFAULT_BIN_WIDTH;
}
inline FlowMonitor::FlowStats&
FlowMonitor::GetStatsForFlow (FlowId flowId)
{
std::map<FlowId, FlowStats>::iterator iter;
iter = m_flowStats.find (flowId);
if (iter == m_flowStats.end ())
{
FlowMonitor::FlowStats &ref = m_flowStats[flowId];
ref.delaySum = Seconds (0);
ref.jitterSum = Seconds (0);
ref.lastDelay = Seconds (0);
ref.txBytes = 0;
ref.rxBytes = 0;
ref.txPackets = 0;
ref.rxPackets = 0;
ref.lostPackets = 0;
ref.timesForwarded = 0;
ref.delayHistogram.SetDefaultBinWidth (m_delayBinWidth);
ref.jitterHistogram.SetDefaultBinWidth (m_jitterBinWidth);
ref.packetSizeHistogram.SetDefaultBinWidth (m_packetSizeBinWidth);
return ref;
}
else
{
return iter->second;
}
}
void
FlowMonitor::ReportFirstTx (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize)
{
if (!m_enabled)
{
return;
}
Time now = Simulator::Now ();
TrackedPacket &tracked = m_trackedPackets[std::make_pair (flowId, packetId)];
tracked.firstSeenTime = now;
tracked.lastSeenTime = tracked.firstSeenTime;
tracked.timesForwarded = 0;
NS_LOG_DEBUG ("ReportFirstTx: adding tracked packet (flowId=" << flowId << ", packetId=" << packetId
<< ").");
probe->AddPacketStats (flowId, packetSize, Seconds (0));
FlowStats &stats = GetStatsForFlow (flowId);
stats.txBytes += packetSize;
stats.txPackets++;
if (stats.txPackets == 1)
{
stats.timeFirstTxPacket = now;
}
stats.timeLastTxPacket = now;
}
void
FlowMonitor::ReportForwarding (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize)
{
if (!m_enabled)
{
return;
}
std::pair<FlowId, FlowPacketId> key (flowId, packetId);
TrackedPacketMap::iterator tracked = m_trackedPackets.find (key);
if (tracked == m_trackedPackets.end ())
{
NS_LOG_WARN ("Received packet forward report (flowId=" << flowId << ", packetId=" << packetId
<< ") but not known to be transmitted.");
return;
}
tracked->second.timesForwarded++;
tracked->second.lastSeenTime = Simulator::Now ();
Time delay = (Simulator::Now () - tracked->second.firstSeenTime);
probe->AddPacketStats (flowId, packetSize, delay);
}
void
FlowMonitor::ReportLastRx (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize)
{
if (!m_enabled)
{
return;
}
TrackedPacketMap::iterator tracked = m_trackedPackets.find (std::make_pair (flowId, packetId));
if (tracked == m_trackedPackets.end ())
{
NS_LOG_WARN ("Received packet last-tx report (flowId=" << flowId << ", packetId=" << packetId
<< ") but not known to be transmitted.");
return;
}
Time now = Simulator::Now ();
Time delay = (now - tracked->second.firstSeenTime);
probe->AddPacketStats (flowId, packetSize, delay);
FlowStats &stats = GetStatsForFlow (flowId);
stats.delaySum += delay;
stats.delayHistogram.AddValue (delay.GetSeconds ());
if (stats.rxPackets > 0 )
{
Time jitter = stats.lastDelay - delay;
if (jitter > Seconds (0))
{
stats.jitterSum += jitter;
stats.jitterHistogram.AddValue (jitter.GetSeconds ());
}
else
{
stats.jitterSum -= jitter;
stats.jitterHistogram.AddValue (-jitter.GetSeconds());
}
}
stats.lastDelay = delay;
stats.rxBytes += packetSize;
stats.packetSizeHistogram.AddValue ((double) packetSize);
stats.rxPackets++;
if (stats.rxPackets == 1)
{
stats.timeFirstRxPacket = now;
}
stats.timeLastRxPacket = now;
stats.timesForwarded += tracked->second.timesForwarded;
NS_LOG_DEBUG ("ReportLastTx: removing tracked packet (flowId="
<< flowId << ", packetId=" << packetId << ").");
m_trackedPackets.erase (tracked); // we don't need to track this packet anymore
}
void
FlowMonitor::ReportDrop (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize,
uint32_t reasonCode)
{
if (!m_enabled)
{
return;
}
probe->AddPacketDropStats (flowId, packetSize, reasonCode);
FlowStats &stats = GetStatsForFlow (flowId);
stats.lostPackets++;
if (stats.packetsDropped.size () < reasonCode + 1)
{
stats.packetsDropped.resize (reasonCode + 1, 0);
stats.bytesDropped.resize (reasonCode + 1, 0);
}
++stats.packetsDropped[reasonCode];
stats.bytesDropped[reasonCode] += packetSize;
NS_LOG_DEBUG ("++stats.packetsDropped[" << reasonCode<< "]; // becomes: " << stats.packetsDropped[reasonCode]);
TrackedPacketMap::iterator tracked = m_trackedPackets.find (std::make_pair (flowId, packetId));
if (tracked != m_trackedPackets.end ())
{
// we don't need to track this packet anymore
// FIXME: this will not necessarily be true with broadcast/multicast
NS_LOG_DEBUG ("ReportDrop: removing tracked packet (flowId="
<< flowId << ", packetId=" << packetId << ").");
m_trackedPackets.erase (tracked);
}
}
std::map<FlowId, FlowMonitor::FlowStats>
FlowMonitor::GetFlowStats () const
{
return m_flowStats;
}
void
FlowMonitor::CheckForLostPackets (Time maxDelay)
{
Time now = Simulator::Now ();
for (TrackedPacketMap::iterator iter = m_trackedPackets.begin ();
iter != m_trackedPackets.end (); )
{
if (now - iter->second.lastSeenTime >= maxDelay)
{
// packet is considered lost, add it to the loss statistics
std::map<FlowId, FlowStats>::iterator
flow = m_flowStats.find (iter->first.first);
NS_ASSERT (flow != m_flowStats.end ());
flow->second.lostPackets++;
// we won't track it anymore
m_trackedPackets.erase (iter++);
}
else
{
iter++;
}
}
}
void
FlowMonitor::CheckForLostPackets ()
{
CheckForLostPackets (m_maxPerHopDelay);
}
void
FlowMonitor::PeriodicCheckForLostPackets ()
{
CheckForLostPackets ();
Simulator::Schedule (PERIODIC_CHECK_INTERVAL, &FlowMonitor::PeriodicCheckForLostPackets, this);
}
void
FlowMonitor::NotifyConstructionCompleted ()
{
Object::NotifyConstructionCompleted ();
Simulator::Schedule (PERIODIC_CHECK_INTERVAL, &FlowMonitor::PeriodicCheckForLostPackets, this);
}
void
FlowMonitor::AddProbe (Ptr<FlowProbe> probe)
{
m_flowProbes.push_back (probe);
}
std::vector< Ptr<FlowProbe> >
FlowMonitor::GetAllProbes () const
{
return m_flowProbes;
}
void
FlowMonitor::Start (const Time &time)
{
if (m_enabled)
{
return;
}
Simulator::Cancel (m_startEvent);
m_startEvent = Simulator::Schedule (time, &FlowMonitor::StartRightNow, Ptr<FlowMonitor> (this));
}
void
FlowMonitor::Stop (const Time &time)
{
if (!m_enabled)
{
return;
}
Simulator::Cancel (m_stopEvent);
m_stopEvent = Simulator::Schedule (time, &FlowMonitor::StopRightNow, Ptr<FlowMonitor> (this));
}
void
FlowMonitor::StartRightNow ()
{
if (m_enabled)
{
return;
}
m_enabled = true;
}
void
FlowMonitor::StopRightNow ()
{
if (!m_enabled)
{
return;
}
m_enabled = false;
CheckForLostPackets ();
}
void
FlowMonitor::SetFlowClassifier (Ptr<FlowClassifier> classifier)
{
m_classifier = classifier;
}
void
FlowMonitor::SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes)
{
CheckForLostPackets ();
INDENT(indent); os << "<FlowMonitor>\n";
indent += 2;
INDENT(indent); os << "<FlowStats>\n";
indent += 2;
for (std::map<FlowId, FlowStats>::const_iterator flowI = m_flowStats.begin ();
flowI != m_flowStats.end (); flowI++)
{
INDENT(indent);
#define ATTRIB(name) << " "#name"=\"" << flowI->second.name << "\""
os << "<Flow flowId=\"" << flowI->first << "\""
ATTRIB(timeFirstTxPacket)
ATTRIB(timeFirstRxPacket)
ATTRIB(timeLastTxPacket)
ATTRIB(timeLastRxPacket)
ATTRIB(delaySum)
ATTRIB(jitterSum)
ATTRIB(lastDelay)
ATTRIB(txBytes)
ATTRIB(rxBytes)
ATTRIB(txPackets)
ATTRIB(rxPackets)
ATTRIB(lostPackets)
ATTRIB(timesForwarded)
<< ">\n";
#undef ATTRIB
indent += 2;
for (uint32_t reasonCode = 0; reasonCode < flowI->second.packetsDropped.size (); reasonCode++)
{
INDENT(indent);
os << "<packetsDropped reasonCode=\"" << reasonCode << "\""
<< " number=\"" << flowI->second.packetsDropped[reasonCode]
<< "\" />\n";
}
for (uint32_t reasonCode = 0; reasonCode < flowI->second.bytesDropped.size (); reasonCode++)
{
INDENT(indent);
os << "<bytesDropped reasonCode=\"" << reasonCode << "\""
<< " bytes=\"" << flowI->second.bytesDropped[reasonCode]
<< "\" />\n";
}
if (enableHistograms)
{
flowI->second.delayHistogram.SerializeToXmlStream (os, indent, "delayHistogram");
flowI->second.jitterHistogram.SerializeToXmlStream (os, indent, "jitterHistogram");
flowI->second.packetSizeHistogram.SerializeToXmlStream (os, indent, "packetSizeHistogram");
}
indent -= 2;
INDENT(indent); os << "</Flow>\n";
}
indent -= 2;
INDENT(indent); os << "</FlowStats>\n";
m_classifier->SerializeToXmlStream (os, indent);
if (enableProbes)
{
INDENT(indent); os << "<FlowProbes>\n";
indent += 2;
for (uint32_t i = 0; i < m_flowProbes.size (); i++)
{
m_flowProbes[i]->SerializeToXmlStream (os, indent, i);
}
indent -= 2;
INDENT(indent); os << "</FlowProbes>\n";
}
indent -= 2;
INDENT(indent); os << "</FlowMonitor>\n";
}
std::string
FlowMonitor::SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes)
{
std::ostringstream os;
SerializeToXmlStream (os, indent, enableHistograms, enableProbes);
return os.str ();
}
void
FlowMonitor::SerializeToXmlFile (std::string fileName, bool enableHistograms, bool enableProbes)
{
std::ofstream os (fileName.c_str (), std::ios::out|std::ios::binary);
os << "<?xml version=\"1.0\" ?>\n";
SerializeToXmlStream (os, 0, enableHistograms, enableProbes);
os.close ();
}
} // namespace ns3

View File

@@ -0,0 +1,244 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#ifndef __FLOW_MONITOR_H__
#define __FLOW_MONITOR_H__
#include <vector>
#include <map>
#include "ns3/ptr.h"
#include "ns3/object.h"
#include "ns3/flow-probe.h"
#include "ns3/flow-classifier.h"
#include "ns3/histogram.h"
#include "ns3/nstime.h"
#include "ns3/event-id.h"
namespace ns3 {
/// \brief An object that monitors and reports back packet flows observed during a simulation
///
/// The FlowMonitor class is responsible forcoordinating efforts
/// regarding probes, and collects end-to-end flowstatistics.
class FlowMonitor : public Object
{
public:
/// \brief Structure that represents the measured metrics of an individual packet flow
struct FlowStats
{
/// Contains the absolute time when the first packet in the flow
/// was transmitted, i.e. the time when the flow transmission
/// starts
Time timeFirstTxPacket;
/// Contains the absolute time when the first packet in the flow
/// was received by an end node, i.e. the time when the flow
/// reception starts
Time timeFirstRxPacket;
/// Contains the absolute time when the last packet in the flow
/// was transmitted, i.e. the time when the flow transmission
/// ends
Time timeLastTxPacket;
/// Contains the absolute time when the last packet in the flow
/// was received, i.e. the time when the flow reception ends
Time timeLastRxPacket;
/// Contains the sum of all end-to-end delays for all received
/// packets of the flow.
Time delaySum; // delayCount == rxPackets
/// Contains the sum of all end-to-end delay jitter (delay
/// variation) values for all received packets of the flow. Here
/// we define _jitter_ of a packet as the delay variation
/// relatively to the last packet of the stream,
/// i.e. \f$Jitter\left\{P_N\right\} = \left|Delay\left\{P_N\right\} - Delay\left\{P_{N-1}\right\}\right|\f$.
/// This definition is in accordance with the Type-P-One-way-ipdv
/// as defined in IETF RFC 3393.
Time jitterSum; // jitterCount == rxPackets - 1
Time lastDelay;
/// Total number of transmitted bytes for the flow
uint64_t txBytes;
/// Total number of received bytes for the flow
uint64_t rxBytes;
/// Total number of transmitted packets for the flow
uint32_t txPackets;
/// Total number of received packets for the flow
uint32_t rxPackets;
/// Total number of packets that are assumed to be lost,
/// i.e. those that were transmitted but have not been reportedly
/// received or forwarded for a long time. By default, packets
/// missing for a period of over 10 seconds are assumed to be
/// lost, although this value can be easily configured in runtime
uint32_t lostPackets;
/// Contains the number of times a packet has been reportedly
/// forwarded, summed for all received packets in the flow
uint32_t timesForwarded;
/// Histogram of the packet delays
Histogram delayHistogram;
/// Histogram of the packet jitters
Histogram jitterHistogram;
/// Histogram of the packet sizes
Histogram packetSizeHistogram;
/// This attribute also tracks the number of lost packets and
/// bytes, but discriminates the losses by a _reason code_. This
/// reason code is usually an enumeration defined by the concrete
/// FlowProbe class, and for each reason code there may be a
/// vector entry indexed by that code and whose value is the
/// number of packets or bytes lost due to this reason. For
/// instance, in the Ipv4FlowProbe case the following reasons are
/// currently defined: DROP_NO_ROUTE (no IPv4 route found for a
/// packet), DROP_TTL_EXPIRE (a packet was dropped due to an IPv4
/// TTL field decremented and reaching zero), and
/// DROP_BAD_CHECKSUM (a packet had bad IPv4 header checksum and
/// had to be dropped).
std::vector<uint32_t> packetsDropped; // packetsDropped[reasonCode] => number of dropped packets
/// This attribute also tracks the number of lost bytes. See also
/// comment in attribute packetsDropped.
std::vector<uint64_t> bytesDropped; // bytesDropped[reasonCode] => number of dropped bytes
};
// --- basic methods ---
static TypeId GetTypeId ();
TypeId GetInstanceTypeId () const;
FlowMonitor ();
/// Set the FlowClassifier to be used by the flow monitor.
void SetFlowClassifier (Ptr<FlowClassifier> classifier);
/// Set the time, counting from the current time, from which to start monitoring flows
void Start (const Time &time);
/// Set the time, counting from the current time, from which to stop monitoring flows
void Stop (const Time &time);
/// Begin monitoring flows *right now*
void StartRightNow ();
/// End monitoring flows *right now*
void StopRightNow ();
// --- methods to be used by the FlowMonitorProbe's only ---
/// Register a new FlowProbe that will begin monitoring and report
/// events to this monitor. This method is normally only used by
/// FlowProbe implementations.
void AddProbe (Ptr<FlowProbe> probe);
/// FlowProbe implementations are supposed to call this method to
/// report that a new packet was transmitted (but keep in mind the
/// distinction between a new packet entering the system and a
/// packet that is already known and is only being forwarded).
void ReportFirstTx (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
/// FlowProbe implementations are supposed to call this method to
/// report that a known packet is being forwarded.
void ReportForwarding (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
/// FlowProbe implementations are supposed to call this method to
/// report that a known packet is being received.
void ReportLastRx (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize);
/// FlowProbe implementations are supposed to call this method to
/// report that a known packet is being dropped due to some reason.
void ReportDrop (Ptr<FlowProbe> probe, FlowId flowId, FlowPacketId packetId,
uint32_t packetSize, uint32_t reasonCode);
/// Check right now for packets that appear to be lost
void CheckForLostPackets ();
/// Check right now for packets that appear to be lost, considering
/// packets as lost if not seen in the network for a time larger
/// than maxDelay
void CheckForLostPackets (Time maxDelay);
// --- methods to get the results ---
/// Retrieve all collected the flow statistics. Note, if the
/// FlowMonitor has not stopped monitoring yet, you should call
/// CheckForLostPackets() to make sure all possibly lost packets are
/// accounted for.
std::map<FlowId, FlowStats> GetFlowStats () const;
/// Get a list of all FlowProbe's associated with this FlowMonitor
std::vector< Ptr<FlowProbe> > GetAllProbes () const;
/// Serializes the results to an std::ostream in XML format
/// \param os the output stream
/// \param indent number of spaces to use as base indentation level
/// \param enableHistograms if true, include also the histograms in the output
/// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
void SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes);
/// Same as SerializeToXmlStream, but returns the output as a std::string
/// \param indent number of spaces to use as base indentation level
/// \param enableHistograms if true, include also the histograms in the output
/// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
/// \return the XML output as string
std::string SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes);
/// Same as SerializeToXmlStream, but writes to a file instead
/// \param fileName name or path of the output file that will be created
/// \param enableHistograms if true, include also the histograms in the output
/// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
void SerializeToXmlFile (std::string fileName, bool enableHistograms, bool enableProbes);
protected:
virtual void NotifyConstructionCompleted ();
private:
struct TrackedPacket
{
Time firstSeenTime; // absolute time when the packet was first seen by a probe
Time lastSeenTime; // absolute time when the packet was last seen by a probe
uint32_t timesForwarded; // number of times the packet was reportedly forwarded
};
// FlowId --> FlowStats
std::map<FlowId, FlowStats> m_flowStats;
// (FlowId,PacketId) --> TrackedPacket
typedef std::map< std::pair<FlowId, FlowPacketId>, TrackedPacket> TrackedPacketMap;
TrackedPacketMap m_trackedPackets;
Time m_maxPerHopDelay;
std::vector< Ptr<FlowProbe> > m_flowProbes;
// note: this is needed only for serialization
Ptr<FlowClassifier> m_classifier;
EventId m_startEvent;
EventId m_stopEvent;
bool m_enabled;
double m_delayBinWidth;
double m_jitterBinWidth;
double m_packetSizeBinWidth;
FlowStats& GetStatsForFlow (FlowId flowId);
void PeriodicCheckForLostPackets ();
};
} // namespace ns3
#endif

View File

@@ -0,0 +1,111 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#include "ns3/flow-probe.h"
#include "ns3/flow-monitor.h"
namespace ns3 {
FlowProbe::~FlowProbe ()
{
}
FlowProbe::FlowProbe (Ptr<FlowMonitor> flowMonitor)
: m_flowMonitor (flowMonitor)
{
m_flowMonitor->AddProbe (this);
}
void
FlowProbe::AddPacketStats (FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe)
{
FlowStats &flow = m_stats[flowId];
flow.delayFromFirstProbeSum += delayFromFirstProbe;
flow.bytes += packetSize;
++flow.packets;
}
void
FlowProbe::AddPacketDropStats (FlowId flowId, uint32_t packetSize, uint32_t reasonCode)
{
FlowStats &flow = m_stats[flowId];
if (flow.packetsDropped.size () < reasonCode + 1)
{
flow.packetsDropped.resize (reasonCode + 1, 0);
flow.bytesDropped.resize (reasonCode + 1, 0);
}
++flow.packetsDropped[reasonCode];
flow.bytesDropped[reasonCode] += packetSize;
}
FlowProbe::Stats
FlowProbe::GetStats () const
{
return m_stats;
}
void
FlowProbe::SerializeToXmlStream (std::ostream &os, int indent, uint32_t index) const
{
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
INDENT(indent); os << "<FlowProbe index=\"" << index << "\">\n";
indent += 2;
for (Stats::const_iterator iter = m_stats.begin (); iter != m_stats.end (); iter++)
{
INDENT(indent);
os << "<FlowStats "
<< " flowId=\"" << iter->first << "\""
<< " packets=\"" << iter->second.packets << "\""
<< " bytes=\"" << iter->second.bytes << "\""
<< " delayFromFirstProbeSum=\"" << iter->second.delayFromFirstProbeSum << "\""
<< " >\n";
indent += 2;
for (uint32_t reasonCode = 0; reasonCode < iter->second.packetsDropped.size (); reasonCode++)
{
INDENT(indent);
os << "<packetsDropped reasonCode=\"" << reasonCode << "\""
<< " number=\"" << iter->second.packetsDropped[reasonCode]
<< "\" />\n";
}
for (uint32_t reasonCode = 0; reasonCode < iter->second.bytesDropped.size (); reasonCode++)
{
INDENT(indent);
os << "<bytesDropped reasonCode=\"" << reasonCode << "\""
<< " bytes=\"" << iter->second.bytesDropped[reasonCode]
<< "\" />\n";
}
indent -= 2;
INDENT(indent); os << "</FlowStats>\n";
}
indent -= 2;
INDENT(indent); os << "</FlowProbe>\n";
}
} // namespace ns3

View File

@@ -0,0 +1,87 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#ifndef __FLOW_PROBE_H__
#define __FLOW_PROBE_H__
#include <map>
#include <vector>
#include "ns3/ref-count-base.h"
#include "ns3/flow-classifier.h"
#include "ns3/nstime.h"
namespace ns3 {
class FlowMonitor;
/// The FlowProbe class is responsible for listening for packet events
/// in a specific point of the simulated space, report those events to
/// the global FlowMonitor, and collect its own flow statistics
/// regarding only the packets that pass through that probe.
class FlowProbe : public RefCountBase
{
protected:
FlowProbe (Ptr<FlowMonitor> flowMonitor);
public:
~FlowProbe ();
struct FlowStats
{
FlowStats () : delayFromFirstProbeSum (Seconds (0)), bytes (0), packets (0) {}
/// packetsDropped[reasonCode] => number of dropped packets
std::vector<uint32_t> packetsDropped;
/// bytesDropped[reasonCode] => number of dropped bytes
std::vector<uint64_t> bytesDropped;
/// divide by 'Scalar (packets)' to get the average delay from the
/// first (entry) probe up to this one (partial delay)
Time delayFromFirstProbeSum;
/// Number of bytes seen of this flow
uint64_t bytes;
/// Number of packets seen of this flow
uint32_t packets;
};
typedef std::map<FlowId, FlowStats> Stats;
void AddPacketStats (FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe);
void AddPacketDropStats (FlowId flowId, uint32_t packetSize, uint32_t reasonCode);
/// Get the partial flow statistics stored in this probe. With this
/// information you can, for example, find out what is the delay
/// from the first probe to this one.
Stats GetStats () const;
void SerializeToXmlStream (std::ostream &os, int indent, uint32_t index) const;
protected:
Ptr<FlowMonitor> m_flowMonitor;
Stats m_stats;
};
} // namespace ns3
#endif

View File

@@ -0,0 +1,212 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Pedro Fortuna <pedro.fortuna@inescporto.pt> <pedro.fortuna@gmail.com>
//
#include <math.h>
#include "histogram.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
#define DEFAULT_BIN_WIDTH 1
// #define RESERVED_BINS_INC 10
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("Histogram");
// uint32_t
// Histogram::GetSize () const
// {
// return m_histogram.size ();
// }
uint32_t
Histogram::GetNBins () const
{
return m_histogram.size ();
}
double
Histogram::GetBinStart (uint32_t index)
{
return index*m_binWidth;
}
double
Histogram::GetBinEnd (uint32_t index)
{
return (index + 1) * m_binWidth;
}
double
Histogram::GetBinWidth (uint32_t index) const
{
return m_binWidth;
}
void
Histogram::SetDefaultBinWidth (double binWidth)
{
NS_ASSERT (m_histogram.size () == 0); //we can only change the bin width if no values were added
m_binWidth = binWidth;
}
uint32_t
Histogram::GetBinCount (uint32_t index)
{
NS_ASSERT (index < m_histogram.size ());
return m_histogram[index];
}
void
Histogram::AddValue (double value)
{
uint32_t index = floor (value/m_binWidth);
//check if we need to resize the vector
NS_LOG_DEBUG ("AddValue: index=" << index << ", m_histogram.size()=" << m_histogram.size ());
if (index >= m_histogram.size ())
{
m_histogram.resize (index + 1, 0);
}
m_histogram[index]++;
}
Histogram::Histogram (double binWidth)
{
m_binWidth = binWidth;
}
Histogram::Histogram ()
{
Histogram (DEFAULT_BIN_WIDTH);
}
void
Histogram::SerializeToXmlStream (std::ostream &os, int indent, std::string elementName) const
{
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
INDENT(indent); os << "<" << elementName // << " binWidth=\"" << m_binWidth << "\""
<< " nBins=\"" << m_histogram.size () << "\""
<< " >\n";
indent += 2;
#if 1 // two alternative forms of representing bin data, one more verbose than the other one
for (uint32_t index = 0; index < m_histogram.size (); index++)
{
if (m_histogram[index])
{
INDENT(indent);
os << "<bin"
<< " index=\"" << (index) << "\""
<< " start=\"" << (index*m_binWidth) << "\""
<< " width=\"" << m_binWidth << "\""
<< " count=\"" << m_histogram[index] << "\""
<< " />\n";
}
}
#else
INDENT(indent + 2);
for (uint32_t index = 0; index < m_histogram.size (); index++)
{
if (index > 0)
{
os << " ";
}
os << m_histogram[index];
}
os << "\n";
#endif
indent -= 2;
INDENT(indent); os << "</" << elementName << ">\n";
#undef INDENT
}
} // namespace ns3
#ifdef RUN_SELF_TESTS
#include "ns3/test.h"
namespace ns3 {
class HistogramTest : public ns3::Test {
private:
public:
HistogramTest ();
virtual bool RunTests (void);
};
HistogramTest::HistogramTest ()
: ns3::Test ("Histogram")
{}
bool
HistogramTest::RunTests (void)
{
bool result = true;
Histogram h0(3.5);
// Testing floating-point bin widths
{
for (int i=1; i<= 10; i++) h0.AddValue(3.4);
for (int i=1; i<= 5; i++) h0.AddValue(3.6);
NS_TEST_ASSERT_EQUAL (h0.GetBinWidth (0), 3.5);
NS_TEST_ASSERT_EQUAL (h0.GetNBins (), 2);
NS_TEST_ASSERT_EQUAL (h0.GetBinStart(1), 3.5);
NS_TEST_ASSERT_EQUAL (h0.GetBinCount(0), 10);
NS_TEST_ASSERT_EQUAL (h0.GetBinCount(1), 5);
}
{
// Testing bin expansion
h0.AddValue(74.3);
NS_TEST_ASSERT_EQUAL (h0.GetNBins (), 22);
/*for (uint32_t i=0; i < h0.GetSize () ; i++)
{
std::cout << i << ") BinStart:" << h0.GetBinStart (i) << " BinEnd:" << ((double) h0.GetBinStart (i) + h0.GetBinWidth (i)) << " BinCount: " << h0.GetBinCount (i) << std::endl;
}*/
NS_TEST_ASSERT_EQUAL (h0.GetBinCount (21), 1);
}
return result;
}
static HistogramTest gHistogramTest;
}; // namespace
#endif /* RUN_SELF_TESTS */

View File

@@ -0,0 +1,64 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Pedro Fortuna <pedro.fortuna@inescporto.pt> <pedro.fortuna@gmail.com>
//
#ifndef __NS3_HISTOGRAM_H__
#define __NS3_HISTOGRAM_H__
#include <vector>
#include <stdint.h>
#include <ostream>
namespace ns3 {
class Histogram
{
public:
// --- basic methods ---
Histogram (double binWidth);
Histogram ();
// Methods for Getting the Histogram Results
uint32_t GetNBins () const;
double GetBinStart (uint32_t index);
double GetBinEnd (uint32_t index);
double GetBinWidth (uint32_t index) const;
void SetDefaultBinWidth (double binWidth);
uint32_t GetBinCount (uint32_t index);
// Method for adding values
void AddValue (double value);
void SerializeToXmlStream (std::ostream &os, int indent, std::string elementName) const;
// TODO: add method(s) to estimate N, µ, and s² from the histogram,
// see http://www.dspguide.com/ch2/4.htm
private:
std::vector<uint32_t> m_histogram;
double m_binWidth;
};
} // namespace ns3
#endif

View File

@@ -0,0 +1,203 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#include "ns3/packet.h"
#include "ipv4-flow-classifier.h"
#include "ns3/udp-header.h"
#include "ns3/tcp-header.h"
namespace ns3 {
/* see http://www.iana.org/assignments/protocol-numbers */
const uint8_t TCP_PROT_NUMBER = 6;
const uint8_t UDP_PROT_NUMBER = 17;
bool operator < (const Ipv4FlowClassifier::FiveTuple &t1,
const Ipv4FlowClassifier::FiveTuple &t2)
{
if (t1.sourceAddress < t2.sourceAddress)
{
return true;
}
if (t1.sourceAddress != t2.sourceAddress)
{
return false;
}
if (t1.destinationAddress < t2.destinationAddress)
{
return true;
}
if (t1.destinationAddress != t2.destinationAddress)
{
return false;
}
if (t1.protocol < t2.protocol)
{
return true;
}
if (t1.protocol != t2.protocol)
{
return false;
}
if (t1.sourcePort < t2.sourcePort)
{
return true;
}
if (t1.sourcePort != t2.sourcePort)
{
return false;
}
if (t1.destinationPort < t2.destinationPort)
{
return true;
}
if (t1.destinationPort != t2.destinationPort)
{
return false;
}
return false;
}
bool operator == (const Ipv4FlowClassifier::FiveTuple &t1,
const Ipv4FlowClassifier::FiveTuple &t2)
{
return (t1.sourceAddress == t2.sourceAddress &&
t1.destinationAddress == t2.destinationAddress &&
t1.protocol == t2.protocol &&
t1.sourcePort == t2.sourcePort &&
t1.destinationPort == t2.destinationPort);
}
Ipv4FlowClassifier::Ipv4FlowClassifier ()
{
}
bool
Ipv4FlowClassifier::Classify (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload,
uint32_t *out_flowId, uint32_t *out_packetId)
{
if (ipHeader.GetDestination () == Ipv4Address::GetBroadcast ())
{
// we are not prepared to handle broadcast yet
return false;
}
FiveTuple tuple;
tuple.sourceAddress = ipHeader.GetSource ();
tuple.destinationAddress = ipHeader.GetDestination ();
tuple.protocol = ipHeader.GetProtocol ();
switch (tuple.protocol)
{
case UDP_PROT_NUMBER:
{
UdpHeader udpHeader;
ipPayload->PeekHeader (udpHeader);
tuple.sourcePort = udpHeader.GetSourcePort ();
tuple.destinationPort = udpHeader.GetDestinationPort ();
}
break;
case TCP_PROT_NUMBER:
{
TcpHeader tcpHeader;
ipPayload->PeekHeader (tcpHeader);
tuple.sourcePort = tcpHeader.GetSourcePort ();
tuple.destinationPort = tcpHeader.GetDestinationPort ();
}
break;
default:
return false;
}
// try to insert the tuple, but check if it already exists
std::pair<std::map<FiveTuple, FlowId>::iterator, bool> insert
= m_flowMap.insert (std::pair<FiveTuple, FlowId> (tuple, 0));
// if the insertion succeeded, we need to assign this tuple a new flow identifier
if (insert.second)
{
insert.first->second = GetNewFlowId ();
}
*out_flowId = insert.first->second;
*out_packetId = ipHeader.GetIdentification ();
return true;
}
Ipv4FlowClassifier::FiveTuple
Ipv4FlowClassifier::FindFlow (FlowId flowId) const
{
for (std::map<FiveTuple, FlowId>::const_iterator
iter = m_flowMap.begin (); iter != m_flowMap.end (); iter++)
{
if (iter->second == flowId)
{
return iter->first;
}
}
NS_FATAL_ERROR ("Could not find the flow with ID " << flowId);
FiveTuple retval = { Ipv4Address::GetZero (), Ipv4Address::GetZero (), 0, 0, 0 };
return retval;
}
void
Ipv4FlowClassifier::SerializeToXmlStream (std::ostream &os, int indent) const
{
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
INDENT(indent); os << "<Ipv4FlowClassifier>\n";
indent += 2;
for (std::map<FiveTuple, FlowId>::const_iterator
iter = m_flowMap.begin (); iter != m_flowMap.end (); iter++)
{
INDENT(indent);
os << "<Flow flowId=\"" << iter->second << "\""
<< " sourceAddress=\"" << iter->first.sourceAddress << "\""
<< " destinationAddress=\"" << iter->first.destinationAddress << "\""
<< " protocol=\"" << int(iter->first.protocol) << "\""
<< " sourcePort=\"" << iter->first.sourcePort << "\""
<< " destinationPort=\"" << iter->first.destinationPort << "\""
<< " />\n";
}
indent -= 2;
INDENT(indent); os << "</Ipv4FlowClassifier>\n";
#undef INDENT
}
} // namespace ns3

View File

@@ -0,0 +1,78 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#ifndef __IPV4_FLOW_CLASSIFIER_H__
#define __IPV4_FLOW_CLASSIFIER_H__
#include <stdint.h>
#include <map>
#include "ns3/ipv4-header.h"
#include "ns3/flow-classifier.h"
namespace ns3 {
class Packet;
/// Classifies packets by looking at their IP and TCP/UDP headers.
/// From these packet headers, a tuple (source-ip, destination-ip,
/// protocol, source-port, destination-port) is created, and a unique
/// flow identifier is assigned for each different tuple combination
class Ipv4FlowClassifier : public FlowClassifier
{
public:
struct FiveTuple
{
Ipv4Address sourceAddress;
Ipv4Address destinationAddress;
uint8_t protocol;
uint16_t sourcePort;
uint16_t destinationPort;
};
Ipv4FlowClassifier ();
/// \brief try to classify the packet into flow-id and packet-id
/// \return true if the packet was classified, false if not (i.e. it
/// does not appear to be part of a flow).
bool Classify (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload,
uint32_t *out_flowId, uint32_t *out_packetId);
/// Searches for the FiveTuple corresponding to the given flowId
FiveTuple FindFlow (FlowId flowId) const;
virtual void SerializeToXmlStream (std::ostream &os, int indent) const;
private:
std::map<FiveTuple, FlowId> m_flowMap;
};
bool operator < (const Ipv4FlowClassifier::FiveTuple &t1, const Ipv4FlowClassifier::FiveTuple &t2);
bool operator == (const Ipv4FlowClassifier::FiveTuple &t1, const Ipv4FlowClassifier::FiveTuple &t2);
} // namespace ns3
#endif

View File

@@ -0,0 +1,178 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#include "ns3/ipv4-flow-probe.h"
#include "ns3/ipv4-flow-classifier.h"
#include "ns3/node.h"
#include "ns3/packet.h"
#include "ns3/flow-monitor.h"
#include "ns3/log.h"
#include "ns3/pointer.h"
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("Ipv4FlowProbe");
Ipv4FlowProbe::~Ipv4FlowProbe ()
{
}
Ipv4FlowProbe::Ipv4FlowProbe (Ptr<FlowMonitor> monitor,
Ptr<Ipv4FlowClassifier> classifier,
Ptr<Node> node)
: FlowProbe (monitor),
m_classifier (classifier)
{
NS_LOG_FUNCTION (this << node->GetId ());
Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
if (!ipv4->TraceConnectWithoutContext ("SendOutgoing",
MakeCallback (&Ipv4FlowProbe::SendOutgoingLogger, Ptr<Ipv4FlowProbe> (this))))
{
NS_FATAL_ERROR ("trace fail");
}
if (!ipv4->TraceConnectWithoutContext ("UnicastForward",
MakeCallback (&Ipv4FlowProbe::ForwardLogger, Ptr<Ipv4FlowProbe> (this))))
{
NS_FATAL_ERROR ("trace fail");
}
if (!ipv4->TraceConnectWithoutContext ("LocalDeliver",
MakeCallback (&Ipv4FlowProbe::ForwardUpLogger, Ptr<Ipv4FlowProbe> (this))))
{
NS_FATAL_ERROR ("trace fail");
}
if (!ipv4->TraceConnectWithoutContext ("Drop",
MakeCallback (&Ipv4FlowProbe::DropLogger, Ptr<Ipv4FlowProbe> (this))))
{
NS_FATAL_ERROR ("trace fail");
}
}
void
Ipv4FlowProbe::SendOutgoingLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface)
{
FlowId flowId;
FlowPacketId packetId;
if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
{
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
NS_LOG_DEBUG ("ReportFirstTx ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<"); "
<< ipHeader << *ipPayload);
m_flowMonitor->ReportFirstTx (this, flowId, packetId, size);
}
}
void
Ipv4FlowProbe::ForwardLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface)
{
FlowId flowId;
FlowPacketId packetId;
if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
{
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
NS_LOG_DEBUG ("ReportForwarding ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<");");
m_flowMonitor->ReportForwarding (this, flowId, packetId, size);
}
}
void
Ipv4FlowProbe::ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface)
{
FlowId flowId;
FlowPacketId packetId;
if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
{
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
NS_LOG_DEBUG ("ReportLastRx ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<");");
m_flowMonitor->ReportLastRx (this, flowId, packetId, size);
}
}
void
Ipv4FlowProbe::DropLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload,
Ipv4L3Protocol::DropReason reason, uint32_t ifIndex)
{
#if 0
switch (reason)
{
case Ipv4L3Protocol::DROP_NO_ROUTE:
break;
case Ipv4L3Protocol::DROP_TTL_EXPIRED:
case Ipv4L3Protocol::DROP_BAD_CHECKSUM:
Ipv4Address addri = m_ipv4->GetAddress (ifIndex);
Ipv4Mask maski = m_ipv4->GetNetworkMask (ifIndex);
Ipv4Address bcast = addri.GetSubnetDirectedBroadcast (maski);
if (ipHeader.GetDestination () == bcast) // we don't want broadcast packets
{
return;
}
}
#endif
FlowId flowId;
FlowPacketId packetId;
if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
{
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << reason
<< ", destIp=" << ipHeader.GetDestination () << "); "
<< "HDR: " << ipHeader << " PKT: " << *ipPayload);
DropReason myReason;
switch (reason)
{
case Ipv4L3Protocol::DROP_TTL_EXPIRED:
myReason = DROP_TTL_EXPIRE;
NS_LOG_DEBUG ("DROP_TTL_EXPIRE");
break;
case Ipv4L3Protocol::DROP_NO_ROUTE:
myReason = DROP_NO_ROUTE;
NS_LOG_DEBUG ("DROP_NO_ROUTE");
break;
case Ipv4L3Protocol::DROP_BAD_CHECKSUM:
myReason = DROP_BAD_CHECKSUM;
NS_LOG_DEBUG ("DROP_BAD_CHECKSUM");
break;
default:
myReason = DROP_INVALID_REASON;
NS_FATAL_ERROR ("Unexpected drop reason code " << reason);
}
m_flowMonitor->ReportDrop (this, flowId, packetId, size, myReason);
}
}
} // namespace ns3

View File

@@ -0,0 +1,75 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#ifndef __IPV4_FLOW_PROBE_H__
#define __IPV4_FLOW_PROBE_H__
#include "ns3/flow-probe.h"
#include "ns3/ipv4-flow-classifier.h"
#include "ns3/ipv4-l3-protocol.h"
namespace ns3 {
class FlowMonitor;
class Node;
/// \brief Class that monitors flows at the IPv4 layer of a Node
///
/// For each node in the simulation, one instance of the class
/// Ipv4FlowProbe is created to monitor that node. Ipv4FlowProbe
/// accomplishes this by connecting callbacks to trace sources in the
/// Ipv4L3Protocol interface of the node.
class Ipv4FlowProbe : public FlowProbe
{
public:
Ipv4FlowProbe (Ptr<FlowMonitor> monitor, Ptr<Ipv4FlowClassifier> classifier, Ptr<Node> node);
~Ipv4FlowProbe ();
/// \brief enumeration of possible reasons why a packet may be dropped
enum DropReason
{
/// Packet dropped due to missing route to the destination
DROP_NO_ROUTE = 0,
/// Packet dropped due to TTL decremented to zero during IPv4 forwarding
DROP_TTL_EXPIRE,
/// Packet dropped due to invalid checksum in the IPv4 header
DROP_BAD_CHECKSUM,
// DROP_QUEUE, // TODO: this is not easy to do
DROP_INVALID_REASON,
};
private:
void SendOutgoingLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
void ForwardLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
void ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload, uint32_t interface);
void DropLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload,
Ipv4L3Protocol::DropReason reason, uint32_t ifIndex);
Ptr<Ipv4FlowClassifier> m_classifier;
};
} // namespace ns3
#endif

2
src/contrib/flow-monitor/waf vendored Executable file
View File

@@ -0,0 +1,2 @@
#! /bin/sh
exec "`dirname "$0"`"/../../../waf "$@"

View File

@@ -0,0 +1,23 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
obj = bld.create_ns3_module('flow-monitor', ['internet-stack'])
obj.source = [
'flow-monitor.cc',
'flow-classifier.cc',
'flow-probe.cc',
'ipv4-flow-classifier.cc',
'ipv4-flow-probe.cc',
'histogram.cc',
]
headers = bld.new_task_gen('ns3header')
headers.module = 'flow-monitor'
headers.source = [
'flow-monitor.h',
'flow-probe.h',
'flow-classifier.h',
'ipv4-flow-classifier.h',
'ipv4-flow-probe.h',
'histogram.h',
]

View File

@@ -0,0 +1,110 @@
// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#include "flow-monitor-helper.h"
#include "ns3/flow-monitor.h"
#include "ns3/ipv4-flow-classifier.h"
#include "ns3/ipv4-flow-probe.h"
#include "ns3/ipv4-l3-protocol.h"
#include "ns3/node.h"
#include "ns3/node-list.h"
namespace ns3 {
FlowMonitorHelper::FlowMonitorHelper ()
{
m_monitorFactory.SetTypeId ("ns3::FlowMonitor");
}
void
FlowMonitorHelper::SetMonitorAttribute (std::string n1, const AttributeValue &v1)
{
m_monitorFactory.Set (n1, v1);
}
Ptr<FlowMonitor>
FlowMonitorHelper::GetMonitor ()
{
if (!m_flowMonitor)
{
m_flowMonitor = m_monitorFactory.Create<FlowMonitor> ();
m_flowClassifier = Create<Ipv4FlowClassifier> ();
m_flowMonitor->SetFlowClassifier (m_flowClassifier);
}
return m_flowMonitor;
}
Ptr<FlowClassifier>
FlowMonitorHelper::GetClassifier ()
{
if (!m_flowClassifier)
{
m_flowClassifier = Create<Ipv4FlowClassifier> ();
}
return m_flowClassifier;
}
Ptr<FlowMonitor>
FlowMonitorHelper::Install (Ptr<Node> node)
{
Ptr<FlowMonitor> monitor = GetMonitor ();
Ptr<FlowClassifier> classifier = GetClassifier ();
Ptr<Ipv4FlowProbe> probe = Create<Ipv4FlowProbe> (monitor,
DynamicCast<Ipv4FlowClassifier> (classifier),
node);
return m_flowMonitor;
}
Ptr<FlowMonitor>
FlowMonitorHelper::Install (NodeContainer nodes)
{
for (NodeContainer::Iterator i = nodes.Begin (); i != nodes.End (); ++i)
{
Ptr<Node> node = *i;
if (node->GetObject<Ipv4L3Protocol> ())
{
Install (node);
}
}
return m_flowMonitor;
}
Ptr<FlowMonitor>
FlowMonitorHelper::InstallAll ()
{
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
{
Ptr<Node> node = *i;
if (node->GetObject<Ipv4L3Protocol> ())
{
Install (node);
}
}
return m_flowMonitor;
}
} // namespace ns3

View File

@@ -0,0 +1,66 @@
// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#ifndef FLOW_MONITOR_HELPER_H
#define FLOW_MONITOR_HELPER_H
#include "node-container.h"
#include "ns3/object-factory.h"
#include "ns3/flow-monitor.h"
#include "ns3/flow-classifier.h"
#include <string>
namespace ns3 {
class AttributeValue;
class Ipv4FlowClassifier;
/// \brief Helper to enable IPv4 flow monitoring on a set of Nodes
class FlowMonitorHelper
{
public:
FlowMonitorHelper ();
/// \brief Set an attribute for the to-be-created FlowMonitor object
void SetMonitorAttribute (std::string n1, const AttributeValue &v1);
/// \brief Enable flow monitoring on a set of nodes
Ptr<FlowMonitor> Install (NodeContainer nodes);
/// \brief Enable flow monitoring on a single node
Ptr<FlowMonitor> Install (Ptr<Node> node);
/// \brief Enable flow monitoring on all nodes
Ptr<FlowMonitor> InstallAll ();
/// \brief Retrieve the FlowMonitor object created by the Install* methods
Ptr<FlowMonitor> GetMonitor ();
/// \brief Retrieve the FlowClassifier object created by the Install* methods
Ptr<FlowClassifier> GetClassifier ();
private:
ObjectFactory m_monitorFactory;
Ptr<FlowMonitor> m_flowMonitor;
Ptr<FlowClassifier> m_flowClassifier;
};
} // namespace ns3
#endif /* FLOW_MONITOR_HELPER_H */

View File

@@ -338,13 +338,13 @@ InternetStackHelper::EnableAscii (std::ostream &os, NodeContainer n)
{
Ptr<Node> node = *i;
oss << "/NodeList/" << node->GetId () << "/$ns3::Ipv4L3Protocol/Drop";
Config::Connect (oss.str (), MakeBoundCallback (&InternetStackHelper::AsciiDropEvent, writer));
Config::Connect (oss.str (), MakeBoundCallback (&InternetStackHelper::AsciiDropEventIpv4, writer));
oss.str ("");
oss << "/NodeList/" << node->GetId () << "/$ns3::ArpL3Protocol/Drop";
Config::Connect (oss.str (), MakeBoundCallback (&InternetStackHelper::AsciiDropEvent, writer));
Config::Connect (oss.str (), MakeBoundCallback (&InternetStackHelper::AsciiDropEventArp, writer));
oss.str ("");
oss << "/NodeList/" << node->GetId () << "/$ns3::Ipv6L3Protocol/Drop";
Config::Connect (oss.str (), MakeBoundCallback (&InternetStackHelper::AsciiDropEvent, writer));
Config::Connect (oss.str (), MakeBoundCallback (&InternetStackHelper::AsciiDropEventIpv6, writer));
oss.str ("");
}
}
@@ -428,9 +428,29 @@ InternetStackHelper::GetStream (uint32_t nodeId, uint32_t interfaceId)
}
void
InternetStackHelper::AsciiDropEvent (Ptr<AsciiWriter> writer, std::string path, Ptr<const Packet> packet)
InternetStackHelper::AsciiDropEventArp (Ptr<AsciiWriter> writer, std::string path, Ptr<const Packet> packet)
{
writer->WritePacket (AsciiWriter::DROP, path, packet);
}
void
InternetStackHelper::AsciiDropEventIpv4 (Ptr<AsciiWriter> writer, std::string path,
Ipv4Header const &header, Ptr<const Packet> packet,
Ipv4L3Protocol::DropReason reason, uint32_t interface)
{
Ptr<Packet> p = packet->Copy ();
p->AddHeader (header);
writer->WritePacket (AsciiWriter::DROP, path, p);
}
void
InternetStackHelper::AsciiDropEventIpv6 (Ptr<AsciiWriter> writer, std::string path,
Ipv6Header const &header, Ptr<const Packet> packet,
Ipv6L3Protocol::DropReason reason, uint32_t interface)
{
Ptr<Packet> p = packet->Copy ();
p->AddHeader (header);
writer->WritePacket (AsciiWriter::DROP, path, p);
}
} // namespace ns3

View File

@@ -28,6 +28,8 @@
#include "ns3/object-factory.h"
#include "ns3/pcap-writer.h"
#include "ns3/ascii-writer.h"
#include "ns3/ipv4-l3-protocol.h"
#include "ns3/ipv6-l3-protocol.h"
namespace ns3 {
@@ -198,7 +200,14 @@ private:
uint32_t interfaceId;
Ptr<PcapWriter> writer;
};
static void AsciiDropEvent (Ptr<AsciiWriter> writer, std::string path, Ptr<const Packet> packet);
static void AsciiDropEventIpv4 (Ptr<AsciiWriter> writer, std::string path,
Ipv4Header const &header, Ptr<const Packet> packet,
Ipv4L3Protocol::DropReason reason, uint32_t interface);
static void AsciiDropEventArp (Ptr<AsciiWriter> writer, std::string path, Ptr<const Packet> packet);
static void AsciiDropEventIpv6 (Ptr<AsciiWriter> writer, std::string path,
Ipv6Header const &header, Ptr<const Packet> packet,
Ipv6L3Protocol::DropReason reason, uint32_t interface);
static std::string m_pcapBaseFilename;
static uint32_t GetNodeIndex (std::string context);
static std::vector<Trace> m_traces;

View File

@@ -38,6 +38,7 @@ def build(bld):
'ipv6-list-routing-helper.cc',
'ipv6-routing-helper.cc',
'ping6-helper.cc',
'flow-monitor-helper.cc',
]
headers = bld.new_task_gen('ns3header')
@@ -79,6 +80,7 @@ def build(bld):
'ipv6-list-routing-helper.h',
'ipv6-routing-helper.h',
'ping6-helper.h',
'flow-monitor-helper.h',
]
env = bld.env_of_name('default')

View File

@@ -69,6 +69,14 @@ Ipv4L3Protocol::GetTypeId (void)
ObjectVectorValue (),
MakeObjectVectorAccessor (&Ipv4L3Protocol::m_interfaces),
MakeObjectVectorChecker<Ipv4Interface> ())
.AddTraceSource ("SendOutgoing", "A newly-generated by this node ipv4 packet is about to be queued for transmission",
MakeTraceSourceAccessor (&Ipv4L3Protocol::m_sendOutgoingTrace))
.AddTraceSource ("UnicastForward", "A unicast ipv4 packet was received by this node and is being forwarded to another node",
MakeTraceSourceAccessor (&Ipv4L3Protocol::m_unicastForwardTrace))
.AddTraceSource ("LocalDeliver", "An ipv4 packet was received by/for this node, and it is being forward up the stack",
MakeTraceSourceAccessor (&Ipv4L3Protocol::m_localDeliverTrace))
;
return tid;
}
@@ -369,7 +377,7 @@ Ipv4L3Protocol::Receive( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t pr
Ptr<Ipv4Interface> ipv4Interface;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
i != m_interfaces.end ();
i++)
i++, interface++)
{
ipv4Interface = *i;
if (ipv4Interface->GetDevice () == device)
@@ -382,11 +390,12 @@ Ipv4L3Protocol::Receive( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t pr
else
{
NS_LOG_LOGIC ("Dropping received packet-- interface is down");
m_dropTrace (packet);
Ipv4Header ipHeader;
packet->RemoveHeader (ipHeader);
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, interface);
return;
}
}
interface++;
}
Ipv4Header ipHeader;
@@ -398,7 +407,7 @@ Ipv4L3Protocol::Receive( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t pr
if (!ipHeader.IsChecksumOk ())
{
m_dropTrace (packet);
m_dropTrace (ipHeader, packet, DROP_BAD_CHECKSUM, interface);
return;
}
@@ -477,6 +486,8 @@ Ipv4L3Protocol::Send (Ptr<Packet> packet,
Ptr<Packet> packetCopy = packet->Copy ();
NS_ASSERT (packetCopy->GetSize () <= outInterface->GetDevice()->GetMtu ());
m_sendOutgoingTrace (ipHeader, packetCopy, ifaceIndex);
packetCopy->AddHeader (ipHeader);
m_txTrace (packetCopy, ifaceIndex);
outInterface->Send (packetCopy, destination);
@@ -501,6 +512,7 @@ Ipv4L3Protocol::Send (Ptr<Packet> packet,
ttl = 1;
ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
Ptr<Packet> packetCopy = packet->Copy ();
m_sendOutgoingTrace (ipHeader, packetCopy, ifaceIndex);
packetCopy->AddHeader (ipHeader);
m_txTrace (packetCopy, ifaceIndex);
outInterface->Send (packetCopy, destination);
@@ -515,6 +527,8 @@ Ipv4L3Protocol::Send (Ptr<Packet> packet,
{
NS_LOG_LOGIC ("Ipv4L3Protocol::Send case 3: passed in with route");
ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
int32_t interface = GetInterfaceForDevice (route->GetOutputDevice ());
m_sendOutgoingTrace (ipHeader, packet, interface);
SendRealOut (route, packet, ipHeader);
return;
}
@@ -535,12 +549,14 @@ Ipv4L3Protocol::Send (Ptr<Packet> packet,
Ptr<Ipv4Route> newRoute = m_routingProtocol->RouteOutput (packet, ipHeader, oif, errno_);
if (newRoute)
{
int32_t interface = GetInterfaceForDevice (newRoute->GetOutputDevice ());
m_sendOutgoingTrace (ipHeader, packet, interface);
SendRealOut (newRoute, packet, ipHeader);
}
else
{
NS_LOG_WARN ("No route to host. Drop.");
m_dropTrace (packet);
m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, 0);
}
}
@@ -590,16 +606,13 @@ Ipv4L3Protocol::SendRealOut (Ptr<Ipv4Route> route,
{
NS_LOG_FUNCTION (this << packet << &ipHeader);
// We add a header regardless of whether there is a route, since
// we may want to drop trace
packet->AddHeader (ipHeader);
if (route == 0)
{
NS_LOG_WARN ("No route to host. Drop.");
m_dropTrace (packet);
m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, 0);
return;
}
packet->AddHeader (ipHeader);
Ptr<NetDevice> outDev = route->GetOutputDevice ();
int32_t interface = GetInterfaceForDevice (outDev);
NS_ASSERT (interface >= 0);
@@ -618,7 +631,9 @@ Ipv4L3Protocol::SendRealOut (Ptr<Ipv4Route> route,
else
{
NS_LOG_LOGIC ("Dropping-- outgoing interface is down: " << route->GetGateway ());
m_dropTrace (packet);
Ipv4Header ipHeader;
packet->RemoveHeader (ipHeader);
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, interface);
}
}
else
@@ -632,7 +647,9 @@ Ipv4L3Protocol::SendRealOut (Ptr<Ipv4Route> route,
else
{
NS_LOG_LOGIC ("Dropping-- outgoing interface is down: " << ipHeader.GetDestination ());
m_dropTrace (packet);
Ipv4Header ipHeader;
packet->RemoveHeader (ipHeader);
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, interface);
}
}
}
@@ -655,7 +672,7 @@ Ipv4L3Protocol::IpMulticastForward (Ptr<Ipv4MulticastRoute> mrtentry, Ptr<const
if (h.GetTtl () == 0)
{
NS_LOG_WARN ("TTL exceeded. Drop.");
m_dropTrace (packet);
m_dropTrace (header, packet, DROP_TTL_EXPIRED, i);
return;
}
NS_LOG_LOGIC ("Forward multicast via interface " << i);
@@ -679,6 +696,7 @@ Ipv4L3Protocol::IpForward (Ptr<Ipv4Route> rtentry, Ptr<const Packet> p, const Ip
// Forwarding
Ipv4Header ipHeader = header;
Ptr<Packet> packet = p->Copy ();
int32_t interface = GetInterfaceForDevice (rtentry->GetOutputDevice ());
ipHeader.SetTtl (ipHeader.GetTtl () - 1);
if (ipHeader.GetTtl () == 0)
{
@@ -691,9 +709,10 @@ Ipv4L3Protocol::IpForward (Ptr<Ipv4Route> rtentry, Ptr<const Packet> p, const Ip
icmp->SendTimeExceededTtl (ipHeader, packet);
}
NS_LOG_WARN ("TTL exceeded. Drop.");
m_dropTrace (packet);
m_dropTrace (header, packet, DROP_TTL_EXPIRED, interface);
return;
}
m_unicastForwardTrace (ipHeader, packet, interface);
SendRealOut (rtentry, packet, ipHeader);
}
@@ -703,6 +722,8 @@ Ipv4L3Protocol::LocalDeliver (Ptr<const Packet> packet, Ipv4Header const&ip, uin
NS_LOG_FUNCTION (this << packet << &ip);
Ptr<Packet> p = packet->Copy (); // need to pass a non-const packet up
m_localDeliverTrace (ip, packet, iif);
Ptr<Ipv4L4Protocol> protocol = GetProtocol (ip.GetProtocol ());
if (protocol != 0)
{
@@ -891,7 +912,7 @@ Ipv4L3Protocol::RouteInputError (Ptr<const Packet> p, const Ipv4Header & ipHeade
{
NS_LOG_FUNCTION (this << p << ipHeader << sockErrno);
NS_LOG_LOGIC ("Route input failure-- dropping packet to " << ipHeader << " with errno " << sockErrno);
m_dropTrace (p);
m_dropTrace (ipHeader, p, DROP_ROUTE_ERROR, 0);
}

View File

@@ -63,6 +63,15 @@ public:
Ipv4L3Protocol();
virtual ~Ipv4L3Protocol ();
enum DropReason
{
DROP_TTL_EXPIRED = 1,
DROP_NO_ROUTE,
DROP_BAD_CHECKSUM,
DROP_INTERFACE_DOWN,
DROP_ROUTE_ERROR,
};
void SetNode (Ptr<Node> node);
// functions defined in base class Ipv4
@@ -215,9 +224,15 @@ private:
uint8_t m_defaultTtl;
uint16_t m_identification;
Ptr<Node> m_node;
TracedCallback<const Ipv4Header &, Ptr<const Packet>, uint32_t> m_sendOutgoingTrace;
TracedCallback<const Ipv4Header &, Ptr<const Packet>, uint32_t> m_unicastForwardTrace;
TracedCallback<const Ipv4Header &, Ptr<const Packet>, uint32_t> m_localDeliverTrace;
TracedCallback<Ptr<const Packet>, uint32_t> m_txTrace;
TracedCallback<Ptr<const Packet>, uint32_t> m_rxTrace;
TracedCallback<Ptr<const Packet> > m_dropTrace;
// <ip-header, payload, reason, ifindex> (ifindex not valid if reason is DROP_NO_ROUTE)
TracedCallback<const Ipv4Header &, Ptr<const Packet>, DropReason, uint32_t> m_dropTrace;
Ptr<Ipv4RoutingProtocol> m_routingProtocol;

View File

@@ -646,7 +646,7 @@ void Ipv6L3Protocol::Send (Ptr<Packet> packet, Ipv6Address source, Ipv6Address d
else
{
NS_LOG_WARN ("No route to host, drop!");
m_dropTrace (packet);
m_dropTrace (hdr, packet, DROP_NO_ROUTE, oif);
}
}
@@ -672,7 +672,9 @@ void Ipv6L3Protocol::Receive (Ptr<NetDevice> device, Ptr<const Packet> p, uint16
else
{
NS_LOG_LOGIC ("Dropping received packet-- interface is down");
m_dropTrace (packet);
Ipv6Header hdr;
packet->RemoveHeader (hdr);
m_dropTrace (hdr, packet, DROP_INTERFACE_DOWN, interface);
return;
}
}
@@ -701,8 +703,6 @@ void Ipv6L3Protocol::SendRealOut (Ptr<Ipv6Route> route, Ptr<Packet> packet, Ipv6
{
NS_LOG_FUNCTION (this << route << packet << ipHeader);
packet->AddHeader (ipHeader);
if (!route)
{
NS_LOG_LOGIC ("No route to host, drop!.");
@@ -716,20 +716,20 @@ void Ipv6L3Protocol::SendRealOut (Ptr<Ipv6Route> route, Ptr<Packet> packet, Ipv6
Ptr<Ipv6Interface> outInterface = GetInterface (interface);
NS_LOG_LOGIC ("Send via NetDevice ifIndex " << dev->GetIfIndex () << " Ipv6InterfaceIndex " << interface);
NS_ASSERT (packet->GetSize () <= outInterface->GetDevice ()->GetMtu ());
if (!route->GetGateway ().IsEqual (Ipv6Address::GetAny ()))
{
if (outInterface->IsUp ())
{
NS_LOG_LOGIC ("Send to gateway " << route->GetGateway ());
packet->AddHeader (ipHeader);
NS_ASSERT (packet->GetSize () <= outInterface->GetDevice ()->GetMtu ());
m_txTrace (packet, interface);
outInterface->Send (packet, route->GetGateway ());
}
else
{
NS_LOG_LOGIC ("Dropping-- outgoing interface is down: " << route->GetGateway ());
m_dropTrace (packet);
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, interface);
}
}
else
@@ -737,13 +737,15 @@ void Ipv6L3Protocol::SendRealOut (Ptr<Ipv6Route> route, Ptr<Packet> packet, Ipv6
if (outInterface->IsUp ())
{
NS_LOG_LOGIC ("Send to destination " << ipHeader.GetDestinationAddress ());
packet->AddHeader (ipHeader);
NS_ASSERT (packet->GetSize () <= outInterface->GetDevice ()->GetMtu ());
m_txTrace (packet, interface);
outInterface->Send (packet, ipHeader.GetDestinationAddress ());
}
else
{
NS_LOG_LOGIC ("Dropping-- outgoing interface is down: " << ipHeader.GetDestinationAddress ());
m_dropTrace (packet);
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, interface);
}
}
}
@@ -766,6 +768,8 @@ void Ipv6L3Protocol::IpForward (Ptr<Ipv6Route> rtentry, Ptr<const Packet> p, con
if (ipHeader.GetHopLimit () == 0)
{
NS_LOG_WARN ("TTL exceeded. Drop.");
m_dropTrace (ipHeader, packet, DROP_TTL_EXPIRED, 0);
// Do not reply to ICMPv6 or to multicast IPv6 address
if (ipHeader.GetNextHeader () != Icmpv6L4Protocol::PROT_NUMBER &&
ipHeader.GetDestinationAddress ().IsMulticast () == false)
@@ -773,8 +777,6 @@ void Ipv6L3Protocol::IpForward (Ptr<Ipv6Route> rtentry, Ptr<const Packet> p, con
packet->AddHeader (ipHeader);
GetIcmpv6 ()->SendErrorTimeExceeded (packet, ipHeader.GetSourceAddress (), Icmpv6Header::ICMPV6_HOPLIMIT);
}
NS_LOG_WARN ("TTL exceeded. Drop.");
m_dropTrace (packet);
return;
}
@@ -832,7 +834,7 @@ void Ipv6L3Protocol::IpMulticastForward (Ptr<Ipv6MulticastRoute> mrtentry, Ptr<c
if (h.GetHopLimit () == 0)
{
NS_LOG_WARN ("TTL exceeded. Drop.");
m_dropTrace (packet);
m_dropTrace (header, packet, DROP_TTL_EXPIRED, i);
return;
}
@@ -882,7 +884,7 @@ void Ipv6L3Protocol::RouteInputError (Ptr<const Packet> p, const Ipv6Header& ipH
{
NS_LOG_FUNCTION (this << p << ipHeader << sockErrno);
NS_LOG_LOGIC ("Route input failure-- dropping packet to " << ipHeader << " with errno " << sockErrno);
m_dropTrace (p);
m_dropTrace (ipHeader, p, DROP_ROUTE_ERROR, 0);
}
Ipv6Header Ipv6L3Protocol::BuildHeader (Ipv6Address src, Ipv6Address dst, uint8_t protocol, uint16_t payloadSize, uint8_t ttl)

View File

@@ -59,6 +59,15 @@ class Ipv6L3Protocol : public Ipv6
* \brief The protocol number for IPv6 (0x86DD).
*/
static const uint16_t PROT_NUMBER;
enum DropReason
{
DROP_TTL_EXPIRED = 1,
DROP_NO_ROUTE,
DROP_BAD_CHECKSUM,
DROP_INTERFACE_DOWN,
DROP_ROUTE_ERROR,
};
/**
* \brief Constructor.
@@ -344,7 +353,7 @@ class Ipv6L3Protocol : public Ipv6
/**
* \brief Callback to trace drop packets.
*/
TracedCallback<Ptr<const Packet> > m_dropTrace;
TracedCallback<const Ipv6Header &, Ptr<const Packet>, DropReason, uint32_t> m_dropTrace;
/**
* \brief Copy constructor.

View File

@@ -122,6 +122,7 @@ def build(bld):
'icmpv4.h',
'icmpv6-header.h',
'ipv4-l3-protocol.h',
'ipv6-l3-protocol.h',
'arp-l3-protocol.h',
'udp-l4-protocol.h',
'tcp-l4-protocol.h',

View File

@@ -43,6 +43,7 @@ all_modules = (
'applications/radvd',
'test/ns3tcp',
'test/ns3wifi',
'contrib/flow-monitor',
)
def set_options(opt):