diff --git a/.hgignore b/.hgignore index 96ea69ce7..c19d9d91a 100644 --- a/.hgignore +++ b/.hgignore @@ -1,11 +1,10 @@ -.*.orig$ -.*\.o$ -.*~$ -build-dir -build -.*\.sconsign -doc/html.* -doc/latex.* -.lock-wscript -.waf* -waf +\.rej$ +\.orig$ +\.o$ +~$ +^build-dir +^build +^doc/html +^doc/latex +^\.lock-wscript +^\.waf diff --git a/.hgtags b/.hgtags index aac74dfcf..35f08ab9c 100644 --- a/.hgtags +++ b/.hgtags @@ -4,3 +4,5 @@ 38099dd26e9467b8f49f8632f22789858149a6e7 release ns-3.0.3 5701e60bf01a8ac1308945e69001e0cc07948faf release ns-3.0.4 08046b6aef37932507696a2f2f427b42d693781e release ns-3.0.5 +267e2ebc28e4e4ae2f579e1cfc29902acade0c34 buffer-working-before-breaking +606df29888e7573b825fc891a002f0757166b616 release ns-3.0.6 diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 85a5f2d6e..e429e5fec 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -3,6 +3,13 @@ This file contains ns-3 release notes (most recent releases first). +Release 3.0.6 (2007/09/15) +======================== + - Static multicast IPv4 routing + - Logging overhaul (NS_LOG macros) + - Refactoring of tracing subsystem + - Tutorial document started + Release 3.0.5 (2007/08/15) ======================== diff --git a/SConstruct b/SConstruct deleted file mode 100644 index 9c9a2567c..000000000 --- a/SConstruct +++ /dev/null @@ -1,521 +0,0 @@ -## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- - -import os.path -import build - -version_file = open ('VERSION', 'r') -version = version_file.readline () -version_file.close () -version = version.strip () - -ns3 = build.Ns3() -ns3.build_dir = 'build-dir' -ns3.version = version -ns3.name = 'ns3' -ns3.distname = 'ns' -ns3.doxygen_config = os.path.join('doc', 'doxygen.conf') -ns3.add_extra_dist(os.path.join('doc', 'main.txt')) -ns3.add_extra_dist ('doc/architecture.pdf') -ns3.add_extra_dist ('doc/contributing.txt') -ns3.add_extra_dist ('doc/build.txt') -ns3.add_extra_dist ('doc/codingstd.txt') -ns3.add_extra_dist ('doc/mercurial.txt') -ns3.add_extra_dist ('README') -ns3.add_extra_dist ('RELEASE_NOTES') -ns3.add_extra_dist ('AUTHORS') -ns3.add_extra_dist ('VERSION') - -ns3.add_extra_dist('doc/build-waf.txt') -ns3.add_extra_dist('ns3/_placeholder_') -for wscript in [ - "src/core/wscript", - "src/node/wscript", - "src/devices/p2p/wscript", - "src/common/wscript", - "src/applications/wscript", - "src/simulator/wscript", - "src/internet-node/wscript", - "src/wscript", - "utils/wscript", - "samples/wscript", - "examples/wscript", - "wscript", - ]: - ns3.add_extra_dist(wscript) -ns3.add_extra_dist('waf') -ns3.add_extra_dist('waf.bat') - -# -# The Core module -# -core = build.Ns3Module('core', 'src/core') -ns3.add(core) -core.add_sources([ - 'callback-test.cc', - 'debug.cc', - 'assert.cc', - 'ptr.cc', - 'object.cc', - 'test.cc', - 'random-variable.cc', - 'rng-stream.cc', - 'uid-manager.cc', - 'default-value.cc', - 'command-line.cc', - 'type-name.cc', - 'component-manager.cc', - ]) -env = Environment() -if env['PLATFORM'] == 'posix' or env['PLATFORM'] == 'darwin' or env['PLATFORM'] == 'cygwin': - core.add_external_dep('pthread') - core.add_sources([ - 'unix-system-wall-clock-ms.cc', - ]) -elif env['PLATFORM'] == 'win32': - core.add_sources([ - 'win32-system-wall-clock-ms.cc', - ]) -core.add_headers ([ - 'uid-manager.h', - 'singleton.h', -]) -core.add_inst_headers([ - 'system-wall-clock-ms.h', - 'empty.h', - 'callback.h', - 'ptr.h', - 'object.h', - 'debug.h', - 'assert.h', - 'fatal-error.h', - 'test.h', - 'random-variable.h', - 'rng-stream.h', - 'default-value.h', - 'command-line.h', - 'type-name.h', - 'component-manager.h', - ]) - -def config_core (env, config): - retval = [] - # XXX This check is primitive but it should be - # good enough for now. - if config.CheckCHeader ('stdlib.h') == 1: - retval.append ('#define HAVE_STDLIB_H 1') - retval.append ('#define HAVE_GETENV 1') - else: - retval.append ('#undef HAVE_STDLIB_H') - retval.append ('#undef HAVE_GETENV') - return retval -core.add_config (config_core) - -# -# The Simulator module -# -simu = build.Ns3Module('simulator', 'src/simulator') -ns3.add(simu) -simu.add_dep('core') -simu.add_external_dep('m') -simu.add_sources([ - 'high-precision.cc', - 'time.cc', - 'event-id.cc', - 'scheduler.cc', - 'scheduler-factory.cc', - 'scheduler-list.cc', - 'scheduler-heap.cc', - 'scheduler-map.cc', - 'event-impl.cc', - 'simulator.cc', - ]) -simu.add_headers([ - 'scheduler-heap.h', - 'scheduler-map.h', - 'scheduler-list.h' - ]) -simu.add_inst_headers([ - 'high-precision.h', - 'nstime.h', - 'event-id.h', - 'event-impl.h', - 'simulator.h', - 'scheduler.h', - 'scheduler-factory.h', - 'simulation-singleton.h', - ]) -high_precision_as_double = ARGUMENTS.get('high-precision-as-double', 'n') -if high_precision_as_double == 'y': - simu.add_inst_header ('high-precision-double.h') - simu.add_source ('high-precision-double.cc') -else: - simu.add_inst_headers ([ - 'high-precision-128.h', - 'cairo-wideint-private.h' - ]) - simu.add_sources ([ - 'high-precision-128.cc', - 'cairo-wideint.c', - ]) - -def config_simulator (env, config): - retval = [] - high_precision_as_double = ARGUMENTS.get('high-precision-as-double', 'n') - if high_precision_as_double == 'y': - retval.append ('#define USE_HIGH_PRECISION_DOUBLE 1') - else: - retval.append ('#undef USE_HIGH_PRECISION_DOUBLE') - if config.CheckCHeader ('stdint.h') == 1: - retval.append ('#define HAVE_STDINT_H 1') - elif config.CheckCHeader ('inttypes.h') == 1: - retval.append ('#define HAVE_INTTYPES_H 1') - elif config.CheckCHeader ('sys/inttypes.h') == 1: - retval.append ('#define HAVE_SYS_INT_TYPES_H 1') - return retval -simu.add_config (config_simulator) - -# -# The Common module -# -common = build.Ns3Module('common', 'src/common') -common.add_deps(['core', 'simulator']) -ns3.add(common) -common.add_sources([ - 'buffer.cc', - 'chunk.cc', - 'header.cc', - 'trailer.cc', - 'packet-printer.cc', - 'packet-metadata.cc', - 'packet.cc', - 'tags.cc', - 'pcap-writer.cc', - 'variable-tracer-test.cc', - 'trace-context.cc', - 'trace-resolver.cc', - 'callback-trace-source.cc', - 'empty-trace-resolver.cc', - 'composite-trace-resolver.cc', - 'trace-root.cc', - 'data-rate.cc', - ]) -common.add_headers ([ - ]) -common.add_inst_headers([ - 'buffer.h', - 'chunk.h', - 'header.h', - 'trailer.h', - 'tags.h', - 'packet.h', - 'packet-printer.h', - 'packet-metadata.h', - 'uv-trace-source.h', - 'sv-trace-source.h', - 'fv-trace-source.h', - 'pcap-writer.h', - 'callback-trace-source.h', - 'trace-context.h', - 'trace-resolver.h', - 'empty-trace-resolver.h', - 'composite-trace-resolver.h', - 'array-trace-resolver.h', - 'trace-root.h', - 'terminal-trace-resolver.h', - 'data-rate.h', - ]) - -# -# The Node module -# -node = build.Ns3Module ('node', 'src/node') -ns3.add (node) -node.add_deps (['core', 'common', 'simulator']) -node.add_sources ([ - 'node.cc', - 'ipv4-address.cc', - 'net-device.cc', - 'mac-address.cc', - 'llc-snap-header.cc', - 'ipv4-route.cc', - 'queue.cc', - 'drop-tail-queue.cc', - 'channel.cc', - 'node-list.cc', - 'socket.cc', - 'socket-factory.cc', - 'udp.cc', - 'ipv4.cc', - 'application.cc', - ]) -node.add_inst_headers ([ - 'node.h', - 'ipv4-address.h', - 'net-device.h', - 'mac-address.h', - 'ipv4-route.h', - 'queue.h', - 'drop-tail-queue.h', - 'llc-snap-header.h', - 'channel.h', - 'node-list.h', - 'socket.h', - 'socket-factory.h', - 'udp.h', - 'ipv4.h', - 'application.h', - ]) - -# -# The Applications module -# -applications = build.Ns3Module ('applications', 'src/applications') -ns3.add (applications) -applications.add_deps (['node']) -applications.add_sources ([ - 'onoff-application.cc', -]) -applications.add_inst_headers ([ - 'onoff-application.h', -]) - -# -# The Internet Node module -# -inode = build.Ns3Module ('internet-node', 'src/internet-node') -ns3.add (inode) -inode.add_deps (['node', 'routing']) -inode.add_sources ([ - 'internet-node.cc', - 'l3-demux.cc', - 'l3-protocol.cc', - 'ipv4-l4-demux.cc', - 'ipv4-l4-protocol.cc', - 'ipv4-header.cc', - 'udp-header.cc', - 'ipv4-checksum.cc', - 'ipv4-interface.cc', - 'ipv4-l3-protocol.cc', - 'ipv4-end-point.cc', - 'udp-l4-protocol.cc', - 'arp-header.cc', - 'arp-cache.cc', - 'arp-ipv4-interface.cc', - 'arp-l3-protocol.cc', - 'ipv4-loopback-interface.cc', - 'header-utils.cc', - 'udp-socket.cc', - 'ipv4-end-point-demux.cc', - 'arp-private.cc', - 'ipv4-impl.cc', - 'ipv4-private.cc', - 'ascii-trace.cc', - 'pcap-trace.cc', - 'udp-impl.cc', -]) -inode.add_headers ([ - 'ipv4-checksum.h', - 'arp-header.h', - 'arp-cache.h', - 'arp-l3-protocol.h', - 'ipv4-loopback-interface.h', - 'l3-demux.h', - 'header-utils.h', - 'arp-ipv4-interface.h', - 'udp-socket.h', - 'udp-l4-protocol.h', - 'arp-private.h', - 'ipv4-impl.h', - 'ipv4-private.h', - 'ipv4-l3-protocol.h', - 'l3-protocol.h', - 'ipv4-l4-protocol.h', - 'ipv4-l4-demux.h', - 'ipv4-end-point-demux.h', - 'ipv4-end-point.h', - 'ipv4-header.h', - 'ipv4-interface.h', - 'udp-header.h', - 'sgi-hashmap.h', - 'udp-impl.h', -]) -inode.add_inst_headers ([ - 'internet-node.h', - 'ascii-trace.h', - 'pcap-trace.h', - 'ipv4-header.h', - 'udp-header.h', -]) - -# -# The Point-to-point module -# -p2p = build.Ns3Module ('p2p', 'src/devices/p2p') -ns3.add (p2p) -p2p.add_deps (['node']) -p2p.add_sources ([ - 'p2p-net-device.cc', - 'p2p-channel.cc', - 'p2p-topology.cc', - ]) -p2p.add_inst_headers ([ - 'p2p-net-device.h', - 'p2p-channel.h', - 'p2p-topology.h', - ]) - -# -# The Routing module -# -routing = build.Ns3Module('routing', 'src/routing') -routing.add_deps(['core', 'node']) -ns3.add(routing) -routing.add_sources([ - 'routing-environment.cc', - 'static-router.cc', - 'static-route-manager.cc', - 'static-route-manager-impl.cc', - 'candidate-queue.cc', - ]) -routing.add_headers ([ - 'candidate-queue.h', - 'static-route-manager-impl.h', - ]) -routing.add_inst_headers([ - 'routing-environment.h', - 'static-router.h', - 'static-route-manager.h', - ]) - -# utils -run_tests = build.Ns3Module('run-tests', 'utils') -ns3.add(run_tests) -run_tests.set_executable() -run_tests.add_deps(['core', 'simulator', 'common', 'routing']) -run_tests.add_source('run-tests.cc') - -bench_object = build.Ns3Module('bench-object', 'utils') -ns3.add(bench_object) -bench_object.set_executable() -bench_object.add_deps(['core']) -bench_object.add_source('bench-object.cc') - -bench_packets = build.Ns3Module('bench-packets', 'utils') -ns3.add(bench_packets) -bench_packets.set_executable() -bench_packets.add_deps (['core', 'common']) -bench_packets.add_source('bench-packets.cc') - -bench_simu = build.Ns3Module('bench-simulator', 'utils') -ns3.add(bench_simu) -bench_simu.set_executable() -bench_simu.add_dep('simulator') -bench_simu.add_source('bench-simulator.cc') - -replay_simu = build.Ns3Module('replay-simulation', 'utils') -ns3.add(replay_simu) -replay_simu.set_executable() -replay_simu.add_dep('simulator') -replay_simu.add_source('replay-simulation.cc') - - -# samples -sample_debug = build.Ns3Module('sample-debug', 'samples') -sample_debug.set_executable() -ns3.add(sample_debug) -sample_debug.add_dep('core') -sample_debug.add_source('main-debug.cc') -sample_debug.add_source('main-debug-other.cc') - -sample_packet_printer = build.Ns3Module('sample-packet-printer', 'samples') -sample_packet_printer.set_executable() -ns3.add(sample_packet_printer) -sample_packet_printer.add_deps (['common', 'internet-node']) -sample_packet_printer.add_source('main-packet-printer.cc') - -sample_callback = build.Ns3Module('sample-callback', 'samples') -sample_callback.set_executable() -ns3.add(sample_callback) -sample_callback.add_dep('core') -sample_callback.add_source('main-callback.cc') - -sample_ptr = build.Ns3Module('sample-ptr', 'samples') -sample_ptr.set_executable() -ns3.add(sample_ptr) -sample_ptr.add_dep('core') -sample_ptr.add_source('main-ptr.cc') - -sample_trace = build.Ns3Module('sample-trace', 'samples') -#ns3.add(sample_trace) -sample_trace.add_dep('common') -sample_trace.set_executable() -sample_trace.add_source('main-trace.cc') - -sample_query_interface = build.Ns3Module('sample-query-interface', 'samples') -ns3.add(sample_query_interface) -sample_query_interface.add_dep('common') -sample_query_interface.set_executable() -sample_query_interface.add_source('main-query-interface.cc') - -sample_simu = build.Ns3Module('sample-simulator', 'samples') -ns3.add(sample_simu) -sample_simu.set_executable() -sample_simu.add_dep('simulator') -sample_simu.add_source('main-simulator.cc') - -sample_packet = build.Ns3Module('sample-packet', 'samples') -ns3.add(sample_packet) -sample_packet.set_executable() -sample_packet.add_dep('common') -sample_packet.add_source('main-packet.cc') - -sample_test = build.Ns3Module('sample-test', 'samples') -sample_test.set_executable() -ns3.add(sample_test) -sample_test.add_dep('core') -sample_test.add_source('main-test.cc') - -sample_simple = build.Ns3Module('sample-simple', 'samples') -sample_simple.set_executable() -ns3.add(sample_simple) -sample_simple.add_deps(['core', 'simulator', 'node', 'internet-node', 'routing']) -sample_simple.add_source('main-simple.cc') - -sample_sp2p = build.Ns3Module('sample-simple-p2p', 'samples') -sample_sp2p.set_executable() -#n3.add(sample_sp2p) -sample_sp2p.add_deps(['core', 'simulator', 'node', 'internet-node', 'p2p']) -sample_sp2p.add_source('main-simple-p2p.cc') - -sample_default_value = build.Ns3Module('sample-default-value', 'samples') -sample_default_value.set_executable() -ns3.add(sample_default_value) -sample_default_value.add_deps(['core', 'simulator', 'node', 'p2p']) -sample_default_value.add_source('main-default-value.cc') - -sample_object = build.Ns3Module('sample-object', 'samples') -sample_object.set_executable() -ns3.add(sample_object) -sample_object.add_deps(['core']) -sample_object.add_source('main-object.cc') - -sample_component_manager = build.Ns3Module('sample-component-manager', 'samples') -sample_component_manager.set_executable() -ns3.add(sample_component_manager) -sample_component_manager.add_deps(['core']) -sample_component_manager.add_source('main-component-manager.cc') - -# examples -example_simple_p2p = build.Ns3Module('simple-p2p', 'examples') -example_simple_p2p.set_executable() -ns3.add(example_simple_p2p) -example_simple_p2p.add_deps(['core', 'simulator', 'node', 'p2p', 'internet-node', 'applications', 'routing']) -example_simple_p2p.add_source('simple-p2p.cc') - -example_static_routing = build.Ns3Module('simple-static-routing', 'examples') -example_static_routing.set_executable() -ns3.add(example_static_routing) -example_static_routing.add_deps(['core', 'simulator', 'node', 'p2p', 'internet-node', 'applications', 'routing']) -example_static_routing.add_source('simple-static-routing.cc') - -ns3.generate_dependencies() diff --git a/VERSION b/VERSION index eca690e73..818bd47ab 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.5 +3.0.6 diff --git a/doc/doxygen.conf b/doc/doxygen.conf index fc6fd25fa..ac0f72a0e 100644 --- a/doc/doxygen.conf +++ b/doc/doxygen.conf @@ -450,7 +450,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = src doc/main.txt +INPUT = src doc/main.txt doc/trace-source-list.h doc/tracing.h # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp @@ -514,7 +514,7 @@ EXAMPLE_RECURSIVE = NO # directories that contain image that are included in the documentation (see # the \image command). -IMAGE_PATH = +IMAGE_PATH = doc # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program diff --git a/doc/main.txt b/doc/main.txt index 3fc144687..37e1ed92d 100644 --- a/doc/main.txt +++ b/doc/main.txt @@ -23,6 +23,7 @@ * - \ref config * - a base class for objects which need to support reference counting * and QueryInterface: ns3::Object and ns3::InterfaceId + * - a set of low-level trace facilities integrated in the ns3::Object system: \ref tracing * - a ns3::ComponentManager which can be used to manage the creation * of any object which derives from ns3::Object through an ns3::ClassId * - a smart-pointer class ns3::Ptr designed to work together with ns3::Object @@ -33,11 +34,10 @@ * ns3::Scheduler and ns3::SchedulerFactory * - a simulator class used to create, schedule and cancel events: ns3::Simulator * - * The "common" module contains: + * The "core" module contains: * - a packet class to create and manipulate simulation packets: ns3::Packet, ns3::Header, * and ns3::Trailer. This packet class also supports per-packet ns3::Tag which are * globs of data which can be attached to any packet. - * - a set of low-level trace facilities: \ref lowleveltracing * * The "node" module contains: * - a ns3::Node base class which should be subclassed by any new type of diff --git a/doc/namespace-2.dia b/doc/namespace-2.dia new file mode 100644 index 000000000..5cd5ed59e --- /dev/null +++ b/doc/namespace-2.dia @@ -0,0 +1,1658 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/devices/[0-n]# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #NodeList# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Node# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/queue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/nodes/[0-n]# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/udp# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/rx# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/netdevice# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/ipv4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/interfaces/[0-n]# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/rx# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/queue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/rx# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/enqueue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/dequeue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/drop# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #InternetNode# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #PointToPointNetDevice# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Queue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Ipv4L3Protocol# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Ipv4Interface# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #CsmaNetDevice# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/enqueue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/dequeue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #/drop# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #Queue# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/namespace-2.png b/doc/namespace-2.png new file mode 100644 index 000000000..7ea379c82 Binary files /dev/null and b/doc/namespace-2.png differ diff --git a/doc/trace-source-list.h b/doc/trace-source-list.h new file mode 100644 index 000000000..c23d06ece --- /dev/null +++ b/doc/trace-source-list.h @@ -0,0 +1,204 @@ +/// +/// \ingroup TraceSourceList +/// \brief send ipv4 packet to outgoing interface +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet sent. +/// \param arg3 index of output ipv4 interface. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/ipv4/tx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback0 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3); + +/// +/// \ingroup TraceSourceList +/// \brief receive ipv4 packet from incoming interface +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet received. +/// \param arg3 index of input ipv4 interface. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/ipv4/rx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback1 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3); + +/// +/// \ingroup TraceSourceList +/// \brief drop ipv4 packet +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet dropped. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/ipv4/drop. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback2 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief store packet in queue +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet queued. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/enqueue. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::QueueTraceType +void TraceSinkCallback3 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief remove packet from queue +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet dequeued. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/dequeue. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::QueueTraceType +void TraceSinkCallback4 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief drop packet from queue +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet dropped. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/drop. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::QueueTraceType +void TraceSinkCallback5 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief receive MAC packet +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet received. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/rx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::PointToPointTraceType +void TraceSinkCallback6 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief receive MAC packet +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet received. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/rx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::CsmaTraceType +void TraceSinkCallback7 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief drop MAC packet +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet dropped. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/drop. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::NodeNetDeviceIndex +/// - ns3::CsmaTraceType +void TraceSinkCallback8 (const TraceContext & arg1, const Packet & arg2); + +/// +/// \ingroup TraceSourceList +/// \brief The value of the speed vector changed +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 the mobility model whose course changed. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/$MobilityModelNotifier/course-change. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +void TraceSinkCallback9 (const TraceContext & arg1, Ptr arg2); + +/// +/// \ingroup TraceSourceList +/// \brief send ipv4 packet to outgoing interface +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet sent. +/// \param arg3 index of output ipv4 interface. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/tx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback10 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3); + +/// +/// \ingroup TraceSourceList +/// \brief receive ipv4 packet from incoming interface +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet received. +/// \param arg3 index of input ipv4 interface. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/rx. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback11 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3); + +/// +/// \ingroup TraceSourceList +/// \brief drop ipv4 packet +/// \param arg1 the trace context associated to the connected trace source. +/// \param arg2 packet dropped. +/// +/// +/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/drop. +/// +/// The following classes can be extracted from \p arg1 with +/// ns3::TraceContext::GetElement: +/// - ns3::NodeListIndex +/// - ns3::Ipv4L3ProtocolTraceContextElement +void TraceSinkCallback12 (const TraceContext & arg1, const Packet & arg2); + diff --git a/doc/tracing.h b/doc/tracing.h new file mode 100644 index 000000000..45e7d9db5 --- /dev/null +++ b/doc/tracing.h @@ -0,0 +1,576 @@ +/** + * \defgroup TraceSourceList List of trace sources + */ + +/** + * \defgroup tracing Tracing + * + * The flexibility of the ns-3 tracing system comes at the cost of quite + * a bit of complexity so, before trying to use the low-level aspects + * of the tracing API, it is important to focus on some basic definitions: + * + * - A trace source is an object instance which can report trace events + * to a set of listening trace sinks. + * + * - A trace sink is a user-provided callback (a function) which can + * be connected to a set of trace sources to receive the events generated + * by each trace source. + * + * - A trace resolver is an object which allows users to establish + * connections between a set of trace sources and a set of trace sinks. + * + * \section TraceSource Generating Trace Events + * + * So, what does it look like in practice ? First, let's look at trace + * sources. We have two types of trace sources: numeric, and, normal + * trace sources. Numeric trace sources behave as normal c++ integers + * or c++ floating point numbers except that they report as trace events + * each change of their value. For example: + * \code + * class MyModel + * { + * public: + * void DoSomething (void) + * { + * // use the "int" trace source just + * // like any other "int" variable. + * m_cwnd *= 2; + * m_cwnd += 4; + * if (m_cwnd > 100) + * { + * // do something. + * } + * } + * private: + * // declare an instance of a "int" trace source + * SVTraceSource m_cwnd; + * }; + * \endcode + * Normal trace sources, on the other hand, allow you to trace the + * call of arbitrary functions and methods, as shown below. They are + * typically used to track "rx", "tx", or "drop" events but could + * also be used to track route change events, or position change + * events: + * \code + * class MyModel + * { + * public: + * void DoSomething (Packet packet) + * { + * // report this event on packet + * m_doSomething (packet); + * // do something + * } + * private: + * // report every "something" function call. + * CallbackTraceSource m_doSomething; + * }; + * \endcode + * Every type of trace source derives from the ns3::TraceSource base class. + * As of today, the set of concrete subclasses is relatively short: + * ns3::CallbackTraceSource, ns3::SvTraceSource, ns3::UvTraceSource, and, + * ns3::FvTraceSource. + * + * \section TraceSink Receiving Trace Events + * + * To receive these trace events, a user should specify a set of trace sinks. + * For example, to receive the "int" and the "something" events shown in the + * examples above, a user would declare the following functions: + * \code + * // oldValue and newValue contain the previous and new values of + * // the connected SVTraceSource trace source. + * void + * CwndTraceSink (const TraceContext &context, int64_t oldValue, int64_t newValue) + * { + * // for example, print the new value: + * std::cout << "cwnd=" << newValue << std::endl; + * } + * void + * DoSomethingTraceSink (const TraceContext &context, Packet packet) + * { + * // for example, print the arguments + * std::cout << "packet " << packet << std::endl; + * } + * \endcode + * Each of these sink function takes, as a first argument, a reference to a + * const TraceContext object. This context object contains information which + * describes the instance of the connected trace source: that information is + * setup during the connection process and does not change afterwards + * The type and the number of the other arguments to each trace sink depends + * on the type of the connected trace source: it conveys per-event information + * from the trace source to the trace sink. For example, UVTraceSource and + * SVTraceSource trace sources require two extra arguments. The former requires + * two unsigned 64 bit integers while the latter requires two signed 64 bit + * integers. More generally, users can consult the \ref TraceSourceList + * to figure out the arguments which a trace sink is required to receive + * for each trace source: a signature of the user trace sink must match + * _exactly_ the signature documented in the \ref TraceSourceList. + * + * + * \section TraceSourceSimpleExport A simple way to connect Trace Sources with Trace Sinks + * + * The crux of the complexity of the ns-3 tracing system comes from its + * flexible system used to connect trace sources to trace sinks but what is really + * nice about it is that it is not necessary to use it to setup simple traces. + * + * The simplest way to export a set of trace sources to a user, for example, + * during the early prototyping phases of a system, is to add a set of public methods + * to give to your users access to the trace source object instances you use to generate + * trace events: + * \code + * class MyModel + * { + * public: + * void DoSomething (Packet packet) + * { + * // report this event on packet + * m_doSomething (packet); + * // do something + * } + * CallbackTraceSource *PeekSomethingTraceSource (void) const + * { + * return &m_doSomething + * } + * private: + * // report every "something" function call. + * CallbackTraceSource m_doSomething; + * }; + * \endcode + * If your users hold a pointer to an instance of MyModel, and if they want to connect + * a MySomethingSink, they can simply do the following which invokes the + * TraceSource::AddCallback method and creates a Callback object from the user's + * sink with the MakeCallback function. + * \code + * void + * MySomethingSink (const TraceContext &context, Packet packet) + * { + * // do whatever you want. + * } + * MyModel *model = ...; + * CallbackTraceSource *source = model->PeekSomethingTraceSource (); + * source->AddCallback (MakeCallback (&MySomethingSink)); + * \endcode + * + * The full power of the tracing system comes however from its ns3::NodeList::Connect + * method which is described in the following sections. + * + * \section TraceConnection Connecting Trace Sources to Trace Sinks + * + * If a trace source is integrated in the ns-3 trace connection facility, a user + * should call the ns3::NodeList::Connect method to establish a connection between + * a trace sink and a set of matching trace sources. The second argument to that + * method is a callback to the user's trace sink. + * That callback is easy to construct: call ns3::MakeCallback and you are done. The + * first argument is a string whose format is similar to a unix path and which is + * used to uniquely identify the set of trace sources you want to connect to. + * The set of acceptable path strings is also documented in the \ref TraceSourceList. + * + * So, what does this look like from the perspective of a user ? If we wanted to + * connect to a trace source defined somewhere deep into the a set of NetDevice objects + * located in some nodes of the system, we could write the following: + * \code + * void + * DoSomethingTraceSink (const TraceContext &context, Packet packet) + * { + * // for example, print the arguments + * std::cout << "packet: " << packet << std::endl; + * } + * // connect the above sink to a matching trace source + * NodeList::Connect ("/nodes/* /devices/* /rx", MakeCallback &DoSomethingTraceSink); + * \endcode + * + * The connection path string "/nodes/* /devices/* /rx" matches the "rx" trace source + * located in every netdevice located in every node. The syntax of that path string + * is loosely based on regular expressions so, a user could conceivably connect + * to the trace sources present in only one node identified by node index: + * "/nodex/3/devices/* /rx". + * + * The matching algorithm used here is very useful since it allows you to connect + * at once a large set of trace sources to a single sink but it introduces another + * problem: it becomes impossible when you receive an event in your trace sink to + * know from _which_ trace source the event is coming from. In our example, the + * trace source might be coming from the NetDevice number 2 of Node 10 or Netdevice + * number 0 of Node 5. In both cases, you might need to know which of these NetDevice + * is generating this event, if only to generate some ascii trace dump. Another + * similar use-case is that you might have connected the same trace sink to + * multiple types of events which have the same signature: it is quite common + * to receive all tx, rx, and drop events in the same trace sink and that would be + * quite trivial to achieve with a string such as: "/nodes/* /devices/* /*" + * + * The source of a trace event can be retrieved from a trace sink using + * different means: the simplest + * way to get this information is to use the builtin printing facility of + * the TraceContext object: + * \code + * void + * DoSomethingTraceSink (const TraceContext &context, Packet packet) + * { + * // for example, print the arguments + * std::cout << "context=\"" << context << "\" packet: " << packet << std::endl; + * } + * \endcode + * The above code is going to generate output which looks like the following: + * \code + * context="nodeid=2 device=0 dev-rx" packet: IPV4(tos 0x0 ttl 64 id 0 offset ... + * context="nodeid=1 device=0 dev-rx" packet: IPV4(tos 0x0 ttl 64 id 0 offset ... + * ... + * \endcode + * + * Another more advanced way to get information out of a TraceContext is to call its + * ns3::TraceContext::GetElement method. This method takes as its first and only + * argument an instance of the object we want to read and the list of available + * object instances we can read from a TraceContext is documented, once again, + * in the \ref TraceSourceList. For example, we could write the following to + * generate adhoc trace output: + * \code + * void DeviceRxSink (const TraceContext &context, const Packet &packet) + * { + * NodeListIndex nodeIndex; + * NodeNetDeviceIndex deviceIndex; + * context.GetElement (nodeIndex); + * context.GetElement (deviceIndex); + * std::cout << "node-index=" << nodeIndex.Get (); + * std::cout << ", device-index=" << deviceIndex.Get (); + * std::cout << ", packet: " << packet; + * std::cout << std::endl; + * } + * \endcode + * + * \section ExportingTraceSources Exporting new Trace Sources + * + * Using existing trace sources to connect them to a set of adhoc trace sinks + * is not really complicated but, setting up new trace sources which can hook + * in this automatic connection system is a bit more complicated. + * + * So far, we know that a model author can generate trace events really easily: + * \code + * class MyModel + * { + * public: + * void DoSomething (Packet packet) + * { + * // report this event on packet with value + * m_doSomething (packet); + * // do something + * } + * private: + * // report every "something" function call. + * CallbackTraceSource m_doSomething; + * }; + * \endcode + * + * To make these new trace sources available to the rest of the connection system, + * the first step is to make sure that your model object derives from the ns3::Object + * base class either directly (as shown below) or indirectly through another base class: + * \code + * class MyModel : public Object {...}; + * // or: + * class SomeOtherObject : public Object {...}; + * class MyModel : public SomeOtherObject {...}; + * \endcode + * + * This is pretty trivial and lays the ground for the second step: overriding the + * ns3::Object::GetTraceResolver method: + * \code + * class MyModel : public MyParent + * { + * public: + * // declare overriden method + * virtual Ptr GetTraceResolver (void) const; + * private: + * // the new trace source to export. + * CallbackTraceSource m_rxSource; + * }; + * \endcode + * + * To implement this method, you could attempt to implement a new subclass of + * the ns3::TraceResolver base class and return an instance from this method but + * this would be very hard. Instead, you should use the helper class + * ns3::CompositeTraceResolver to register your trace sources and chain up to + * your parent: + * \code + * Ptr + * MyModel::GetTraceResolver (void) const + * { + * // create an empty trace resolver + * Ptr resolver = Create (); + * // register m_rxSource + * resolver->AddSource ("rx", // the name of the trace source in the path string + * TraceDoc ("some help text to explain the purpose of this trace source", + * "Packet", // the type of the first argument to the trace source + * "the purpose of the first argument", + * "type-of-second-argument", "purpose-of-second-argument"), + * m_rxSource // the trace source itself is registered + * ); + * // make sure we include the trace sources implemented in the parent. + * resolver->SetParentResolver (MyParent::GetTraceResolver ()); + * return resolver; + * } + * \endcode + * + * Once you have written that code, you must make sure that this new method GetTraceResolver + * is going to be called at some point by the tracing system. If your model is located somewhere + * deep in MAC or PHY layer, that is, it is part of a NetDevice implementation, all you + * have to do is to make sure that your model is registered as a "composite" of your NetDevice + * subclass: + * \code + * class MyNetDevice : public NetDevice + * { + * public: + * Ptr GetTraceResolver (void) const; + * private: + * Ptr m_model; + * }; + * + * Ptr + * MyNetDevice::GetTraceResolver (void) const + * { + * Ptr resolver = ...; + * // register other trace source + * ... + * // register now your model as a "composite" + * resolver->AddComposite ("my-model", m_model); + * // chain up to parent. + * resolver->SetParentResolver (NetDevice::GetTraceResolver ()); + * return resolver; + * } + * \endcode + * + * The code above will make your "rx" trace source appear under the + * /nodes/xx/devices/xx/my-model/rx namespace path. + * + * If you have implemented a new layer 3 or 4 protocol object, the process to + * export your trace sources is quite similar. You need to subclass from + * ns3::Object, override the ns3::Object::GetTraceResolver method, make + * sure you chain up to your parent's GetTraceResolver method, and, finally, + * make sure that someone calls your new GetTraceResolver method. How to accomplish + * the latter should be documented in the node's API documentation which describes + * how to implement a new layer 3 or 4 protocol object. + * + * \section AdvancedTraceContext Creating new Trace Context Elements + * + * The last important feature which model developers need to understand + * is how to provide extra context information to trace sinks. For example, + * if your model exports both rx and tx trace sources which share the same + * signature, it is quite natural for a user to connect to a single trace sink + * to both of them with a trace path string such as "/nodes/* /devices/* /(rx|tx)". + * In this case, it becomes necessary to be able, from the trace sink function, + * to tell which event triggered the call to the trace sink: a rx or a tx event. + * + * That example is detailed below with a TX, a RX, and a DROP source: + * \code + * class MyModel + * { + * private: + * CallbackTraceSource m_rxSource; + * CallbackTraceSource m_txSource; + * CallbackTraceSource m_dropSource; + * }; + * \endcode + * When a single sink is connected to all 3 sources here, one might want + * to write code like the following: + * \code + * void DeviceRxSink (const TraceContext &context, const Packet &packet) + * { + * switch (type) { + * case RX: + * std::cout << "rx" << std::endl; + * break; + * case TX: + * std::cout << "tx" << std::endl; + * break; + * case DROP: + * std::cout << "drop" << std::endl; + * break; + * } + * \endcode + * + * \subsection AdvancedTraceContextSimpleSolution The simple solution + * + * The simplest way to do achieve the result shown above is to include + * in the trace source an extra explicit argument which describes the source event: + * - define a small enum with 3 values + * - change the signature of m_rxSource, m_txSource, and m_dropSource to include + * the enum + * - pass the enum value in each event + * + * The resulting code is shown below: + * \code + * class MyModel + * { + * public: + * // define the trace type enum. + * enum TraceType { + * RX, + * TX, + * DROP + * }; + * private: + * // generate events + * void NotifyRxPacket (Packet p) { + * m_rxSource (p, MyModel::RX); + * } + * void NotifyTxPacket (Packet p) { + * m_rxSource (p, MyModel::TX); + * } + * void NotifyDropPacket (Packet p) { + * m_rxSource (p, MyModel::DROP); + * } + * CallbackTraceSource m_rxSource; + * CallbackTraceSource m_txSource; + * CallbackTraceSource m_dropSource; + * }; + * \endcode + * These 3 new sources can be connected easily to a new trace sink: + * \code + * void ASimpleTraceSink (const TraceContext &context, const Packet &packet, enum MyModel::TraceType type) + * { + * // here, read the "type" argument + * } + * \endcode + * + * This solution works but it makes it impossible to connect a single trace sink to a set + * of trace sources which represent "rx" events in different NetDevice objects since + * each of them will define a different enum type with different values: since the + * trace sink signature must match exactly the trace source signature, it is impossible + * to connect at the same time to all "rx" events of different NetDevice. + * + * \subsection AdvancedTraceContextFancySolution The more complex and generic solution + * + * There is, hopefully, a way to get the best of both worlds, that is, to allow a + * user to connect to a lot of trace source events of the same kind but coming from different + * implementations and to allow the user to differentiate between these different + * implementations. + * + * Rather than define an adhoc enum type with a list of trace sources, you can also + * define a new ns3::TraceContextElement for your source sources. For example, if you + * define a new MyModelTraceType class which contains the type of trace, your users can + * then write trace sink code which looks like this: + * \code + * void AFancyTraceSink (const TraceContext &context, const Packet &packet) + * { + * MyModelTraceType type; + * if (context.GetElement (type)) + * { + * switch (type.Get ()) + * { + * case MyModelTraceType::RX: + * std::cout << "rx" << std::endl; + * break; + * case MyModelTraceType::TX: + * std::cout << "tx" << std::endl; + * break; + * case MyModelTraceType::DROP: + * std::cout << "drop" << std::endl; + * break; + * } + * } + * } + * \endcode + * + * Of course, since the type of trace is stored in the TraceContext, your users can + * also take the shortcut which uses the printing functionality of the TraceContext: + * \code + * void ALessFancyTraceSink (const TraceContext &context, const Packet &packet) + * { + * std::cout << "context=\"" << context << "\" packet: " << packet << std::endl; + * } + * \endcode + * which will generate something like the following when the trace source comes + * from MyModel: + * \code + * context="my-model-rx" packet: ... + * \endcode + * + * The first step to achieve this is to define and implement a new + * subclass of the ns3::TraceContextElement base class. The exact list of + * public methods which must be implemented is described in the API + * documentation of the ns3::TraceContextElement class. + * \code + * class MyModelTraceType : public TraceContextElement + * { + * public: + * enum Type { + * RX, + * TX, + * DROP + * }; + * // called from MyModel::GetTraceResolver + * MyModelTraceType (enum Type type); + * // called from trace sink + * enum Type Get (void) const; + * // needed by the tracing subsystem + * static uint16_t GetUid (void); + * // needed by the tracing subsystem to + * // print the content of a TraceContext + * void Print (std::ostream &os) const; + * // needed by the tracing subsystem to + * // generate the doxygen documentation. + * std::string GetTypeName (void) const; + * private: + * enum Type m_type; + * }; + * \endcode + * The implementation does not require much thinking: + * \code + * MyModelTraceType::MyModelTraceType (enum Type type) + * : m_type (type) + * {} + * enum Type + * MyModelTraceType::Get (void) const + * { + * return m_type; + * } + * uint16_t + * MyModelTraceType::GetUid (void) + * { + * // use protected TraceContextElement::AllocateUid method + * // the input string is used to uniquely identify this new subclass + * static uint16_t uid = AllocateUid ("ns3::MyModelTraceType"); + * return uid; + * } + * void + * MyModelTraceType::Print (std::ostream &os) const + * ( + * // this method is invoked by the print function of a TraceContext + * // if it contains an instance of this TraceContextElement. + * switch (m_type) { + * case RX: os << "rx"; break; + * // ... + * } + * ) + * std::string + * MyModelTraceType::GetTypeName (void) const + * { + * // This method should return a fully-qualified c++ typename + * // This method is used only for documentation purposes to + * // generate the content of the Trace Source List. + * return "ns3::MyModelTraceType"; + * } + * \endcode + * + * Once this subclass is implemented, the work is almost completed: you + * just need to pass an instance of that class as the last argument of + * the ns3::CompositeTraceResolver::AddSource method as shown below: + * \code + * Ptr + * MyModel::GetTraceResolver (void) const + * { + * // create an empty trace resolver + * Ptr resolver = Create (); + * // register m_rxSource + * resolver->AddSource ("rx", // the name of the trace source in the path string + * TraceDoc ("some help text to explain the purpose of this trace source", + * "Packet", // the type of the first argument to the trace source + * "the purpose of the first argument", + * "type-of-second-argument", "purpose-of-second-argument"), + * m_rxSource, // the trace source itself is registered + * // the TraceContextElement associated to this trace source. + * MyModelTraceType (MyModelTraceType::RX) + * ); + * // make sure we include the trace sources implemented in the parent. + * resolver->SetParentResolver (MyParent::GetTraceResolver ()); + * return resolver; + * } + * \endcode + */ diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc new file mode 100644 index 000000000..06775e26d --- /dev/null +++ b/examples/csma-broadcast.cc @@ -0,0 +1,204 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +// +// Example of the sending of a datagram to a broadcast address +// +// Network topology +// ============== +// | | +// n0 n1 n2 +// | | +// ========== +// +// n0 originates UDP broadcast to 255.255.255.255/discard port, which +// is replicated and received on both n1 and n2 + +#include +#include +#include +#include + +#include "ns3/command-line.h" +#include "ns3/default-value.h" +#include "ns3/ptr.h" +#include "ns3/random-variable.h" +#include "ns3/log.h" + +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/data-rate.h" + +#include "ns3/ascii-trace.h" +#include "ns3/pcap-trace.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/mac48-address.h" +#include "ns3/ipv4-address.h" +#include "ns3/inet-socket-address.h" +#include "ns3/ipv4.h" +#include "ns3/socket.h" +#include "ns3/ipv4-route.h" +#include "ns3/onoff-application.h" +#include "ns3/packet-sink.h" + +using namespace ns3; + +NS_LOG_COMPONENT_DEFINE ("CsmaBroadcastExample"); + +int +main (int argc, char *argv[]) +{ + // Users may find it convenient to turn on explicit debugging + // for selected modules; the below lines suggest how to do this +#if 0 + LogComponentEnable ("CsmaBroadcastExample", LOG_LEVEL_INFO); + + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + // Enable the below logging command to see the packets being received + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); +#endif + + // Set up some default values for the simulation. Use the Bind() + // technique to tell the system what subclass of Queue to use, + // and what the queue limit is + + // The below Bind command tells the queue factory which class to + // instantiate, when the queue factory is invoked in the topology code + DefaultValue::Bind ("Queue", "DropTailQueue"); + + // Allow the user to override any of the defaults and the above + // Bind()s at run-time, via command-line arguments + CommandLine::Parse (argc, argv); + + // Here, we will explicitly create four nodes. In more sophisticated + // topologies, we could configure a node factory. + NS_LOG_INFO ("Create nodes."); + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + + // We create the channels first without any IP addressing information + NS_LOG_INFO ("Create channels."); + Ptr channel0 = + CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + + // We create the channels first without any IP addressing information + Ptr channel1 = + CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + + NS_LOG_INFO ("Build Topology."); + uint32_t n0ifIndex0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel0, + Mac48Address("10:54:23:54:0:50")); + uint32_t n0ifIndex1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel1, + Mac48Address("10:54:23:54:0:51")); + uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, channel0, + Mac48Address("10:54:23:54:23:51")); + uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channel1, + Mac48Address("10:54:23:54:23:52")); + + // Later, we add IP addresses. + NS_LOG_INFO ("Assign IP Addresses."); + CsmaIpv4Topology::AddIpv4Address ( + n0, n0ifIndex0, Ipv4Address("10.1.0.1"), Ipv4Mask("255.255.0.0")); + + CsmaIpv4Topology::AddIpv4Address ( + n1, n1ifIndex, Ipv4Address("10.1.0.2"), Ipv4Mask("255.255.0.0")); + + CsmaIpv4Topology::AddIpv4Address ( + n0, n0ifIndex1, Ipv4Address("192.168.1.1"), Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address ( + n2, n2ifIndex, Ipv4Address("192.168.1.2"), Ipv4Mask("255.255.255.0")); + + // RFC 863 discard port ("9") indicates packet should be thrown away + // by the system. We allow this silent discard to be overridden + // by the PacketSink application. + uint16_t port = 9; + + // Create the OnOff application to send UDP datagrams of size + // 512 bytes (default) at a rate of 500 Kb/s (default) from n0 + NS_LOG_INFO ("Create Applications."); + Ptr ooff = Create ( + n0, + InetSocketAddress ("255.255.255.255", port), + "Udp", + ConstantVariable(1), + ConstantVariable(0)); + // Start the application + ooff->Start(Seconds(1.0)); + ooff->Stop (Seconds(10.0)); + + // Create an optional packet sink to receive these packets + Ptr sink = Create ( + n1, + InetSocketAddress (Ipv4Address::GetAny (), port), + "Udp"); + // Start the sink + sink->Start (Seconds (1.0)); + sink->Stop (Seconds (10.0)); + + // Create an optional packet sink to receive these packets + sink = Create ( + n2, + InetSocketAddress (Ipv4Address::GetAny (), port), + "Udp"); + // Start the sink + sink->Start (Seconds (1.0)); + sink->Stop (Seconds (10.0)); + + NS_LOG_INFO ("Configure Tracing."); + // Configure tracing of all enqueue, dequeue, and NetDevice receive events + // Trace output will be sent to the csma-broadcast.tr file + AsciiTrace asciitrace ("csma-broadcast.tr"); + asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); + + // Also configure some tcpdump traces; each interface will be traced + // The output files will be named + // simple-point-to-point.pcap-- + // and can be read by the "tcpdump -r" command (use "-tt" option to + // display timestamps correctly) + PcapTrace pcaptrace ("csma-broadcast.pcap"); + pcaptrace.TraceAllIp (); + + NS_LOG_INFO ("Run Simulation."); + Simulator::Run (); + Simulator::Destroy (); + NS_LOG_INFO ("Done."); +} diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc new file mode 100644 index 000000000..942485f50 --- /dev/null +++ b/examples/csma-multicast.cc @@ -0,0 +1,333 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +// Network topology +// +// Lan1 +// =========== +// | | | +// n0 n1 n2 n3 n4 +// | | | +// =========== +// Lan0 +// +// - Multicast source is at node n0; +// - Multicast forwarded by node n2 onto LAN1; +// - Nodes n0, n1, n2, n3, and n4 receive the multicast frame. +// - Node n4 listens for the data (actual listener not yet implementted) + +#include "ns3/command-line.h" +#include "ns3/default-value.h" +#include "ns3/ptr.h" +#include "ns3/random-variable.h" +#include "ns3/log.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/data-rate.h" +#include "ns3/ascii-trace.h" +#include "ns3/pcap-trace.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/mac48-address.h" +#include "ns3/ipv4-address.h" +#include "ns3/inet-socket-address.h" +#include "ns3/ipv4.h" +#include "ns3/socket.h" +#include "ns3/ipv4-route.h" +#include "ns3/onoff-application.h" +#include "ns3/packet-sink.h" + +using namespace ns3; + +NS_LOG_COMPONENT_DEFINE ("CsmaMulticastExample"); + +int +main (int argc, char *argv[]) +{ +// +// Users may find it convenient to turn on explicit debugging +// for selected modules; the below lines suggest how to do this +// +#if 0 + LogComponentEnable ("CsmaMulticastExample", LOG_LEVEL_INFO); + + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); +#endif +// +// Set up default values for the simulation. Use the DefaultValue::Bind() +// technique to tell the system what subclass of Queue to use. The Bind +// command command tells the queue factory which class to instantiate when the +// queue factory is invoked in the topology code +// + DefaultValue::Bind ("Queue", "DropTailQueue"); +// +// Allow the user to override any of the defaults and the above Bind() at +// run-time, via command-line arguments +// + CommandLine::Parse (argc, argv); +// +// Explicitly create the nodes required by the topology (shown above). +// + NS_LOG_INFO ("Create nodes."); + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + Ptr n4 = Create (); + + NS_LOG_INFO ("Create channels."); +// +// Explicitly create the channels required by the topology (shown above). +// + Ptr lan0 = + CsmaTopology::CreateCsmaChannel(DataRate(5000000), MilliSeconds(2)); + + Ptr lan1 = + CsmaTopology::CreateCsmaChannel(DataRate(5000000), MilliSeconds(2)); + + NS_LOG_INFO ("Build Topology."); +// +// Now fill out the topology by creating the net devices required to connect +// the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will +// create a net device, add a MAC address (in memory of the pink flamingo) and +// connect the net device to a nodes and also to a channel. the +// AddIpv4CsmaNetDevice method returns a net device index for the net device +// created on the node. Interpret nd0 as the net device we created for node +// zero. Interpret nd2Lan0 as the net device we created for node two to +// connect to Lan0. +// + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan0, + Mac48Address("08:00:2e:00:00:00")); + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan0, + Mac48Address("08:00:2e:00:00:01")); + uint32_t nd2Lan0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan0, + Mac48Address("08:00:2e:00:00:02")); + + uint32_t nd2Lan1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, + Mac48Address("08:00:2e:00:00:03")); + uint32_t nd3 __attribute__ ((unused)) = + CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, + Mac48Address("08:00:2e:00:00:04")); + uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan1, + Mac48Address("08:00:2e:00:00:05")); + + NS_LOG_INFO ("nd0 = " << nd0); + NS_LOG_INFO ("nd1 = " << nd1); + NS_LOG_INFO ("nd2Lan0 = " << nd2Lan0); + NS_LOG_INFO ("nd2Lan1 = " << nd2Lan1); + NS_LOG_INFO ("nd3 = " << nd3); + NS_LOG_INFO ("nd4 = " << nd3); +// +// We've got the "hardware" in place. Now we need to add IP addresses. +// + NS_LOG_INFO ("Assign IP Addresses."); + CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address ("10.1.1.1"), + Ipv4Mask ("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n1, nd1, Ipv4Address ("10.1.1.2"), + Ipv4Mask ("255.255.255.0")); + +// +// We'll need these addresses later +// + Ipv4Address n2Lan0Addr ("10.1.1.3"); + Ipv4Address n2Lan1Addr ("10.1.2.1"); + + CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan0, n2Lan0Addr, + Ipv4Mask ("255.255.255.0")); +// +// Assign IP addresses to the net devices and associated interfaces on Lan1 +// + CsmaIpv4Topology::AddIpv4Address (n2, nd2Lan1, n2Lan1Addr, + Ipv4Mask ("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n3, nd1, Ipv4Address ("10.1.2.2"), + Ipv4Mask ("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n4, nd4, Ipv4Address ("10.1.2.3"), + Ipv4Mask ("255.255.255.0")); + + NS_LOG_INFO ("Configure multicasting."); +// +// Now we can configure multicasting. As described above, the multicast +// source is at node zero, which we assigned the IP address of 10.1.1.1 +// earlier. We need to define a multicast group to send packets to. This +// can be any multicast address from 224.0.0.0 through 239.255.255.255 +// (avoiding the reserved routing protocol addresses). We just pick a +// convenient number (225.0.0.0) and or in some bits to let us verify that +// correct Ethernet multicast addresses are constructed down in the system. +// + Ipv4Address multicastSource ("10.1.1.1"); + Ipv4Address multicastGroup ("225.1.2.4"); +// +// We are going to manually configure multicast routing. This means telling +// node two that it should expect multicast data coming from IP address +// 10.1.1.1 originally. It should expect these data coming in over its IP +// interface connected to Lan0. When node two receives these packets, they +// should be forwarded out the interface that connects it to Lan1. +// +// We're going to need the interface indices on node two corresponding to +// these interfaces, which we call ifIndexLan0 and ifIndexLan1. The most +// general way to get these interfaces is to look them up by IP address. +// Looking back to the topology creation calls above, we saved the addresses +// assigned to the interface connecting node two to Lan0 and Lan1. Now is +// a fine time to find the interface indices on node two. +// + Ptr ipv4; + ipv4 = n2->QueryInterface (Ipv4::iid); + + uint32_t ifIndexLan0 = ipv4->FindInterfaceForAddr (n2Lan0Addr); + uint32_t ifIndexLan1 = ipv4->FindInterfaceForAddr (n2Lan1Addr); +// +// Now, we need to do is to call the AddMulticastRoute () method on node +// two's Ipv4 interface and tell it that whenever it receives a packet on +// the interface from Lan0, with the packet from the multicast source, +// destined for the multicast group, it should forward these packets down +// the interface connecting it to Lan1. (Note: the vector of output +// interfaces is in case there are multiple net devices on a node -- not +// true in this case). +// + std::vector outputInterfaces (1); + outputInterfaces[0] = ifIndexLan1; + + ipv4->AddMulticastRoute (multicastSource, multicastGroup, ifIndexLan0, + outputInterfaces); +// +// We need to specify how the source node handles multicasting. There are a +// number of ways we can deal with this, we just need to pick one. The first +// method is to add an explicit route out of the source node, just as we did +// for the forwarding node. Use this method when you want to send packets out +// multiple interfaces or send packets out different interfaces based on the +// differing multicast groups. Since the source is local, there will be no +// input interface over which packets are received, so use +// Ipv4RoutingProtocol::IF_INDEX_ANY as a wildcard. +// +// A second way is to specify a multicast route using wildcards. If you +// want to send multicasts out differing sets of interfaces based on the +// multicast group, you can use AddMulticastRoute () but specify the origin +// as a wildcard. If you want all multicasts to go out a single set of +// interfaces, you can make both the origin and group a wildcard. +// +// If you have a simple system, where the source has a single interface, this +// can be done via the SetDefaultMulticastRoute () method on the Ipv4 +// interface. This tells the system to send all multicasts out a single +// specified network interface index. +// +// A last way is to specify a (or use an existing) default unicast route. The +// multicast routing code uses the unicast default route as a multicast "route +// of last resort." this method for is also on Ipv4 and is called +// SetDefaultRoute (). +// +// Since this is a simple multicast example, we use the +// SetDefaultMulticastRoute () approach. We are going to first need the +// Ipv4 interface for node 0 which is the multicast source. We use this +// interface to find the output interface index, and tell node zero to send +// its multicast traffic out that interface. +// + ipv4 = n0->QueryInterface (Ipv4::iid); + uint32_t ifIndexSrc = ipv4->FindInterfaceForAddr (multicastSource); + ipv4->SetDefaultMulticastRoute (ifIndexSrc); +// +// As described above, node four will be the only node listening for the +// multicast data. To enable forwarding bits up the protocol stack, we need +// to tell the stack to join the multicast group. +// + ipv4 = n4->QueryInterface (Ipv4::iid); + ipv4->JoinMulticastGroup (multicastSource, multicastGroup); +// +// Create an OnOff application to send UDP datagrams from node zero to the +// multicast group (node four will be listening). +// + NS_LOG_INFO ("Create Applications."); + + uint16_t port = 9; // Discard port (RFC 863) + + // Configure a multicast packet generator that generates a packet + // every few seconds + Ptr ooff = Create ( + n0, + InetSocketAddress (multicastGroup, port), + "Udp", + ConstantVariable(1), + ConstantVariable(0), + DataRate ("255b/s"), + 128); +// +// Tell the application when to start and stop. +// + ooff->Start(Seconds(1.)); + ooff->Stop (Seconds(10.)); + + // Create an optional packet sink to receive these packets + // If you enable logging on this (above) it will print a log statement + // for every packet received + Ptr sink = Create ( + n4, + InetSocketAddress (Ipv4Address::GetAny (), port), + "Udp"); + // Start the sink + sink->Start (Seconds (1.0)); + sink->Stop (Seconds (10.0)); + +// +// Configure tracing of all enqueue, dequeue, and NetDevice receive events. +// Trace output will be sent to the file "csma-multicast.tr" +// + NS_LOG_INFO ("Configure Tracing."); + AsciiTrace asciitrace ("csma-multicast.tr"); + asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); +// +// Also configure some tcpdump traces; each interface will be traced. +// The output files will be named: +// csma-multicast.pcap-- +// and can be read by the "tcpdump -r" command (use "-tt" option to +// display timestamps correctly) +// + PcapTrace pcaptrace ("csma-multicast.pcap"); + pcaptrace.TraceAllIp (); +// +// Now, do the actual simulation. +// + NS_LOG_INFO ("Run Simulation."); + Simulator::Run (); + Simulator::Destroy (); + NS_LOG_INFO ("Done."); +} diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index dc1bd58c0..76918cbb7 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -14,35 +14,25 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// Port of ns-2/tcl/ex/simple.tcl to ns-3 -// // Network topology // // n0 n1 n2 n3 // | | | | -// ===================== +// ================= +// LAN // -// - CBR/UDP flows from n0 to n1, and from n3 to n0 -// - UDP packet size of 210 bytes, with per-packet interval 0.00375 sec. -// (i.e., DataRate of 448,000 bps) +// - CBR/UDP flows from n0 to n1 and from n3 to n0 // - DropTail queues // - Tracing of queues and packet receptions to file "csma-one-subnet.tr" -#include -#include -#include -#include - #include "ns3/command-line.h" #include "ns3/default-value.h" #include "ns3/ptr.h" #include "ns3/random-variable.h" -#include "ns3/debug.h" - +#include "ns3/log.h" #include "ns3/simulator.h" #include "ns3/nstime.h" #include "ns3/data-rate.h" - #include "ns3/ascii-trace.h" #include "ns3/pcap-trace.h" #include "ns3/internet-node.h" @@ -50,7 +40,7 @@ #include "ns3/csma-net-device.h" #include "ns3/csma-topology.h" #include "ns3/csma-ipv4-topology.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/ipv4-address.h" #include "ns3/inet-socket-address.h" #include "ns3/ipv4.h" @@ -58,109 +48,168 @@ #include "ns3/ipv4-route.h" #include "ns3/onoff-application.h" - using namespace ns3; +NS_LOG_COMPONENT_DEFINE ("CsmaOneSubnetExample"); -int main (int argc, char *argv[]) +int +main (int argc, char *argv[]) { - - // Users may find it convenient to turn on explicit debugging - // for selected modules; the below lines suggest how to do this +// +// Users may find it convenient to turn on explicit debugging +// for selected modules; the below lines suggest how to do this +// #if 0 - DebugComponentEnable("CsmaNetDevice"); - DebugComponentEnable("Ipv4L3Protocol"); - DebugComponentEnable("NetDevice"); - DebugComponentEnable("Channel"); - DebugComponentEnable("CsmaChannel"); - DebugComponentEnable("PacketSocket"); + LogComponentEnable ("CsmaOneSubnetExample", LOG_LEVEL_INFO); + + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); #endif - - // Set up some default values for the simulation. Use the Bind() - // technique to tell the system what subclass of Queue to use, - // and what the queue limit is - - // The below Bind command tells the queue factory which class to - // instantiate, when the queue factory is invoked in the topology code +// +// Set up default values for the simulation. Use the DefaultValue::Bind() +// technique to tell the system what subclass of Queue to use. The Bind +// command command tells the queue factory which class to instantiate when the +// queue factory is invoked in the topology code +// DefaultValue::Bind ("Queue", "DropTailQueue"); - - // Allow the user to override any of the defaults and the above - // Bind()s at run-time, via command-line arguments +// +// Allow the user to override any of the defaults and the above Bind() at +// run-time, via command-line arguments +// CommandLine::Parse (argc, argv); - - // Here, we will explicitly create four nodes. In more sophisticated - // topologies, we could configure a node factory. +// +// Explicitly create the nodes required by the topology (shown above). +// + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); - // We create the channels first without any IP addressing information - Ptr channel0 = - CsmaTopology::CreateCsmaChannel( - DataRate(5000000), MilliSeconds(2)); + NS_LOG_INFO ("Create channels."); +// +// Explicitly create the channels required by the topology (shown above). +// + Ptr lan = CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); - uint32_t n0ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n0, channel0, - Eui48Address("10:54:23:54:23:50")); - uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n1, channel0, - Eui48Address("10:54:23:54:23:51")); - uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channel0, - Eui48Address("10:54:23:54:23:52")); - uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channel0, - Eui48Address("10:54:23:54:23:53")); + NS_LOG_INFO ("Build Topology."); +// +// Now fill out the topology by creating the net devices required to connect +// the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will +// create a net device, add a MAC address (in memory of the pink flamingo) and +// connect the net device to a nodes and also to a channel. the +// AddIpv4CsmaNetDevice method returns a net device index for the net device +// created on the node. Interpret nd0 as the net device we created for node +// zero. +// + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, + Mac48Address("08:00:2e:00:00:00")); - // Later, we add IP addresses. - CsmaIpv4Topology::AddIpv4Address ( - n0, n0ifIndex, Ipv4Address("10.1.1.1"), Ipv4Mask("255.255.255.0")); + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, + Mac48Address("08:00:2e:00:00:01")); - CsmaIpv4Topology::AddIpv4Address ( - n1, n1ifIndex, Ipv4Address("10.1.1.2"), Ipv4Mask("255.255.255.0")); + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, + Mac48Address("08:00:2e:00:00:02")); - CsmaIpv4Topology::AddIpv4Address ( - n2, n2ifIndex, Ipv4Address("10.1.1.3"), Ipv4Mask("255.255.255.0")); + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, + Mac48Address("08:00:2e:00:00:03")); +// +// We've got the "hardware" in place. Now we need to add IP addresses. +// + NS_LOG_INFO ("Assign IP Addresses."); +// +// XXX BUGBUG +// Need a better way to get the interface index. The point-to-point topology +// as implemented can't return the index since it creates interfaces on both +// sides (i.e., it does AddIpv4Addresses, not AddIpv4Address). We need a +// method on Ipv4 to find the interface index corresponding to a given ipv4 +// address. +// +// Assign IP addresses to the net devices and associated interfaces +// on the lan. The AddIpv4Address method returns an Ipv4 interface index +// which we do not need here. +// + CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address("10.1.1.1"), + Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n1, nd1, Ipv4Address("10.1.1.2"), + Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n2, nd2, Ipv4Address("10.1.1.3"), + Ipv4Mask("255.255.255.0")); - CsmaIpv4Topology::AddIpv4Address ( - n3, n3ifIndex, Ipv4Address("10.1.1.4"), Ipv4Mask("255.255.255.0")); - - // Create the OnOff application to send UDP datagrams of size - // 210 bytes at a rate of 448 Kb/s - // from n0 to n1 + CsmaIpv4Topology::AddIpv4Address (n3, nd3, Ipv4Address("10.1.1.4"), + Ipv4Mask("255.255.255.0")); +// +// Create an OnOff application to send UDP datagrams from node zero to node 1. +// + NS_LOG_INFO ("Create Applications."); + uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = Create ( n0, - InetSocketAddress ("10.1.1.2", 80), + InetSocketAddress ("10.1.1.2", port), "Udp", ConstantVariable(1), ConstantVariable(0)); - // Start the application +// +// Tell the application when to start and stop. +// ooff->Start(Seconds(1.0)); ooff->Stop (Seconds(10.0)); - - // Create a similar flow from n3 to n0, starting at time 1.1 seconds +// +// Create a similar flow from n3 to n0, starting at time 1.1 seconds +// ooff = Create ( n3, - InetSocketAddress ("10.1.1.1", 80), + InetSocketAddress ("10.1.1.1", port), "Udp", ConstantVariable(1), ConstantVariable(0)); - // Start the application + ooff->Start(Seconds(1.1)); ooff->Stop (Seconds(10.0)); - - // Configure tracing of all enqueue, dequeue, and NetDevice receive events - // Trace output will be sent to the csma-one-subnet.tr file +// +// Configure tracing of all enqueue, dequeue, and NetDevice receive events. +// Trace output will be sent to the file "csma-one-subnet.tr" +// + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("csma-one-subnet.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); - - // Also configure some tcpdump traces; each interface will be traced - // The output files will be named - // simple-point-to-point.pcap-- - // and can be read by the "tcpdump -r" command (use "-tt" option to - // display timestamps correctly) +// +// Also configure some tcpdump traces; each interface will be traced. +// The output files will be named: +// csma-one-subnet.pcap-- +// and can be read by the "tcpdump -r" command (use "-tt" option to +// display timestamps correctly) +// PcapTrace pcaptrace ("csma-one-subnet.pcap"); pcaptrace.TraceAllIp (); - +// +// Now, do the actual simulation. +// + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); - Simulator::Destroy (); + NS_LOG_INFO ("Done."); } diff --git a/examples/csma-packet-socket.cc b/examples/csma-packet-socket.cc index 9db207fbe..fde9a8f0b 100644 --- a/examples/csma-packet-socket.cc +++ b/examples/csma-packet-socket.cc @@ -37,7 +37,7 @@ #include "ns3/default-value.h" #include "ns3/ptr.h" #include "ns3/random-variable.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/simulator.h" #include "ns3/nstime.h" @@ -48,7 +48,7 @@ #include "ns3/internet-node.h" #include "ns3/csma-channel.h" #include "ns3/csma-net-device.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/packet-socket-address.h" #include "ns3/socket.h" #include "ns3/onoff-application.h" @@ -56,6 +56,8 @@ using namespace ns3; +NS_LOG_COMPONENT_DEFINE ("CsmaPacketSocketExample"); + static Ptr CreateCsmaDevice (Ptr node, Ptr channel) { @@ -66,28 +68,56 @@ CreateCsmaDevice (Ptr node, Ptr channel) return device; } - -int main (int argc, char *argv[]) +int +main (int argc, char *argv[]) { +#if 0 + LogComponentEnable ("CsmaPacketSocketExample", LOG_LEVEL_INFO); + + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); +#endif + CommandLine::Parse (argc, argv); // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); // create the shared medium used by all csma devices. + NS_LOG_INFO ("Create channels."); Ptr channel = Create (DataRate(5000000), MilliSeconds(2)); // use a helper function to connect our nodes to the shared channel. + NS_LOG_INFO ("Build Topology."); Ptr n0If = CreateCsmaDevice (n0, channel); Ptr n1If = CreateCsmaDevice (n1, channel); Ptr n2If = CreateCsmaDevice (n2, channel); Ptr n3If = CreateCsmaDevice (n3, channel); - // create the address which identifies n1 from n0 PacketSocketAddress n0ToN1; n0ToN1.SetSingleDevice (n0If->GetIfIndex ()); // set outgoing interface for outgoing packets @@ -103,6 +133,7 @@ int main (int argc, char *argv[]) // Create the OnOff application to send raw datagrams of size // 210 bytes at a rate of 448 Kb/s // from n0 to n1 + NS_LOG_INFO ("Create Applications."); Ptr ooff = Create ( n0, n0ToN1, @@ -126,11 +157,13 @@ int main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the csma-packet-socket.tr file + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("csma-packet-socket.tr"); asciitrace.TraceAllNetDeviceRx (); asciitrace.TraceAllQueues (); + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); - Simulator::Destroy (); + NS_LOG_INFO ("Done."); } diff --git a/examples/mixed-global-routing.cc b/examples/mixed-global-routing.cc index b3017e029..e5eb8dd97 100644 --- a/examples/mixed-global-routing.cc +++ b/examples/mixed-global-routing.cc @@ -36,7 +36,7 @@ #include #include -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/command-line.h" #include "ns3/default-value.h" @@ -56,7 +56,7 @@ #include "ns3/csma-net-device.h" #include "ns3/csma-topology.h" #include "ns3/csma-ipv4-topology.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/ipv4-address.h" #include "ns3/ipv4.h" #include "ns3/socket.h" @@ -68,22 +68,39 @@ using namespace ns3; -int main (int argc, char *argv[]) +NS_LOG_COMPONENT_DEFINE ("MixedGlobalRoutingExample"); + +int +main (int argc, char *argv[]) { // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this #if 0 - DebugComponentEnable ("Object"); - DebugComponentEnable ("Queue"); - DebugComponentEnable ("DropTailQueue"); - DebugComponentEnable ("Channel"); - DebugComponentEnable ("PointToPointChannel"); - DebugComponentEnable ("PointToPointNetDevice"); - DebugComponentEnable ("GlobalRouter"); - DebugComponentEnable ("GlobalRouteManager"); -#endif + LogComponentEnable ("MixedGlobalRoutingExample", LOG_LEVEL_INFO); + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); +#endif // Set up some default values for the simulation. Use the Bind () // technique to tell the system what subclass of Queue to use, // and what the queue limit is @@ -102,6 +119,7 @@ int main (int argc, char *argv[]) // Bind ()s at run-time, via command-line arguments CommandLine::Parse (argc, argv); + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); @@ -111,6 +129,7 @@ int main (int argc, char *argv[]) Ptr n6 = Create (); // We create the channels first without any IP addressing information + NS_LOG_INFO ("Create channels."); Ptr channel0 = PointToPointTopology::AddPointToPointLink ( n0, n2, DataRate (5000000), MilliSeconds (2)); @@ -128,16 +147,18 @@ int main (int argc, char *argv[]) CsmaTopology::CreateCsmaChannel( DataRate(5000000), MilliSeconds(2)); - uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n2, channelc0, - Eui48Address("10:54:23:54:23:50")); - uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n3, channelc0, - Eui48Address("10:54:23:54:23:51")); - uint32_t n4ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n4, channelc0, - Eui48Address("10:54:23:54:23:52")); - uint32_t n5ifIndex = CsmaIpv4Topology::AddIpv4CsmaNode (n5, channelc0, - Eui48Address("10:54:23:54:23:53")); + NS_LOG_INFO ("Build Topology."); + uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channelc0, + Mac48Address("10:54:23:54:23:50")); + uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, channelc0, + Mac48Address("10:54:23:54:23:51")); + uint32_t n4ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, channelc0, + Mac48Address("10:54:23:54:23:52")); + uint32_t n5ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n5, channelc0, + Mac48Address("10:54:23:54:23:53")); // Later, we add IP addresses. + NS_LOG_INFO ("Assign IP Addresses."); PointToPointTopology::AddIpv4Addresses ( channel0, n0, Ipv4Address ("10.1.1.1"), n2, Ipv4Address ("10.1.1.2")); @@ -168,9 +189,11 @@ int main (int argc, char *argv[]) // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s + NS_LOG_INFO ("Create Applications."); + uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = Create ( n0, - InetSocketAddress ("10.1.3.2", 80), + InetSocketAddress ("10.1.3.2", port), "Udp", ConstantVariable (1), ConstantVariable (0), @@ -182,6 +205,7 @@ int main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the simple-global-routing.tr file + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("mixed-global-routing.tr"); asciitrace.TraceAllQueues (); asciitrace.TraceAllNetDeviceRx (); @@ -193,7 +217,8 @@ int main (int argc, char *argv[]) PcapTrace pcaptrace ("mixed-global-routing.pcap"); pcaptrace.TraceAllIp (); + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); - Simulator::Destroy (); + NS_LOG_INFO ("Done."); } diff --git a/examples/simple-global-routing.cc b/examples/simple-global-routing.cc index 75879be23..362ca7af3 100644 --- a/examples/simple-global-routing.cc +++ b/examples/simple-global-routing.cc @@ -42,7 +42,7 @@ #include #include -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/command-line.h" #include "ns3/default-value.h" @@ -65,29 +65,46 @@ #include "ns3/ipv4-route.h" #include "ns3/point-to-point-topology.h" #include "ns3/onoff-application.h" +#include "ns3/packet-sink.h" #include "ns3/global-route-manager.h" using namespace ns3; -int main (int argc, char *argv[]) -{ +NS_LOG_COMPONENT_DEFINE ("SimpleGlobalRoutingExample"); +int +main (int argc, char *argv[]) +{ // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this #if 0 - DebugComponentEnable ("Object"); - DebugComponentEnable ("Queue"); - DebugComponentEnable ("DropTailQueue"); - DebugComponentEnable ("Channel"); - DebugComponentEnable ("PointToPointChannel"); - DebugComponentEnable ("PointToPointNetDevice"); - DebugComponentEnable ("GlobalRouter"); - DebugComponentEnable ("GlobalRouteMaager"); -#endif + LogComponentEnable ("SimpleGlobalRoutingExample", LOG_LEVEL_INFO); - // Set up some default values for the simulation. Use the DefaultValue::Bind () - // technique to tell the system what subclass of Queue to use, - // and what the queue limit is + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); +#endif + // Set up some default values for the simulation. Use the + // DefaultValue::Bind () technique to tell the system what subclass of + // Queue to use, and what the queue limit is // The below Bind command tells the queue factory which class to // instantiate, when the queue factory is invoked in the topology code @@ -104,12 +121,14 @@ int main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); // We create the channels first without any IP addressing information + NS_LOG_INFO ("Create channels."); Ptr channel0 = PointToPointTopology::AddPointToPointLink ( n0, n2, DataRate (5000000), MilliSeconds (2)); @@ -123,6 +142,7 @@ int main (int argc, char *argv[]) n2, n3, DataRate (1500000), MilliSeconds (10)); // Later, we add IP addresses. + NS_LOG_INFO ("Assign IP Addresses."); PointToPointTopology::AddIpv4Addresses ( channel0, n0, Ipv4Address ("10.1.1.1"), n2, Ipv4Address ("10.1.1.2")); @@ -141,9 +161,11 @@ int main (int argc, char *argv[]) // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s + NS_LOG_INFO ("Create Applications."); + uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = Create ( n0, - InetSocketAddress ("10.1.3.2", 80), + InetSocketAddress ("10.1.3.2", port), "Udp", ConstantVariable (1), ConstantVariable (0)); @@ -151,10 +173,20 @@ int main (int argc, char *argv[]) ooff->Start (Seconds (1.0)); ooff->Stop (Seconds (10.0)); + // Create a packet sink to receive these packets + // The last argument "true" disables output from the Receive callback + Ptr sink = Create ( + n3, + InetSocketAddress (Ipv4Address::GetAny (), port), + "Udp"); + // Start the sink + sink->Start (Seconds (1.0)); + sink->Stop (Seconds (10.0)); + // Create a similar flow from n3 to n1, starting at time 1.1 seconds ooff = Create ( n3, - InetSocketAddress ("10.1.2.1", 80), + InetSocketAddress ("10.1.2.1", port), "Udp", ConstantVariable (1), ConstantVariable (0)); @@ -162,8 +194,18 @@ int main (int argc, char *argv[]) ooff->Start (Seconds (1.1)); ooff->Stop (Seconds (10.0)); + // Create a packet sink to receive these packets + sink = Create ( + n1, + InetSocketAddress (Ipv4Address::GetAny (), port), + "Udp"); + // Start the sink + sink->Start (Seconds (1.1)); + sink->Stop (Seconds (10.0)); + // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the simple-global-routing.tr file + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("simple-global-routing.tr"); asciitrace.TraceAllQueues (); asciitrace.TraceAllNetDeviceRx (); @@ -175,9 +217,10 @@ int main (int argc, char *argv[]) PcapTrace pcaptrace ("simple-global-routing.pcap"); pcaptrace.TraceAllIp (); + NS_LOG_INFO ("Run Simulation."); Simulator::Run (); - Simulator::Destroy (); + NS_LOG_INFO ("Done."); return 0; } diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 4e7657cdb..5bbde9bca 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -38,11 +38,7 @@ // - Tracing of queues and packet receptions to file // "simple-point-to-point.tr" -#include -#include -#include -#include - +#include "ns3/log.h" #include "ns3/command-line.h" #include "ns3/default-value.h" #include "ns3/ptr.h" @@ -64,22 +60,41 @@ #include "ns3/ipv4-route.h" #include "ns3/point-to-point-topology.h" #include "ns3/onoff-application.h" +#include "ns3/packet-sink.h" using namespace ns3; -int main (int argc, char *argv[]) -{ +NS_LOG_COMPONENT_DEFINE ("SimplePointToPointExample"); +int +main (int argc, char *argv[]) +{ // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this - // remember to add #include "ns3/debug.h" before enabling these #if 0 - DebugComponentEnable("Object"); - DebugComponentEnable("Queue"); - DebugComponentEnable("DropTailQueue"); - DebugComponentEnable("Channel"); - DebugComponentEnable("PointToPointChannel"); - DebugComponentEnable("PointToPointNetDevice"); + LogComponentEnable ("SimplePointToPointExample", LOG_LEVEL_INFO); + + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); #endif // Set up some default values for the simulation. Use the Bind() @@ -101,12 +116,14 @@ int main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. + NS_LOG_INFO ("Create nodes."); Ptr n0 = Create (); Ptr n1 = Create (); Ptr n2 = Create (); Ptr n3 = Create (); // We create the channels first without any IP addressing information + NS_LOG_INFO ("Create channels."); Ptr channel0 = PointToPointTopology::AddPointToPointLink ( n0, n2, DataRate(5000000), MilliSeconds(2)); @@ -120,6 +137,7 @@ int main (int argc, char *argv[]) n2, n3, DataRate(1500000), MilliSeconds(10)); // Later, we add IP addresses. + NS_LOG_INFO ("Assign IP Addresses."); PointToPointTopology::AddIpv4Addresses ( channel0, n0, Ipv4Address("10.1.1.1"), n2, Ipv4Address("10.1.1.2")); @@ -136,16 +154,18 @@ int main (int argc, char *argv[]) // NetDevice creation, IP Address assignment, and routing) are // separated because there may be a need to postpone IP Address // assignment (emulation) or modify to use dynamic routing + NS_LOG_INFO ("Add Static Routes."); PointToPointTopology::AddIpv4Routes(n0, n2, channel0); PointToPointTopology::AddIpv4Routes(n1, n2, channel1); PointToPointTopology::AddIpv4Routes(n2, n3, channel2); - // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s + NS_LOG_INFO ("Create Applications."); + uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = Create ( n0, - InetSocketAddress ("10.1.3.2", 80), + InetSocketAddress ("10.1.3.2", port), "Udp", ConstantVariable(1), ConstantVariable(0)); @@ -153,10 +173,19 @@ int main (int argc, char *argv[]) ooff->Start(Seconds(1.0)); ooff->Stop (Seconds(10.0)); + // Create an optional packet sink to receive these packets + Ptr sink = Create ( + n3, + InetSocketAddress (Ipv4Address::GetAny (), port), + "Udp"); + // Start the sink + sink->Start (Seconds (1.0)); + sink->Stop (Seconds (10.0)); + // Create a similar flow from n3 to n1, starting at time 1.1 seconds ooff = Create ( n3, - InetSocketAddress ("10.1.2.1", 80), + InetSocketAddress ("10.1.2.1", port), "Udp", ConstantVariable(1), ConstantVariable(0)); @@ -164,8 +193,18 @@ int main (int argc, char *argv[]) ooff->Start(Seconds(1.1)); ooff->Stop (Seconds(10.0)); + // Create a packet sink to receive these packets + sink = Create ( + n1, + InetSocketAddress (Ipv4Address::GetAny (), port), + "Udp"); + // Start the sink + sink->Start (Seconds (1.1)); + sink->Stop (Seconds (10.0)); + // Here, finish off packet routing configuration // This will likely set by some global StaticRouting object in the future + NS_LOG_INFO ("Set Default Routes."); Ptr ipv4; ipv4 = n0->QueryInterface (Ipv4::iid); ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1); @@ -174,6 +213,7 @@ int main (int argc, char *argv[]) // Configure tracing of all enqueue, dequeue, and NetDevice receive events // Trace output will be sent to the simple-point-to-point.tr file + NS_LOG_INFO ("Configure Tracing."); AsciiTrace asciitrace ("simple-point-to-point.tr"); asciitrace.TraceAllQueues (); asciitrace.TraceAllNetDeviceRx (); @@ -186,7 +226,8 @@ int main (int argc, char *argv[]) PcapTrace pcaptrace ("simple-point-to-point.pcap"); pcaptrace.TraceAllIp (); - Simulator::Run (); - + NS_LOG_INFO ("Run Simulation."); + Simulator::Run (); Simulator::Destroy (); + NS_LOG_INFO ("Done."); } diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc new file mode 100644 index 000000000..8eebef638 --- /dev/null +++ b/examples/udp-echo.cc @@ -0,0 +1,213 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +// Network topology +// +// n0 n1 n2 n3 +// | | | | +// ================= +// LAN +// +// - UDP flows from n0 to n1 and back +// - DropTail queues +// - Tracing of queues and packet receptions to file "udp-echo.tr" + +#include "ns3/command-line.h" +#include "ns3/default-value.h" +#include "ns3/ptr.h" +#include "ns3/log.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/data-rate.h" +#include "ns3/ascii-trace.h" +#include "ns3/pcap-trace.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/mac48-address.h" +#include "ns3/ipv4-address.h" +#include "ns3/inet-socket-address.h" +#include "ns3/ipv4.h" +#include "ns3/socket.h" +#include "ns3/ipv4-route.h" +#include "ns3/udp-echo-client.h" +#include "ns3/udp-echo-server.h" + +using namespace ns3; + +NS_LOG_COMPONENT_DEFINE ("UdpEchoExample"); + +int +main (int argc, char *argv[]) +{ +// +// Users may find it convenient to turn on explicit debugging +// for selected modules; the below lines suggest how to do this +// +#if 0 + LogComponentEnable ("UdpEchoExample", LOG_LEVEL_INFO); + + LogComponentEnable("Object", LOG_LEVEL_ALL); + LogComponentEnable("Queue", LOG_LEVEL_ALL); + LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL); + LogComponentEnable("Channel", LOG_LEVEL_ALL); + LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL); + LogComponentEnable("NetDevice", LOG_LEVEL_ALL); + LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("PacketSocket", LOG_LEVEL_ALL); + LogComponentEnable("Socket", LOG_LEVEL_ALL); + LogComponentEnable("UdpSocket", LOG_LEVEL_ALL); + LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL); + LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL); + LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL); + LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); +#endif +// +// Set up default values for the simulation. Use the DefaultValue::Bind() +// technique to tell the system what subclass of Queue to use. The Bind +// command command tells the queue factory which class to instantiate when the +// queue factory is invoked in the topology code +// + DefaultValue::Bind ("Queue", "DropTailQueue"); +// +// Allow the user to override any of the defaults and the above Bind() at +// run-time, via command-line arguments +// + CommandLine::Parse (argc, argv); +// +// Explicitly create the nodes required by the topology (shown above). +// + NS_LOG_INFO ("Create nodes."); + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + NS_LOG_INFO ("Create channels."); +// +// Explicitly create the channels required by the topology (shown above). +// + Ptr lan = CsmaTopology::CreateCsmaChannel( + DataRate(5000000), MilliSeconds(2)); + + NS_LOG_INFO ("Build Topology."); +// +// Now fill out the topology by creating the net devices required to connect +// the nodes to the channels and hooking them up. AddIpv4CsmaNetDevice will +// create a net device, add a MAC address (in memory of the pink flamingo) and +// connect the net device to a nodes and also to a channel. the +// AddIpv4CsmaNetDevice method returns a net device index for the net device +// created on the node. Interpret nd0 as the net device we created for node +// zero. +// + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, + Mac48Address("08:00:2e:00:00:00")); + + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, + Mac48Address("08:00:2e:00:00:01")); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, + Mac48Address("08:00:2e:00:00:02")); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, + Mac48Address("08:00:2e:00:00:03")); +// +// We've got the "hardware" in place. Now we need to add IP addresses. +// + NS_LOG_INFO ("Assign IP Addresses."); +// +// XXX BUGBUG +// Need a better way to get the interface index. The point-to-point topology +// as implemented can't return the index since it creates interfaces on both +// sides (i.e., it does AddIpv4Addresses, not AddIpv4Address). We need a +// method on Ipv4 to find the interface index corresponding to a given ipv4 +// address. +// +// Assign IP addresses to the net devices and associated interfaces +// on the lan. The AddIpv4Address method returns an Ipv4 interface index +// which we do not need here. +// + CsmaIpv4Topology::AddIpv4Address (n0, nd0, Ipv4Address("10.1.1.1"), + Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n1, nd1, Ipv4Address("10.1.1.2"), + Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n2, nd2, Ipv4Address("10.1.1.3"), + Ipv4Mask("255.255.255.0")); + + CsmaIpv4Topology::AddIpv4Address (n3, nd3, Ipv4Address("10.1.1.4"), + Ipv4Mask("255.255.255.0")); + + NS_LOG_INFO ("Create Applications."); +// +// Create a UdpEchoServer application on node one. +// + uint16_t port = 9; // well-known echo port number + + Ptr server = Create (n1, port); +// +// Create a UdpEchoClient application to send UDP datagrams from node zero to +// node one. +// + uint32_t packetSize = 1024; + uint32_t maxPacketCount = 1; + Time interPacketInterval = Seconds (1.); + + Ptr client = Create (n0, "10.1.1.2", port, + maxPacketCount, interPacketInterval, packetSize); +// +// Tell the applications when to start and stop. +// + server->Start(Seconds(1.)); + client->Start(Seconds(2.)); + + server->Stop (Seconds(10.)); + client->Stop (Seconds(10.)); +// +// Configure tracing of all enqueue, dequeue, and NetDevice receive events. +// Trace output will be sent to the file "udp-echo.tr" +// + NS_LOG_INFO ("Configure Tracing."); + AsciiTrace asciitrace ("udp-echo.tr"); + asciitrace.TraceAllNetDeviceRx (); + asciitrace.TraceAllQueues (); +// +// Also configure some tcpdump traces; each interface will be traced. +// The output files will be named: +// udp-echo.pcap-- +// and can be read by the "tcpdump -r" command (use "-tt" option to +// display timestamps correctly) +// + PcapTrace pcaptrace ("udp-echo.pcap"); + pcaptrace.TraceAllIp (); +// +// Now, do the actual simulation. +// + NS_LOG_INFO ("Run Simulation."); + Simulator::Run (); + Simulator::Destroy (); + NS_LOG_INFO ("Done."); +} diff --git a/examples/waf b/examples/waf new file mode 100755 index 000000000..191b7dbb2 --- /dev/null +++ b/examples/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../waf "$@" diff --git a/examples/wscript b/examples/wscript index e5e771555..a1f16e29b 100644 --- a/examples/wscript +++ b/examples/wscript @@ -14,10 +14,22 @@ def build(bld): ['csma', 'internet-node']) obj.source = 'csma-one-subnet.cc' + obj = bld.create_ns3_program('udp-echo', + ['csma', 'internet-node']) + obj.source = 'udp-echo.cc' + + obj = bld.create_ns3_program('csma-broadcast', + ['csma', 'internet-node']) + obj.source = 'csma-broadcast.cc' + obj = bld.create_ns3_program('csma-packet-socket', ['csma', 'internet-node']) obj.source = 'csma-packet-socket.cc' + obj = bld.create_ns3_program('csma-multicast', + ['csma', 'internet-node']) + obj.source = 'csma-multicast.cc' + obj = bld.create_ns3_program( 'mixed-global-routing', ['point-to-point', 'internet-node', 'global-routing' , 'csma-cd']) obj.source = 'mixed-global-routing.cc' diff --git a/samples/main-channel.cc b/samples/main-channel.cc index 250a354c8..99ceb04ec 100644 --- a/samples/main-channel.cc +++ b/samples/main-channel.cc @@ -18,7 +18,7 @@ */ #include -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/assert.h" #include "ns3/packet.h" #include "ns3/drop-tail.h" @@ -27,6 +27,8 @@ using namespace ns3; +NS_LOG_COMPONENT_DEFINE ("ChannelSample"); + // =========================================================================== // Cook up a simplistic Internet Node // =========================================================================== @@ -48,19 +50,19 @@ protected: FakeInternetNode::FakeInternetNode () { - NS_DEBUG_UNCOND("FakeInternetNode::FakeInternetNode ()"); + NS_LOG_FUNCTION; } FakeInternetNode::~FakeInternetNode () { - NS_DEBUG_UNCOND("FakeInternetNode::~FakeInternetNode ()"); + NS_LOG_FUNCTION; } void FakeInternetNode::Doit (void) { - NS_DEBUG_UNCOND("FakeInternetNode::Doit ()"); - NS_DEBUG_UNCOND("FakeInternetNode::Doit (): **** Send outbound packet"); + NS_LOG_FUNCTION; + NS_LOG_INFO ("**** Send outbound packet"); Packet p; m_dtqOutbound.Enqueue(p); @@ -70,9 +72,9 @@ FakeInternetNode::Doit (void) bool FakeInternetNode::UpperDoSendUp (Packet &p) { - NS_DEBUG_UNCOND("FakeInternetNode::UpperDoSendUp (" << &p << ")"); - - NS_DEBUG_UNCOND("FakeInternetNode::UpperDoSendUp (): **** Receive inbound packet"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); + NS_LOG_INFO ("**** Receive inbound packet"); m_dtqInbound.Enqueue(p); return m_dtqInbound.Dequeue(p); } @@ -80,7 +82,8 @@ FakeInternetNode::UpperDoSendUp (Packet &p) bool FakeInternetNode::UpperDoPull (Packet &p) { - NS_DEBUG_UNCOND("FakeInternetNode::DoPull (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); return m_dtqOutbound.Dequeue(p); } @@ -107,29 +110,29 @@ protected: FakePhysicalLayer::FakePhysicalLayer () { - NS_DEBUG_UNCOND("FakePhysicalLayer::FakePhysicalLayer ()"); + NS_LOG_FUNCTION; } FakePhysicalLayer::~FakePhysicalLayer () { - NS_DEBUG_UNCOND("FakePhysicalLayer::~FakePhysicalLayer ()"); + NS_LOG_FUNCTION; } bool FakePhysicalLayer::LowerDoNotify (LayerConnectorUpper *upper) { - NS_DEBUG_UNCOND("FakePhysicalLayer::LowerDoNotify ()"); + NS_LOG_FUNCTION; Packet p; - NS_DEBUG_UNCOND("FakePhysicalLayer::LowerDoNotify (): Starting pull"); + NS_LOG_LOGIC ("Starting pull"); NS_ASSERT(m_upperPartner); m_upperPartner->UpperPull(p); m_dtqOutbound.Enqueue(p); - NS_DEBUG_UNCOND("FakePhysicalLayer::LowerDoNotify (): Got bits, Notify lower"); + NS_LOG_LOGIC ("Got bits, Notify lower"); NS_ASSERT(m_lowerPartner); return m_lowerPartner->LowerNotify(this); @@ -138,7 +141,8 @@ FakePhysicalLayer::LowerDoNotify (LayerConnectorUpper *upper) bool FakePhysicalLayer::UpperDoSendUp (Packet &p) { - NS_DEBUG_UNCOND("FakePhysicalLayer::UpperDoSendUp (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); NS_ASSERT(m_upperPartner); return m_upperPartner->UpperSendUp(p); @@ -147,7 +151,8 @@ FakePhysicalLayer::UpperDoSendUp (Packet &p) bool FakePhysicalLayer::UpperDoPull (Packet &p) { - NS_DEBUG_UNCOND("FakePhysicalLayer::DoPull (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); return m_dtqOutbound.Dequeue(p); } @@ -164,24 +169,17 @@ public: FakeChannel::FakeChannel () { - NS_DEBUG_UNCOND("FakeChannel::FakeChannel ()"); + NS_LOG_FUNCTION; } FakeChannel::~FakeChannel () { - NS_DEBUG_UNCOND("FakeChannel::~FakeChannel ()"); + NS_LOG_FUNCTION; } int main (int argc, char *argv[]) { - NS_DEBUG_UNCOND("Channel Hackorama"); - -#if 0 - DebugComponentEnable("Queue"); - DebugComponentEnable("DropTailQueue"); - DebugComponentEnable("LayerConnector"); - DebugComponentEnable("Channel"); -#endif + NS_LOG_INFO ("Channel Hackorama"); FakeInternetNode node1, node2, node3, node4; FakePhysicalLayer phys1, phys2, phys3, phys4; diff --git a/samples/main-default-value.cc b/samples/main-default-value.cc index f125a7181..dcaa8a83a 100644 --- a/samples/main-default-value.cc +++ b/samples/main-default-value.cc @@ -3,7 +3,7 @@ #include #include "ns3/default-value.h" #include "ns3/command-line.h" -#include "ns3/debug.h" +#include "ns3/log.h" using namespace ns3; @@ -76,9 +76,9 @@ int main (int argc, char* argv[]) DefaultValue::Bind("testInt1", "57"); TestClass* testclass = new TestClass (); - NS_DEBUG_UNCOND("TestBool1 default value (" << testclass->m_testBool1 << ")"); - NS_DEBUG_UNCOND("TestInt1 default value (" << testclass->m_testInt1 << ")"); - NS_DEBUG_UNCOND("TestInt2 default value (" << testclass->m_testInt2 << ")"); + NS_LOG_UNCOND("TestBool1 default value (" << testclass->m_testBool1 << ")"); + NS_LOG_UNCOND("TestInt1 default value (" << testclass->m_testInt1 << ")"); + NS_LOG_UNCOND("TestInt2 default value (" << testclass->m_testInt2 << ")"); delete testclass; return 0; diff --git a/samples/main-query-interface.cc b/samples/main-query-interface.cc index 20da36ff3..db23a5000 100644 --- a/samples/main-query-interface.cc +++ b/samples/main-query-interface.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/object.h" #include "ns3/component-manager.h" @@ -79,10 +79,11 @@ private: void AnInterface::methodA (void) { + NS_LOG_FUNCTION; // pre-dispatch asserts - NS_DEBUG_UNCOND("AnInterface pre-condition::methodA"); + NS_LOG_LOGIC ("pre-condition"); domethodA (); - NS_DEBUG_UNCOND("AnInterface post-condition::methodA\n"); + NS_LOG_LOGIC ("post-condition"); // post-dispatch asserts } @@ -114,12 +115,13 @@ private: void AnImplementation::methodImpl (void) { - NS_DEBUG_UNCOND("AnImplementation::methodImpl\n"); + NS_LOG_FUNCTION; } AnImplementation::AnImplementation (void) { + NS_LOG_FUNCTION; // enable our interface SetInterfaceId (AnImplementation::iid); } @@ -127,7 +129,7 @@ AnImplementation::AnImplementation (void) void AnImplementation::domethodA () { - NS_DEBUG_UNCOND("AnImplementation::domethodA"); + NS_LOG_FUNCTION; } // @@ -201,7 +203,7 @@ ANewImplementation::ANewImplementation (void) void ANewImplementation::methodImpl (void) { - NS_DEBUG_UNCOND("ANewImplementation::methodImpl\n"); + NS_LOG_FUNCTION; } const InterfaceId ANewImplementation::iid = @@ -238,7 +240,7 @@ AnExtendedImplementation::AnExtendedImplementation (void) void AnExtendedImplementation::methodExtendedImpl (void) { - NS_DEBUG_UNCOND("AnExtendedImplementation::methodExtendedImpl\n"); + NS_LOG_FUNCTION; } const InterfaceId AnExtendedImplementation::iid = diff --git a/samples/main-random-topology.cc b/samples/main-random-topology.cc index 3fb52a0d9..3021ed3fb 100644 --- a/samples/main-random-topology.cc +++ b/samples/main-random-topology.cc @@ -15,7 +15,7 @@ using namespace ns3; static void -CourseChange (Ptr position) +CourseChange (const TraceContext &context, Ptr position) { Position pos = position->Get (); std::cout << Simulator::Now () << ", pos=" << position << ", x=" << pos.x << ", y=" << pos.y @@ -39,7 +39,7 @@ int main (int argc, char *argv[]) for (uint32_t i = 0; i < 10000; i++) { Ptr notifier = Create (); - notifier->RegisterListener (MakeCallback (&CourseChange)); + notifier->TraceConnect ("/course-change", MakeCallback (&CourseChange)); objects.push_back (notifier); } diff --git a/samples/main-tw.cc b/samples/main-tw.cc index c4e1ff1f4..4fcb8b94b 100644 --- a/samples/main-tw.cc +++ b/samples/main-tw.cc @@ -18,14 +18,14 @@ */ #include -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/trace-writer.h" using namespace ns3; int main (int argc, char *argv[]) { - NS_DEBUG_UNCOND("TraceWriter Test") + NS_LOG_UNCOND("TraceWriter Test") TraceWriter writer1; writer1.Open("trace-writer-test.txt"); diff --git a/samples/waf b/samples/waf new file mode 100755 index 000000000..191b7dbb2 --- /dev/null +++ b/samples/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../waf "$@" diff --git a/samples/wscript b/samples/wscript index 998ab464f..a8ffc2d38 100644 --- a/samples/wscript +++ b/samples/wscript @@ -26,7 +26,7 @@ def build(bld): obj.source = 'main-test.cc' obj = bld.create_ns3_program('main-simple', - ['node', 'internet-node', 'applications']) + ['node', 'internet-node', 'onoff']) obj.source = 'main-simple.cc' obj = bld.create_ns3_program('main-default-value', diff --git a/src/applications/onoff-application.cc b/src/applications/onoff/onoff-application.cc similarity index 86% rename from src/applications/onoff-application.cc rename to src/applications/onoff/onoff-application.cc index 32bcd7564..29f3d9d04 100644 --- a/src/applications/onoff-application.cc +++ b/src/applications/onoff/onoff-application.cc @@ -22,6 +22,7 @@ // George F. Riley, Georgia Tech, Spring 2007 // Adapted from ApplicationOnOff in GTNetS. +#include "ns3/log.h" #include "ns3/address.h" #include "ns3/node.h" #include "ns3/nstime.h" @@ -34,6 +35,8 @@ #include "ns3/packet.h" #include "onoff-application.h" +NS_LOG_COMPONENT_DEFINE ("OnOffApplication"); + using namespace std; namespace ns3 { @@ -70,8 +73,8 @@ OnOffApplication::OnOffApplication(Ptr n, : Application(n), m_cbrRate (rate) { - Construct (n, remote, iid, - ontime, offtime, size); + NS_LOG_FUNCTION; + Construct (n, remote, iid, ontime, offtime, size); } void @@ -82,6 +85,8 @@ OnOffApplication::Construct (Ptr n, const RandomVariable& offTime, uint32_t size) { + NS_LOG_FUNCTION; + m_socket = 0; m_peer = remote; m_connected = false; @@ -95,30 +100,40 @@ OnOffApplication::Construct (Ptr n, m_iid = iid; } - OnOffApplication::~OnOffApplication() -{} +{ + NS_LOG_FUNCTION; +} void OnOffApplication::SetMaxBytes(uint32_t maxBytes) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << maxBytes << ")"); m_maxBytes = maxBytes; } void OnOffApplication::SetDefaultRate (const DataRate &rate) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &rate << ")"); g_defaultRate.SetValue (rate); } + void OnOffApplication::SetDefaultSize (uint32_t size) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << size << ")"); g_defaultSize.SetValue (size); } void OnOffApplication::DoDispose (void) { + NS_LOG_FUNCTION; + m_socket = 0; delete m_onTime; delete m_offTime; @@ -130,10 +145,11 @@ OnOffApplication::DoDispose (void) Application::DoDispose (); } - // Application Methods -void OnOffApplication::StartApplication() // Called at time specified by Start +void OnOffApplication::StartApplication() // Called at time specified by Start { + NS_LOG_FUNCTION; + // Create the socket if not already if (!m_socket) { @@ -151,8 +167,10 @@ void OnOffApplication::StartApplication() // Called at time specified by Star ScheduleStartEvent(); } -void OnOffApplication::StopApplication() // Called at time specified by Stop +void OnOffApplication::StopApplication() // Called at time specified by Stop { + NS_LOG_FUNCTION; + if (m_sendEvent.IsRunning ()) { // Cancel the pending send packet event // Calculate residual bits since last packet sent @@ -166,23 +184,32 @@ void OnOffApplication::StopApplication() // Called at time specified by Stop // Event handlers void OnOffApplication::StartSending() { + NS_LOG_FUNCTION; + ScheduleNextTx(); // Schedule the send packet event } void OnOffApplication::StopSending() { + NS_LOG_FUNCTION; + Simulator::Cancel(m_sendEvent); } // Private helpers void OnOffApplication::ScheduleNextTx() { + NS_LOG_FUNCTION; + if (m_totBytes < m_maxBytes) { uint32_t bits = m_pktSize * 8 - m_residualBits; + NS_LOG_LOGIC ("bits = " << bits); Time nextTime(Seconds (bits / static_cast(m_cbrRate.GetBitRate()))); // Time till next packet - m_sendEvent = Simulator::Schedule(nextTime, &OnOffApplication::SendPacket, this); + NS_LOG_LOGIC ("nextTime = " << nextTime); + m_sendEvent = Simulator::Schedule(nextTime, + &OnOffApplication::SendPacket, this); } else { // All done, cancel any pending events @@ -192,12 +219,17 @@ void OnOffApplication::ScheduleNextTx() void OnOffApplication::ScheduleStartEvent() { // Schedules the event to start sending data (switch to the "On" state) + NS_LOG_FUNCTION; + Time offInterval = Seconds(m_offTime->GetValue()); + NS_LOG_LOGIC ("start at " << offInterval); m_startStopEvent = Simulator::Schedule(offInterval, &OnOffApplication::StartSending, this); } void OnOffApplication::ScheduleStopEvent() { // Schedules the event to stop sending data (switch to "Off" state) + NS_LOG_FUNCTION; + Time onInterval = Seconds(m_onTime->GetValue()); Simulator::Schedule(onInterval, &OnOffApplication::StopSending, this); } @@ -205,6 +237,8 @@ void OnOffApplication::ScheduleStopEvent() void OnOffApplication::SendPacket() { + NS_LOG_FUNCTION; + NS_ASSERT (m_sendEvent.IsExpired ()); m_socket->Send(Packet (m_pktSize)); m_totBytes += m_pktSize; @@ -215,12 +249,15 @@ void OnOffApplication::SendPacket() void OnOffApplication::ConnectionSucceeded(Ptr) { + NS_LOG_FUNCTION; + m_connected = true; ScheduleStartEvent(); } void OnOffApplication::ConnectionFailed(Ptr) { + NS_LOG_FUNCTION; cout << "OnOffApplication, Connection Failed" << endl; } diff --git a/src/applications/onoff-application.h b/src/applications/onoff/onoff-application.h similarity index 100% rename from src/applications/onoff-application.h rename to src/applications/onoff/onoff-application.h diff --git a/src/applications/onoff/waf b/src/applications/onoff/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/applications/onoff/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/applications/wscript b/src/applications/onoff/wscript similarity index 76% rename from src/applications/wscript rename to src/applications/onoff/wscript index 02aa11f7f..c1bfe4c52 100644 --- a/src/applications/wscript +++ b/src/applications/onoff/wscript @@ -1,12 +1,12 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): - obj = bld.create_ns3_module('applications', ['node']) - obj.source = [ + module = bld.create_ns3_module('onoff', ['core']) + module.source = [ 'onoff-application.cc', ] - headers = bld.create_obj('ns3header') headers.source = [ 'onoff-application.h', ] + diff --git a/src/applications/packet-sink/packet-sink.cc b/src/applications/packet-sink/packet-sink.cc new file mode 100644 index 000000000..503e0cbff --- /dev/null +++ b/src/applications/packet-sink/packet-sink.cc @@ -0,0 +1,109 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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: Tom Henderson (tomhend@u.washington.edu) + */ +#include "ns3/address.h" +#include "ns3/log.h" +#include "ns3/inet-socket-address.h" +#include "ns3/node.h" +#include "ns3/socket.h" +#include "ns3/simulator.h" +#include "ns3/socket-factory.h" +#include "ns3/packet.h" +#include "packet-sink.h" + +using namespace std; + +namespace ns3 { + +NS_LOG_COMPONENT_DEFINE ("PacketSinkApplication"); + +// Constructors + +PacketSink::PacketSink (Ptr n, + const Address &local, + std::string iid) + : Application(n) +{ + Construct (n, local, iid); +} + +void +PacketSink::Construct (Ptr n, + const Address &local, + std::string iid) +{ + m_socket = 0; + m_local = local; + m_iid = iid; +} + +PacketSink::~PacketSink() +{} + +void +PacketSink::DoDispose (void) +{ + m_socket = 0; + + // chain up + Application::DoDispose (); +} + + +// Application Methods +void PacketSink::StartApplication() // Called at time specified by Start +{ + // Create the socket if not already + if (!m_socket) + { + InterfaceId iid = InterfaceId::LookupByName (m_iid); + Ptr socketFactory = + GetNode ()->QueryInterface (iid); + m_socket = socketFactory->CreateSocket (); + m_socket->Bind (m_local); + } + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) MakeCallback(&PacketSink::Receive, this)); +} + +void PacketSink::StopApplication() // Called at time specified by Stop +{ + if (!m_socket) + { + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) NULL); + + } +} + +// This LOG output inspired by the application on Joseph Kopena's wiki +void PacketSink::Receive(Ptr socket, const Packet &packet, + const Address &from) +{ + if (InetSocketAddress::IsMatchingType (from)) + { + InetSocketAddress address = InetSocketAddress::ConvertFrom (from); + NS_LOG_INFO ("Received " << packet.GetSize() << " bytes from " << + address.GetIpv4() << " [" << address << "]---'" << + packet.PeekData() << "'"); + // TODO: Add a tracing source here + } +} + +} // Namespace ns3 diff --git a/src/applications/packet-sink/packet-sink.h b/src/applications/packet-sink/packet-sink.h new file mode 100644 index 000000000..8af7b3ab5 --- /dev/null +++ b/src/applications/packet-sink/packet-sink.h @@ -0,0 +1,87 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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: Tom Henderson (tomhend@u.washington.edu) + */ + +#ifndef __packet_sink_h__ +#define __packet_sink_h__ + +#include "ns3/application.h" +#include "ns3/event-id.h" +#include "ns3/ptr.h" + +namespace ns3 { + +class Address; +class Socket; +class Packet; + +/** + * \brief Receive and consume traffic generated to an IP address and port + * + * This application was written to complement OnOffApplication, but it + * is more general so a PacketSink name was selected. Functionally it is + * important to use in multicast situations, so that reception of the layer-2 + * multicast frames of interest are enabled, but it is also useful for + * unicast as an example of how you can write something simple to receive + * packets at the application layer. Also, if an IP stack generates + * ICMP Port Unreachable errors, receiving applications will be needed. + * + * The constructor specifies the Address (IP address and port) and the + * transport protocol to use. A virtual Receive () method is installed + * as a callback on the receiving socket. By default, when logging is + * enabled, it prints out the size of packets and their address, but + * we intend to also add a tracing source to Receive() at a later date. + */ +class PacketSink : public Application +{ +public: + /** + * \param n node associated to this application + * \param local local address to bind to + * \param iid string to identify transport protocol of interest + */ + PacketSink (Ptr n, + const Address &local, + std::string iid); + + virtual ~PacketSink (); + +protected: + virtual void DoDispose (void); +private: + // inherited from Application base class. + virtual void StartApplication (void); // Called at time specified by Start + virtual void StopApplication (void); // Called at time specified by Stop + + void Construct (Ptr n, + const Address &local, + std::string iid); + + virtual void Receive (Ptr socket, const Packet& packet, const Address& from); + + Ptr m_socket; // Associated socket + Address m_local; // Local address to bind to + std::string m_iid; // Protocol name (e.g., "Udp") + +}; + +} // namespace ns3 + +#endif + diff --git a/src/applications/packet-sink/waf b/src/applications/packet-sink/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/applications/packet-sink/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/applications/packet-sink/wscript b/src/applications/packet-sink/wscript new file mode 100644 index 000000000..332b6e4a1 --- /dev/null +++ b/src/applications/packet-sink/wscript @@ -0,0 +1,12 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + module = bld.create_ns3_module('packet-sink', ['node']) + module.source = [ + 'packet-sink.cc', + ] + headers = bld.create_obj('ns3header') + headers.source = [ + 'packet-sink.h', + ] + diff --git a/src/applications/udp-echo/udp-echo-client.cc b/src/applications/udp-echo/udp-echo-client.cc new file mode 100644 index 000000000..a5489ef2c --- /dev/null +++ b/src/applications/udp-echo/udp-echo-client.cc @@ -0,0 +1,168 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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 + */ +#include "ns3/log.h" +#include "ns3/ipv4-address.h" +#include "ns3/nstime.h" +#include "ns3/inet-socket-address.h" +#include "ns3/socket.h" +#include "ns3/simulator.h" +#include "ns3/socket-factory.h" +#include "ns3/packet.h" +#include "udp-echo-client.h" + +namespace ns3 { + +NS_LOG_COMPONENT_DEFINE ("UdpEchoClientApplication"); + +UdpEchoClient::UdpEchoClient ( + Ptr n, + Ipv4Address serverAddress, + uint16_t serverPort, + uint32_t count, + Time interval, + uint32_t size) +: + Application(n) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << n << ", " << serverAddress << + ", " << serverPort << ", " << count << ", " << interval << + ", " << size << ")"); + + Construct (n, serverAddress, serverPort, count, interval, size); +} + +UdpEchoClient::~UdpEchoClient() +{ + NS_LOG_FUNCTION; +} + +void +UdpEchoClient::Construct ( + Ptr n, + Ipv4Address serverAddress, + uint16_t serverPort, + uint32_t count, + Time interval, + uint32_t size) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << n << ", " << serverAddress << + ", " << serverPort << ", " << count << ", " << interval << + ", " << size << ")"); + + m_node = n; + m_serverAddress = serverAddress; + m_serverPort = serverPort; + m_count = count; + m_interval = interval; + m_size = size; + + m_sent = 0; + m_socket = 0; + m_peer = InetSocketAddress (serverAddress, serverPort); + m_sendEvent = EventId (); +} + +void +UdpEchoClient::DoDispose (void) +{ + NS_LOG_FUNCTION; + Application::DoDispose (); +} + +void +UdpEchoClient::StartApplication (void) +{ + NS_LOG_FUNCTION; + + if (!m_socket) + { + InterfaceId iid = InterfaceId::LookupByName ("Udp"); + Ptr socketFactory = + GetNode ()->QueryInterface (iid); + m_socket = socketFactory->CreateSocket (); + m_socket->Bind (); + m_socket->Connect (m_peer); + } + + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) MakeCallback(&UdpEchoClient::Receive, this)); + + ScheduleTransmit (Seconds(0.)); +} + +void +UdpEchoClient::StopApplication () +{ + NS_LOG_FUNCTION; + + if (!m_socket) + { + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) NULL); + } + + Simulator::Cancel(m_sendEvent); +} + +void +UdpEchoClient::ScheduleTransmit (Time dt) +{ + NS_LOG_FUNCTION; + m_sendEvent = Simulator::Schedule(dt, &UdpEchoClient::Send, this); +} + +void +UdpEchoClient::Send (void) +{ + NS_LOG_FUNCTION; + + NS_ASSERT (m_sendEvent.IsExpired ()); + + Packet p (m_size); + m_socket->Send (p); + ++m_sent; + + NS_LOG_INFO ("Sent " << m_size << " bytes to " << m_serverAddress); + + if (m_sent < m_count) + { + ScheduleTransmit (m_interval); + } +} + +void +UdpEchoClient::Receive( + Ptr socket, + const Packet &packet, + const Address &from) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << socket << ", " << packet << ", " << from << ")"); + + if (InetSocketAddress::IsMatchingType (from)) + { + InetSocketAddress address = InetSocketAddress::ConvertFrom (from); + NS_LOG_INFO ("Received " << packet.GetSize() << " bytes from " << + address.GetIpv4()); + } +} + + +} // Namespace ns3 diff --git a/src/applications/udp-echo/udp-echo-client.h b/src/applications/udp-echo/udp-echo-client.h new file mode 100644 index 000000000..91914287d --- /dev/null +++ b/src/applications/udp-echo/udp-echo-client.h @@ -0,0 +1,72 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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 + */ + +#ifndef __UDP_ECHO_CLIENT_H__ +#define __UDP_ECHO_CLIENT_H__ + +#include "ns3/application.h" +#include "ns3/event-id.h" +#include "ns3/ptr.h" + +namespace ns3 { + +class Address; +class Socket; +class Packet; + +class UdpEchoClient : public Application +{ +public: + UdpEchoClient (Ptr n, Ipv4Address serverAddr, uint16_t serverPort, + uint32_t count, Time interval, uint32_t size); + + virtual ~UdpEchoClient (); + +protected: + virtual void DoDispose (void); + +private: + void Construct (Ptr n, Ipv4Address serverAddr, uint16_t serverPort, + uint32_t count, Time interval, uint32_t size); + + virtual void StartApplication (void); + virtual void StopApplication (void); + + void ScheduleTransmit (Time dt); + void Send (void); + + void Receive(Ptr socket, const Packet &packet, const Address &from); + + Ptr m_node; + Ipv4Address m_serverAddress; + uint16_t m_serverPort; + uint32_t m_count; + Time m_interval; + uint32_t m_size; + + uint32_t m_sent; + Ptr m_socket; + Address m_peer; + EventId m_sendEvent; + +}; + +} // namespace ns3 + +#endif // __UDP_ECHO_CLIENT_H__ + diff --git a/src/applications/udp-echo/udp-echo-server.cc b/src/applications/udp-echo/udp-echo-server.cc new file mode 100644 index 000000000..11654ed8d --- /dev/null +++ b/src/applications/udp-echo/udp-echo-server.cc @@ -0,0 +1,123 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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 + */ + +#include "ns3/log.h" +#include "ns3/ipv4-address.h" +#include "ns3/nstime.h" +#include "ns3/inet-socket-address.h" +#include "ns3/socket.h" +#include "ns3/simulator.h" +#include "ns3/socket-factory.h" +#include "ns3/packet.h" + +#include "udp-echo-server.h" + +namespace ns3 { + +NS_LOG_COMPONENT_DEFINE ("UdpEchoServerApplication"); + +UdpEchoServer::UdpEchoServer ( + Ptr n, + uint16_t port) +: + Application(n) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << n << ", " << port << ")"); + + Construct (n, port); +} + +UdpEchoServer::~UdpEchoServer() +{ + NS_LOG_FUNCTION; +} + +void +UdpEchoServer::Construct ( + Ptr n, + uint16_t port) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << n << ", " << port << ")"); + + m_node = n; + m_port = port; + + m_socket = 0; + m_local = InetSocketAddress (Ipv4Address::GetAny (), port); +} + +void +UdpEchoServer::DoDispose (void) +{ + NS_LOG_FUNCTION; + Application::DoDispose (); +} + +void +UdpEchoServer::StartApplication (void) +{ + NS_LOG_FUNCTION; + + if (!m_socket) + { + InterfaceId iid = InterfaceId::LookupByName ("Udp"); + Ptr socketFactory = + GetNode ()->QueryInterface (iid); + m_socket = socketFactory->CreateSocket (); + m_socket->Bind (m_local); + } + + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) MakeCallback(&UdpEchoServer::Receive, this)); +} + +void +UdpEchoServer::StopApplication () +{ + NS_LOG_FUNCTION; + + if (!m_socket) + { + m_socket->SetRecvCallback((Callback, const Packet &, + const Address &>) NULL); + } +} + +void +UdpEchoServer::Receive( + Ptr socket, + const Packet &packet, + const Address &from) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << socket << ", " << packet << ", " << from << ")"); + + if (InetSocketAddress::IsMatchingType (from)) + { + InetSocketAddress address = InetSocketAddress::ConvertFrom (from); + NS_LOG_INFO ("Received " << packet.GetSize() << " bytes from " << + address.GetIpv4()); + + NS_LOG_LOGIC ("Echoing packet"); + socket->SendTo (from, packet); + } +} + +} // Namespace ns3 diff --git a/src/applications/udp-echo/udp-echo-server.h b/src/applications/udp-echo/udp-echo-server.h new file mode 100644 index 000000000..597fef8fe --- /dev/null +++ b/src/applications/udp-echo/udp-echo-server.h @@ -0,0 +1,59 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2007 University of Washington + * + * 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 + */ + +#ifndef __UDP_ECHO_SERVER_H__ +#define __UDP_ECHO_SERVER_H__ + +#include "ns3/application.h" +#include "ns3/event-id.h" +#include "ns3/ptr.h" + +namespace ns3 { + +class Address; +class Socket; +class Packet; + +class UdpEchoServer : public Application +{ +public: + UdpEchoServer (Ptr n, uint16_t clientPort); + virtual ~UdpEchoServer (); + +protected: + virtual void DoDispose (void); + +private: + void Construct (Ptr n, uint16_t clientPort); + + virtual void StartApplication (void); + virtual void StopApplication (void); + + void Receive(Ptr socket, const Packet &packet, const Address &from); + + Ptr m_node; + uint16_t m_port; + + Ptr m_socket; + Address m_local; +}; + +} // namespace ns3 + +#endif // __UDP_ECHO_SERVER_H__ + diff --git a/src/applications/udp-echo/waf b/src/applications/udp-echo/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/applications/udp-echo/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/applications/udp-echo/wscript b/src/applications/udp-echo/wscript new file mode 100644 index 000000000..f6416980a --- /dev/null +++ b/src/applications/udp-echo/wscript @@ -0,0 +1,14 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + module = bld.create_ns3_module('udp-echo', ['internet-node']) + module.source = [ + 'udp-echo-client.cc', + 'udp-echo-server.cc', + ] + headers = bld.create_obj('ns3header') + headers.source = [ + 'udp-echo-client.h', + 'udp-echo-server.h', + ] + diff --git a/src/common/array-trace-resolver.h b/src/common/array-trace-resolver.h deleted file mode 100644 index e4507d4af..000000000 --- a/src/common/array-trace-resolver.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * All rights reserved. - * - * 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: Mathieu Lacage - */ -#ifndef ARRAY_TRACE_RESOLVER_H -#define ARRAY_TRACE_RESOLVER_H - -#include -#include -#include "ns3/callback.h" -#include "trace-resolver.h" - -namespace ns3 { - -/** - * \brief a helper class to offer trace resolution for an array of objects. - * \ingroup lowleveltracing - */ -template -class ArrayTraceResolver : public TraceResolver -{ -public: - /** - * \param context trace context associated to this trace resolver - * \param getSize callback which returns dynamically the size of underlying array - * \param get callback which returns any element in the underlying array - * - * Construct a trace resolver which can match any input integer - * against an element in an array. The array is accessed using a - * pair of callbacks. It is the responsability of the user to - * provide two such callbacks whose job is to adapt the array - * API to the resolver needs. Each element of the array is expected - * to provide a method named CreateTraceResolver which takes as - * only argument a reference to a const TraceContext and returns - * a pointer to a TraceResolver. i.e. the signature is: - * TraceResolver * (*) (TraceContext const &) - */ - ArrayTraceResolver (TraceContext const &context, - Callback getSize, - Callback get); -private: - virtual TraceResolverList DoLookup (std::string id) const; - Callback m_getSize; - Callback m_get; -}; -}//namespace ns3 - -namespace ns3 { - -template -ArrayTraceResolver::ArrayTraceResolver (TraceContext const &context, - Callback getSize, - Callback get) - : TraceResolver (context), - m_getSize (getSize), - m_get (get) -{} -template -TraceResolver::TraceResolverList -ArrayTraceResolver::DoLookup (std::string id) const -{ - TraceResolverList list; - if (id == "*") - { - for (uint32_t i = 0; i < m_getSize (); i++) - { - TraceContext context = GetContext (); - INDEX index = i; - context.Add (index); - list.push_back (m_get (i)->CreateTraceResolver (context)); - } - } - return list; -} - - -}//namespace ns3 - -#endif /* ARRAY_TRACE_RESOLVER_H */ diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 196bb4889..6154df7d3 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -1,7 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2005,2006 INRIA - * All rights reserved. + * Copyright (c) 2005,2006,2007 INRIA * * 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 @@ -20,385 +19,534 @@ */ #include "buffer.h" #include "ns3/assert.h" - +#include "ns3/log.h" #include -//#define TRACE(x) std::cout << x << std::endl; -#define TRACE(x) + +NS_LOG_COMPONENT_DEFINE ("Buffer"); + +#define LOG_INTERNAL_STATE(y) \ +NS_LOG_LOGIC (y << "start="< { +public: + ~BufferDataList (); +}; + +static struct BufferData *BufferAllocate (uint32_t reqSize); + +static void BufferDeallocate (struct BufferData *data); + + +} // namespace ns3 + +namespace ns3 { + +#ifdef BUFFER_HEURISTICS +static uint32_t g_recommendedStart = 0; +static uint64_t g_nAddNoRealloc = 0; +static uint64_t g_nAddRealloc = 0; +static BufferDataList g_freeList; +static uint32_t g_maxSize = 0; +static uint64_t g_nAllocs = 0; +static uint64_t g_nCreates = 0; +#endif /* BUFFER_HEURISTICS */ + +BufferDataList::~BufferDataList () +{ +#ifdef PRINT_STATS +#ifdef BUFFER_HEURISTICS + double efficiency; + efficiency = g_nAllocs; + efficiency /= g_nCreates; + std::cout <<"buffer free list efficiency="<= m_data->m_dirtyStart && + m_end <= m_data->m_dirtyEnd; + bool internalSizeOk = m_end - (m_zeroAreaEnd - m_zeroAreaStart) <= m_data->m_size && + m_start <= m_data->m_size && + m_zeroAreaStart <= m_data->m_size; -namespace ns3 { + NS_ASSERT (offsetsOk); + NS_ASSERT (dirtyOk); + NS_ASSERT (internalSizeOk); + return m_data->m_count > 0 && offsetsOk && dirtyOk && + internalSizeOk; +} + +void +Buffer::Initialize (uint32_t zeroSize) +{ + m_data = Buffer::Create (0); +#ifdef BUFFER_HEURISTICS + m_start = std::min (m_data->m_size, g_recommendedStart); + m_maxZeroAreaStart = m_start; +#else + m_start = 0; +#endif /* BUFFER_HEURISTICS */ + m_zeroAreaStart = m_start; + m_zeroAreaEnd = m_zeroAreaStart + zeroSize; + m_end = m_zeroAreaEnd; + m_data->m_dirtyStart = m_start; + m_data->m_dirtyEnd = m_end; + NS_ASSERT (CheckInternalState ()); +} + +Buffer::Buffer (Buffer const&o) + : m_data (o.m_data), +#ifdef BUFFER_HEURISTICS + m_maxZeroAreaStart (o.m_zeroAreaStart), +#endif + m_zeroAreaStart (o.m_zeroAreaStart), + m_zeroAreaEnd (o.m_zeroAreaEnd), + m_start (o.m_start), + m_end (o.m_end) +{ + m_data->m_count++; + NS_ASSERT (CheckInternalState ()); +} + +Buffer & +Buffer::operator = (Buffer const&o) +{ + NS_ASSERT (CheckInternalState ()); + if (m_data != o.m_data) + { + // not assignment to self. + m_data->m_count--; + if (m_data->m_count == 0) + { + Recycle (m_data); + } + m_data = o.m_data; + m_data->m_count++; + } + HEURISTICS ( + g_recommendedStart = std::max (g_recommendedStart, m_maxZeroAreaStart); + m_maxZeroAreaStart = o.m_maxZeroAreaStart; + ); + m_zeroAreaStart = o.m_zeroAreaStart; + m_zeroAreaEnd = o.m_zeroAreaEnd; + m_start = o.m_start; + m_end = o.m_end; + NS_ASSERT (CheckInternalState ()); + return *this; +} + +Buffer::~Buffer () +{ + HEURISTICS (g_recommendedStart = std::max (g_recommendedStart, m_maxZeroAreaStart)); + m_data->m_count--; + if (m_data->m_count == 0) + { + Recycle (m_data); + } +} + +uint32_t +Buffer::GetSize (void) const +{ + NS_ASSERT (CheckInternalState ()); + return m_end - m_start; +} + +Buffer::Iterator +Buffer::Begin (void) const +{ + NS_ASSERT (CheckInternalState ()); + return Buffer::Iterator (this); +} +Buffer::Iterator +Buffer::End (void) const +{ + NS_ASSERT (CheckInternalState ()); + return Buffer::Iterator (this, false); +} + +uint32_t +Buffer::GetInternalSize (void) const +{ + return m_zeroAreaStart - m_start + m_end - m_zeroAreaEnd; +} +uint32_t +Buffer::GetInternalEnd (void) const +{ + return m_end - (m_zeroAreaEnd - m_zeroAreaStart); +} void Buffer::AddAtStart (uint32_t start) { - NS_ASSERT (m_start <= m_data->m_initialStart); + NS_ASSERT (CheckInternalState ()); bool isDirty = m_data->m_count > 1 && m_start > m_data->m_dirtyStart; - if (m_start >= start && !isDirty) + if (m_start >= start && !isDirty) { - /* enough space in the buffer and not dirty. */ + /* enough space in the buffer and not dirty. + * To add: |..| + * Before: |*****---------***| + * After: |***..---------***| + */ + NS_ASSERT (m_data->m_count == 1 || m_start == m_data->m_dirtyStart); m_start -= start; - m_size += start; + HEURISTICS (g_nAddNoRealloc++); } - else if (m_size + start <= m_data->m_size && !isDirty) +#if 0 + // the following is an optimization + else if (m_start >= start) { - /* enough space but need to move data around to fit new data */ - memmove (m_data->m_data + start, GetStart (), m_size); - NS_ASSERT (start > m_start); - m_data->m_initialStart += start - m_start; - m_start = 0; - m_size += start; - } - else if (m_start < start) - { - /* not enough space in buffer */ - uint32_t newSize = m_size + start; - struct Buffer::BufferData *newData = Buffer::Allocate (newSize, 0); - memcpy (newData->m_data + start, GetStart (), m_size); - newData->m_initialStart = m_data->m_initialStart + start; + struct BufferData *newData = Buffer::Create (m_data->m_size); + memcpy (newData->m_data + m_start, m_data->m_data + m_start, GetInternalSize ()); m_data->m_count--; - if (m_data->m_count == 0) + if (m_data->m_count == 0) { - Buffer::Deallocate (m_data); + Buffer::Recycle (m_data); } m_data = newData; - m_start = 0; - m_size = newSize; - } - else + + m_start -= start; + HEURISTICS (g_nAddRealloc++); + } + else { - /* enough space in the buffer but it is dirty ! */ - NS_ASSERT (isDirty); - struct Buffer::BufferData *newData = Buffer::Create (); - memcpy (newData->m_data + m_start, GetStart (), m_size); - newData->m_initialStart = m_data->m_initialStart; + NS_ASSERT (m_start < start); +#else + else + { +#endif + uint32_t newSize = GetInternalSize () + start; + struct BufferData *newData = Buffer::Create (newSize); + memcpy (newData->m_data + start, m_data->m_data + m_start, GetInternalSize ()); m_data->m_count--; - if (m_data->m_count == 0) + if (m_data->m_count == 0) { - Recycle (m_data); + Buffer::Recycle (m_data); } m_data = newData; - m_start -= start; - m_size += start; - } + + int32_t delta = start - m_start; + m_start = 0; + m_zeroAreaStart += delta; + m_zeroAreaEnd += delta; + m_end += delta; + + HEURISTICS (g_nAddRealloc++); + } + HEURISTICS (m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart)); // update dirty area m_data->m_dirtyStart = m_start; - m_data->m_dirtySize = m_size; - // update m_maxTotalAddStart - uint32_t addedAtStart; - if (m_data->m_initialStart > m_start) - { - addedAtStart = m_data->m_initialStart - m_start; - } - else - { - addedAtStart = 0; - } - if (addedAtStart > m_maxTotalAddStart) - { - m_maxTotalAddStart = addedAtStart; - } - TRACE ("start add="<m_initialStart); - bool isDirty = m_data->m_count > 1 && - m_start + m_size < m_data->m_dirtyStart + m_data->m_dirtySize; - if (m_start + m_size + end <= m_data->m_size && !isDirty) + NS_ASSERT (CheckInternalState ()); + bool isDirty = m_data->m_count > 1 && m_end < m_data->m_dirtyEnd; + if (GetInternalEnd () + end <= m_data->m_size && !isDirty) { - /* enough space in buffer and not dirty */ - m_size += end; + /* enough space in buffer and not dirty + * Add: |...| + * Before: |**----*****| + * After: |**----...**| + */ + NS_ASSERT (m_data->m_count == 1 || m_end == m_data->m_dirtyEnd); + m_end += end; + + HEURISTICS (g_nAddNoRealloc++); } - else if (m_size + end <= m_data->m_size && !isDirty) +#if 0 + // this is an optimization + else if (GetInternalEnd () + end > m_data->m_size) { - /* enough space but need to move data around to fit the extra data */ - uint32_t newStart = m_data->m_size - (m_size + end); - memmove (m_data->m_data + newStart, GetStart (), m_size); - NS_ASSERT (newStart < m_start); - m_data->m_initialStart -= m_start - newStart; - m_start = newStart; - m_size += end; - } - else if (m_start + m_size + end > m_data->m_size) - { - /* not enough space in buffer */ - uint32_t newSize = m_size + end; - struct Buffer::BufferData *newData = Buffer::Allocate (newSize, 0); - memcpy (newData->m_data, GetStart (), m_size); - newData->m_initialStart = m_data->m_initialStart - m_start; + struct BufferData *newData = Buffer::Create (newSize); + memcpy (newData->m_data + m_start, m_data->m_data + m_start, GetInternalSize ()); m_data->m_count--; if (m_data->m_count == 0) { - Buffer::Deallocate (m_data); + Buffer::Recycle (m_data); } m_data = newData; - m_size = newSize; + + m_end += end; + HEURISTICS (g_nAddRealloc++); + } +#endif + else + { + uint32_t newSize = GetInternalSize () + end; + struct BufferData *newData = Buffer::Create (newSize); + memcpy (newData->m_data, m_data->m_data + m_start, GetInternalSize ()); + m_data->m_count--; + if (m_data->m_count == 0) + { + Buffer::Recycle (m_data); + } + m_data = newData; + + + m_zeroAreaStart -= m_start; + m_zeroAreaEnd -= m_start; + m_end -= m_start; m_start = 0; + + m_end += end; + + HEURISTICS (g_nAddRealloc++); } - else - { - /* enough space in the buffer but it is dirty ! */ - NS_ASSERT (isDirty); - struct Buffer::BufferData *newData = Buffer::Create (); - memcpy (newData->m_data + m_start, GetStart (), m_size); - newData->m_initialStart = m_data->m_initialStart; - m_data->m_count--; - if (m_data->m_count == 0) - { - Recycle (m_data); - } - m_data = newData; - m_size += end; - } + HEURISTICS (m_maxZeroAreaStart = std::max (m_maxZeroAreaStart, m_zeroAreaStart)); // update dirty area m_data->m_dirtyStart = m_start; - m_data->m_dirtySize = m_size; - // update m_maxTotalAddEnd - uint32_t endLoc = m_start + m_size; - uint32_t addedAtEnd; - if (m_data->m_initialStart < endLoc) - { - addedAtEnd = endLoc - m_data->m_initialStart; - } - else - { - addedAtEnd = 0; - } - if (addedAtEnd > m_maxTotalAddEnd) - { - m_maxTotalAddEnd = addedAtEnd; - } - TRACE ("end add="<= start); + uint32_t zeroSize = m_zeroAreaEnd - m_zeroAreaStart; + m_start = newStart - zeroSize; + m_end -= zeroSize; + m_zeroAreaStart = m_start; + m_zeroAreaEnd = m_start; + } else { - NS_ASSERT (m_data->m_initialStart >= m_start); - uint32_t zeroStart = m_data->m_initialStart - m_start; - uint32_t zeroEnd = zeroStart + m_zeroAreaSize; - uint32_t dataEnd = m_size + m_zeroAreaSize; - if (start <= zeroStart) - { - /* only remove start of buffer */ - m_start += start; - m_size -= start; - } - else if (start <= zeroEnd) - { - /* remove start of buffer _and_ start of zero area */ - m_start += zeroStart; - uint32_t zeroDelta = start - zeroStart; - m_zeroAreaSize -= zeroDelta; - NS_ASSERT (zeroDelta <= start); - m_size -= zeroStart; - } - else if (start <= dataEnd) - { - /* remove start of buffer, complete zero area, and part - * of end of buffer */ - m_start += start - m_zeroAreaSize; - m_size -= start - m_zeroAreaSize; - m_zeroAreaSize = 0; - } - else - { - /* remove all buffer */ - m_start += m_size; - m_size = 0; - m_zeroAreaSize = 0; - } + /* remove all buffer */ + m_end -= m_zeroAreaEnd - m_zeroAreaStart; + m_start = m_end; + m_zeroAreaEnd = m_end; + m_zeroAreaStart = m_end; } - TRACE ("start remove="< m_zeroAreaEnd) { - if (m_size <= end) - { - m_size = 0; - } - else - { - m_size -= end; - } - } - else - { - NS_ASSERT (m_data->m_initialStart >= m_start); - uint32_t zeroStart = m_data->m_initialStart - m_start; - uint32_t zeroEnd = zeroStart + m_zeroAreaSize; - uint32_t dataEnd = m_size + m_zeroAreaSize; - NS_ASSERT (zeroStart <= m_size); - NS_ASSERT (zeroEnd <= m_size + m_zeroAreaSize); - if (dataEnd <= end) - { - /* remove all buffer */ - m_zeroAreaSize = 0; - m_start += m_size; - m_size = 0; - } - else if (dataEnd - zeroStart <= end) - { - /* remove end of buffer, zero area, part of start of buffer */ - NS_ASSERT (end >= m_zeroAreaSize); - m_size -= end - m_zeroAreaSize; - m_zeroAreaSize = 0; - } - else if (dataEnd - zeroEnd <= end) - { - /* remove end of buffer, part of zero area */ - uint32_t zeroDelta = end - (dataEnd - zeroEnd); - m_zeroAreaSize -= zeroDelta; - m_size -= end - zeroDelta; - } - else - { - /* remove part of end of buffer */ - m_size -= end; - } + /* remove part of end of buffer */ + m_end = newEnd; } - TRACE ("end remove="<m_initialStart - m_start; - uint32_t zeroEnd = zeroStart + m_zeroAreaSize; - if (m_zeroAreaSize != 0 && + NS_ASSERT (CheckInternalState ()); + uint32_t zeroStart = m_zeroAreaStart - m_start; + uint32_t zeroEnd = zeroStart + m_zeroAreaEnd; + if (m_zeroAreaEnd != 0 && start + length > zeroStart && start <= zeroEnd) { @@ -407,51 +555,433 @@ Buffer::CreateFragment (uint32_t start, uint32_t length) const Buffer tmp = *this; tmp.RemoveAtStart (start); tmp.RemoveAtEnd (GetSize () - (start + length)); + NS_ASSERT (CheckInternalState ()); return tmp; } Buffer Buffer::CreateFullCopy (void) const { - if (m_zeroAreaSize != 0) + NS_ASSERT (CheckInternalState ()); + if (m_zeroAreaEnd != 0) { - NS_ASSERT (m_data->m_initialStart >= m_start); - NS_ASSERT (m_size >= (m_data->m_initialStart - m_start)); Buffer tmp; - tmp.AddAtStart (m_zeroAreaSize); - tmp.Begin ().WriteU8 (0, m_zeroAreaSize); - uint32_t dataStart = m_data->m_initialStart - m_start; + tmp.AddAtStart (m_zeroAreaEnd - m_zeroAreaStart); + tmp.Begin ().WriteU8 (0, m_zeroAreaEnd - m_zeroAreaStart); + uint32_t dataStart = m_zeroAreaStart - m_start; tmp.AddAtStart (dataStart); tmp.Begin ().Write (m_data->m_data+m_start, dataStart); - uint32_t dataEnd = m_size - (m_data->m_initialStart - m_start); + uint32_t dataEnd = m_end - m_zeroAreaEnd; tmp.AddAtEnd (dataEnd); Buffer::Iterator i = tmp.End (); i.Prev (dataEnd); - i.Write (m_data->m_data+m_data->m_initialStart,dataEnd); + i.Write (m_data->m_data+m_zeroAreaStart,dataEnd); return tmp; } + NS_ASSERT (CheckInternalState ()); return *this; } void Buffer::TransformIntoRealBuffer (void) const { + NS_ASSERT (CheckInternalState ()); Buffer tmp = CreateFullCopy (); *const_cast (this) = tmp; + NS_ASSERT (CheckInternalState ()); } uint8_t const* Buffer::PeekData (void) const { + NS_ASSERT (CheckInternalState ()); TransformIntoRealBuffer (); + NS_ASSERT (CheckInternalState ()); return m_data->m_data + m_start; } +/****************************************************** + * The buffer iterator below. + ******************************************************/ +Buffer::Iterator::Iterator () + : m_zeroStart (0), + m_zeroEnd (0), + m_dataStart (0), + m_dataEnd (0), + m_current (0), + m_data (0) +{} +Buffer::Iterator::Iterator (Buffer const*buffer) +{ + Construct (buffer); + m_current = m_dataStart; +} +Buffer::Iterator::Iterator (Buffer const*buffer, bool dummy) +{ + Construct (buffer); + m_current = m_dataEnd; +} -}; // namespace ns3 +void +Buffer::Iterator::Construct (const Buffer *buffer) +{ + m_zeroStart = buffer->m_zeroAreaStart; + m_zeroEnd = buffer->m_zeroAreaEnd; + m_dataStart = buffer->m_start; + m_dataEnd = buffer->m_end; + m_data = buffer->m_data->m_data; +} + +void +Buffer::Iterator::Next (void) +{ + NS_ASSERT (m_current + 1 <= m_dataEnd); + m_current++; +} +void +Buffer::Iterator::Prev (void) +{ + NS_ASSERT (m_current >= 1); + m_current--; +} +void +Buffer::Iterator::Next (uint32_t delta) +{ + NS_ASSERT (m_current + delta <= m_dataEnd); + m_current += delta; +} +void +Buffer::Iterator::Prev (uint32_t delta) +{ + NS_ASSERT (m_current >= delta); + m_current -= delta; +} +uint32_t +Buffer::Iterator::GetDistanceFrom (Iterator const &o) const +{ + NS_ASSERT (m_data == o.m_data); + int32_t diff = m_current - o.m_current; + if (diff < 0) + { + return -diff; + } + else + { + return diff; + } +} + +bool +Buffer::Iterator::IsEnd (void) const +{ + return m_current == m_dataEnd; +} +bool +Buffer::Iterator::IsStart (void) const +{ + return m_current == m_dataStart; +} + +bool +Buffer::Iterator::CheckNoZero (uint32_t start, uint32_t end) const +{ + bool ok = true; + for (uint32_t i = start; i < end; i++) + { + if (!Check (i)) + { + ok = false; + } + } + return ok; +} +bool +Buffer::Iterator::Check (uint32_t i) const +{ + return i >= m_dataStart && + !(i >= m_zeroStart && i < m_zeroEnd) && + i <= m_dataEnd; +} + + +void +Buffer::Iterator::Write (Iterator start, Iterator end) +{ + NS_ASSERT (start.m_data == end.m_data); + NS_ASSERT (start.m_current <= end.m_current); + NS_ASSERT (start.m_zeroStart == end.m_zeroStart); + NS_ASSERT (start.m_zeroEnd == end.m_zeroEnd); + NS_ASSERT (m_data != start.m_data); + uint32_t size = end.m_current - start.m_current; + Iterator cur = start; + for (uint32_t i = 0; i < size; i++) + { + uint8_t data = cur.ReadU8 (); + WriteU8 (data); + } +} + +void +Buffer::Iterator::WriteU16 (uint16_t data) +{ + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); +} +void +Buffer::Iterator::WriteU32 (uint32_t data) +{ + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); +} +void +Buffer::Iterator::WriteU64 (uint64_t data) +{ + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); + data >>= 8; + WriteU8 (data & 0xff); +} +void +Buffer::Iterator::WriteHtonU16 (uint16_t data) +{ + WriteU8 ((data >> 8) & 0xff); + WriteU8 ((data >> 0) & 0xff); +} +void +Buffer::Iterator::WriteHtonU32 (uint32_t data) +{ + WriteU8 ((data >> 24) & 0xff); + WriteU8 ((data >> 16) & 0xff); + WriteU8 ((data >> 8) & 0xff); + WriteU8 ((data >> 0) & 0xff); +} +void +Buffer::Iterator::WriteHtonU64 (uint64_t data) +{ + WriteU8 ((data >> 56) & 0xff); + WriteU8 ((data >> 48) & 0xff); + WriteU8 ((data >> 40) & 0xff); + WriteU8 ((data >> 32) & 0xff); + WriteU8 ((data >> 24) & 0xff); + WriteU8 ((data >> 16) & 0xff); + WriteU8 ((data >> 8) & 0xff); + WriteU8 ((data >> 0) & 0xff); +} +void +Buffer::Iterator::Write (uint8_t const*buffer, uint32_t size) +{ + for (uint32_t i = 0; i < size; i++) + { + WriteU8 (buffer[i]); + } +} + +uint16_t +Buffer::Iterator::ReadU16 (void) +{ + uint8_t byte0 = ReadU8 (); + uint8_t byte1 = ReadU8 (); + uint16_t data = byte1; + data <<= 8; + data |= byte0; + + return data; +} +uint32_t +Buffer::Iterator::ReadU32 (void) +{ + uint8_t byte0 = ReadU8 (); + uint8_t byte1 = ReadU8 (); + uint8_t byte2 = ReadU8 (); + uint8_t byte3 = ReadU8 (); + uint32_t data = byte3; + data <<= 8; + data |= byte2; + data <<= 8; + data |= byte1; + data <<= 8; + data |= byte0; + return data; +} +uint64_t +Buffer::Iterator::ReadU64 (void) +{ + uint8_t byte0 = ReadU8 (); + uint8_t byte1 = ReadU8 (); + uint8_t byte2 = ReadU8 (); + uint8_t byte3 = ReadU8 (); + uint8_t byte4 = ReadU8 (); + uint8_t byte5 = ReadU8 (); + uint8_t byte6 = ReadU8 (); + uint8_t byte7 = ReadU8 (); + uint32_t data = byte7; + data <<= 8; + data |= byte6; + data <<= 8; + data |= byte5; + data <<= 8; + data |= byte4; + data <<= 8; + data |= byte3; + data <<= 8; + data |= byte2; + data <<= 8; + data |= byte1; + data <<= 8; + data |= byte0; + + return data; +} +uint16_t +Buffer::Iterator::ReadNtohU16 (void) +{ + uint16_t retval = 0; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + return retval; +} +uint32_t +Buffer::Iterator::ReadNtohU32 (void) +{ + uint32_t retval = 0; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + return retval; +} +uint64_t +Buffer::Iterator::ReadNtohU64 (void) +{ + uint64_t retval = 0; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + retval <<= 8; + retval |= ReadU8 (); + return retval; +} +void +Buffer::Iterator::Read (uint8_t *buffer, uint32_t size) +{ + for (uint32_t i = 0; i < size; i++) + { + buffer[i] = ReadU8 (); + } +} + +#ifndef BUFFER_USE_INLINE + +void +Buffer::Iterator::WriteU8 (uint8_t data) +{ + if (m_current < m_dataStart) + { + // XXX trying to write outside of data area + NS_ASSERT (false); + } + else if (m_current < m_zeroStart) + { + m_data[m_current] = data; + m_current++; + } + else if (m_current < m_zeroEnd) + { + // XXX trying to write in zero area + NS_ASSERT (false); + } + else if (m_current < m_dataEnd) + { + m_data[m_current - (m_zeroEnd-m_zeroStart)] = data; + m_current++; + } + else + { + // XXX trying to write outside of data area + NS_ASSERT (false); + } +} + +void +Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) +{ + for (uint32_t i = 0; i < len; i++) + { + WriteU8 (data); + } +} + +uint8_t +Buffer::Iterator::ReadU8 (void) +{ + if (m_current < m_dataStart) + { + // XXX trying to read from outside of data area + NS_ASSERT (false); + } + else if (m_current < m_zeroStart) + { + uint8_t data = m_data[m_current]; + m_current++; + return data; + } + else if (m_current < m_zeroEnd) + { + m_current++; + return 0; + } + else if (m_current < m_dataEnd) + { + uint8_t data = m_data[m_current - (m_zeroEnd-m_zeroStart)]; + m_current++; + return data; + } + else + { + // XXX trying to read from outside of data area + NS_ASSERT (false); + } + // to quiet compiler. + return 0; +} + +#endif /* BUFFER_USE_INLINE */ + +} // namespace ns3 #ifdef RUN_SELF_TESTS @@ -460,6 +990,7 @@ Buffer::PeekData (void) const #include "ns3/random-variable.h" #include + namespace ns3 { class BufferTest: public Test { @@ -687,6 +1218,13 @@ BufferTest::RunTests (void) i.Prev (100); i.WriteU8 (1, 100); +#if 0 + buffer = Buffer (10); + ENSURE_WRITTEN_BYTES (buffer, 10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + buffer.Begin ().WriteU8 (1); + ENSURE_WRITTEN_BYTES (buffer, 10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); +#endif + // Bug #54 { const uint32_t actualSize = 72602; @@ -718,7 +1256,7 @@ BufferTest::RunTests (void) static BufferTest gBufferTest; -}; // namespace ns3 +} // namespace ns3 #endif /* RUN_SELF_TESTS */ diff --git a/src/common/buffer.h b/src/common/buffer.h index 229a040fd..a6a8f51db 100644 --- a/src/common/buffer.h +++ b/src/common/buffer.h @@ -1,7 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2005,2006 INRIA - * All rights reserved. + * Copyright (c) 2005,2006,2007 INRIA * * 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 @@ -24,6 +23,16 @@ #include #include +#define BUFFER_HEURISTICS 1 +#define BUFFER_USE_INLINE 1 + + +#ifdef BUFFER_USE_INLINE +#define BUFFER_INLINE inline +#else +#define BUFFER_INLINE +#endif + namespace ns3 { /** @@ -36,6 +45,51 @@ namespace ns3 { * by creating new Buffers of the maximum size ever used. * The correct maximum size is learned at runtime during use by * recording the maximum size of each packet. + * + * \internal + * The implementation of the Buffer class uses a COW (Copy On Write) + * technique to ensure that the underlying data buffer which holds + * the data bytes is shared among a lot of Buffer instances despite + * data being added or removed from them. + * + * When multiple Buffer instances hold a reference to the same + * underlying BufferData object, they must be able to detect when + * the operation they want to perform should trigger a copy of the + * BufferData. If the BufferData::m_count field is one, it means that + * there exist only one instance of Buffer which references the + * BufferData instance so, it is safe to modify it. It is also + * safe to modify the content of a BufferData if the modification + * falls outside of the "dirty area" defined by the BufferData. + * In every other case, the BufferData must be copied before + * being modified. + * + * To understand the way the Buffer::Add and Buffer::Remove methods + * work, you first need to understand the "virtual offsets" used to + * keep track of the content of buffers. Each Buffer instance + * contains real data bytes in its BufferData instance but it also + * contains "virtual zero data" which typically is used to represent + * application-level payload. No memory is allocated to store the + * zero bytes of application-level payload unless the user fragments + * a Buffer: this application-level payload is kept track of with + * a pair of integers which describe where in the buffer content + * the "virtual zero area" starts and ends. + * + * ***: unused bytes + * xxx: bytes "added" at the front of the zero area + * ...: bytes "added" at the back of the zero area + * 000: virtual zero bytes + * + * Real byte buffer: |********xxxxxxxxxxxx.........*****| + * |--------^ m_start + * |-------------------^ m_zeroAreaStart + * |-----------------------------^ m_end - (m_zeroAreaEnd - m_zeroAreaStart) + * virtual byte buffer: |xxxxxxxxxxxx0000000000000.........| + * |--------^ m_start + * |--------------------^ m_zeroAreaStart + * |---------------------------------^ m_zeroAreaEnd + * |------------------------------------------^ m_end + * + * A simple state invariant is that m_start <= m_zeroStart <= m_zeroEnd <= m_end */ class Buffer { public: @@ -44,23 +98,23 @@ public: */ class Iterator { public: - inline Iterator (); + Iterator (); /** * go forward by one byte */ - inline void Next (void); + void Next (void); /** * go backward by one byte */ - inline void Prev (void); + void Prev (void); /** * \param delta number of bytes to go forward */ - inline void Next (uint32_t delta); + void Next (uint32_t delta); /** * \param delta number of bytes to go backward */ - inline void Prev (uint32_t delta); + void Prev (uint32_t delta); /** * \param o the second iterator * \return number of bytes included between the two iterators @@ -69,18 +123,18 @@ public: * to the same underlying buffer. Debug builds ensure * this with an assert. */ - inline int32_t GetDistanceFrom (Iterator const &o) const; + uint32_t GetDistanceFrom (Iterator const &o) const; /** * \return true if this iterator points to the end of the byte array. * false otherwise. */ - inline bool IsEnd (void) const; + bool IsEnd (void) const; /** * \return true if this iterator points to the start of the byte array. * false otherwise. */ - inline bool IsStart (void) const; + bool IsStart (void) const; /** * \param data data to write in buffer @@ -88,7 +142,7 @@ public: * Write the data in buffer and avance the iterator position * by one byte. */ - inline void WriteU8 (uint8_t data); + BUFFER_INLINE void WriteU8 (uint8_t data); /** * \param data data to write in buffer * \param len number of times data must be written in buffer @@ -96,7 +150,7 @@ public: * Write the data in buffer len times and avance the iterator position * by len byte. */ - inline void WriteU8 (uint8_t data, uint32_t len); + BUFFER_INLINE void WriteU8 (uint8_t data, uint32_t len); /** * \param data data to write in buffer * @@ -106,7 +160,7 @@ public: * return exactly what we wrote with writeU16 if the program * is run on the same machine. */ - inline void WriteU16 (uint16_t data); + void WriteU16 (uint16_t data); /** * \param data data to write in buffer * @@ -116,7 +170,7 @@ public: * return exactly what we wrote with writeU32 if the program * is run on the same machine. */ - inline void WriteU32 (uint32_t data); + void WriteU32 (uint32_t data); /** * \param data data to write in buffer * @@ -126,7 +180,7 @@ public: * return exactly what we wrote with writeU64 if the program * is run on the same machine. */ - inline void WriteU64 (uint64_t data); + void WriteU64 (uint64_t data); /** * \param data data to write in buffer * @@ -134,7 +188,7 @@ public: * by two bytes. The data is written in network order and the * input data is expected to be in host order. */ - inline void WriteHtonU16 (uint16_t data); + void WriteHtonU16 (uint16_t data); /** * \param data data to write in buffer * @@ -142,7 +196,7 @@ public: * by four bytes. The data is written in network order and the * input data is expected to be in host order. */ - inline void WriteHtonU32 (uint32_t data); + void WriteHtonU32 (uint32_t data); /** * \param data data to write in buffer * @@ -150,7 +204,7 @@ public: * by eight bytes. The data is written in network order and the * input data is expected to be in host order. */ - inline void WriteHtonU64 (uint64_t data); + void WriteHtonU64 (uint64_t data); /** * \param buffer a byte buffer to copy in the internal buffer. * \param size number of bytes to copy. @@ -158,7 +212,7 @@ public: * Write the data in buffer and avance the iterator position * by size bytes. */ - inline void Write (uint8_t const*buffer, uint32_t size); + void Write (uint8_t const*buffer, uint32_t size); /** * \param start the start of the data to copy * \param end the end of the data to copy @@ -170,7 +224,7 @@ public: * we do to avoid overlapping copies. This is enforced * in debug builds by asserts. */ - inline void Write (Iterator start, Iterator end); + void Write (Iterator start, Iterator end); /** * \return the byte read in the buffer. @@ -178,7 +232,7 @@ public: * Read data and advance the Iterator by the number of bytes * read. */ - inline uint8_t ReadU8 (void); + BUFFER_INLINE uint8_t ReadU8 (void); /** * \return the two bytes read in the buffer. * @@ -186,7 +240,7 @@ public: * read. * The data is read in the format written by writeU16. */ - inline uint16_t ReadU16 (void); + uint16_t ReadU16 (void); /** * \return the four bytes read in the buffer. * @@ -194,7 +248,7 @@ public: * read. * The data is read in the format written by writeU32. */ - inline uint32_t ReadU32 (void); + uint32_t ReadU32 (void); /** * \return the eight bytes read in the buffer. * @@ -202,7 +256,7 @@ public: * read. * The data is read in the format written by writeU64. */ - inline uint64_t ReadU64 (void); + uint64_t ReadU64 (void); /** * \return the two bytes read in the buffer. * @@ -210,7 +264,7 @@ public: * read. * The data is read in network format and return in host format. */ - inline uint16_t ReadNtohU16 (void); + uint16_t ReadNtohU16 (void); /** * \return the four bytes read in the buffer. * @@ -218,7 +272,7 @@ public: * read. * The data is read in network format and return in host format. */ - inline uint32_t ReadNtohU32 (void); + uint32_t ReadNtohU32 (void); /** * \return the eight bytes read in the buffer. * @@ -226,7 +280,7 @@ public: * read. * The data is read in network format and return in host format. */ - inline uint64_t ReadNtohU64 (void); + uint64_t ReadNtohU64 (void); /** * \param buffer buffer to copy data into * \param size number of bytes to copy @@ -235,22 +289,45 @@ public: * input buffer and avance the Iterator by the number of * bytes read. */ - inline void Read (uint8_t *buffer, uint16_t size); + void Read (uint8_t *buffer, uint32_t size); private: friend class Buffer; - inline Iterator (Buffer const*buffer, uint32_t m_current); - inline uint32_t GetIndex (uint32_t n); + Iterator (Buffer const*buffer); + Iterator (Buffer const*buffer, bool); + void Construct (const Buffer *buffer); + bool CheckNoZero (uint32_t start, uint32_t end) const; + bool Check (uint32_t i) const; + + /* offset in virtual bytes from the start of the data buffer to the + * start of the "virtual zero area". + */ uint32_t m_zeroStart; + /* offset in virtual bytes from the start of the data buffer to the + * end of the "virtual zero area". + */ uint32_t m_zeroEnd; + /* offset in virtual bytes from the start of the data buffer to the + * start of the data which can be read by this iterator + */ + uint32_t m_dataStart; + /* offset in virtual bytes from the start of the data buffer to the + * end of the data which can be read by this iterator + */ uint32_t m_dataEnd; + /* offset in virtual bytes from the start of the data buffer to the + * current position represented by this iterator. + */ uint32_t m_current; + /* a pointer to the underlying byte buffer. All offsets are relative + * to this pointer. + */ uint8_t *m_data; }; /** * \return the number of bytes stored in this buffer. */ - inline uint32_t GetSize (void) const; + uint32_t GetSize (void) const; /** * \return a pointer to the start of the internal @@ -313,401 +390,135 @@ public: * \return an Iterator which points to the * start of this Buffer. */ - inline Buffer::Iterator Begin (void) const; + Buffer::Iterator Begin (void) const; /** * \return an Iterator which points to the * end of this Buffer. */ - inline Buffer::Iterator End (void) const; + Buffer::Iterator End (void) const; Buffer CreateFullCopy (void) const; - inline Buffer (Buffer const &o); - inline Buffer &operator = (Buffer const &o); - inline Buffer (); - inline Buffer (uint32_t dataSize); - inline ~Buffer (); + Buffer (Buffer const &o); + Buffer &operator = (Buffer const &o); + Buffer (); + Buffer (uint32_t dataSize); + ~Buffer (); private: - struct BufferData { - uint32_t m_count; - uint32_t m_size; - uint32_t m_initialStart; - uint32_t m_dirtyStart; - uint32_t m_dirtySize; - uint8_t m_data[1]; - }; - class BufferDataList : public std::vector - { - public: - ~BufferDataList (); - }; - inline uint8_t *GetStart (void) const; void TransformIntoRealBuffer (void) const; - static void Recycle (struct Buffer::BufferData *data); - static struct Buffer::BufferData *Create (void); - static struct Buffer::BufferData *Allocate (uint32_t size, uint32_t start); - static void Deallocate (struct Buffer::BufferData *data); - - static BufferDataList m_freeList; - static uint32_t m_maxTotalAddStart; - static uint32_t m_maxTotalAddEnd; + bool CheckInternalState (void) const; + void Initialize (uint32_t zeroSize); + uint32_t GetInternalSize (void) const; + uint32_t GetInternalEnd (void) const; + static void Recycle (struct BufferData *data); + static struct BufferData *Create (uint32_t size); + /* This structure is described in the buffer.cc file. + */ struct BufferData *m_data; - uint32_t m_zeroAreaSize; +#ifdef BUFFER_HEURISTICS + /* keep track of the maximum value of m_zeroAreaStart across + * the lifetime of a Buffer instance. This variable is used + * purely as a source of information for the heuristics which + * decide on the position of the zero area in new buffers. + * It is read from the Buffer destructor to update the global + * heuristic data and these global heuristic data are used from + * the Buffer constructor to choose an initial value for + * m_zeroAreaStart. + * It is possible to disable all these heuristics by undefining the + * BUFFER_HEURISTICS macro at the top of buffer.h + */ + uint32_t m_maxZeroAreaStart; +#endif /* BUFFER_HEURISTICS */ + /* offset to the start of the virtual zero area from the start + * of m_data->m_data + */ + uint32_t m_zeroAreaStart; + /* offset to the end of the virtual zero area from the start + * of m_data->m_data + */ + uint32_t m_zeroAreaEnd; + /* offset to the start of the data referenced by this Buffer + * instance from the start of m_data->m_data + */ uint32_t m_start; - uint32_t m_size; + /* offset to the end of the data referenced by this Buffer + * instance from the start of m_data->m_data + */ + uint32_t m_end; }; -}; // namespace ns3 +} // namespace ns3 - -/************************************************** - Start of implementation of methods which - need to be inline for performance reasons. - *************************************************/ +#ifdef BUFFER_USE_INLINE #include "ns3/assert.h" namespace ns3 { -Buffer::Buffer () - : m_data (Buffer::Create ()), - m_zeroAreaSize (0), - m_start (m_maxTotalAddStart), - m_size (0) +void +Buffer::Iterator::WriteU8 (uint8_t data) { - if (m_start > m_data->m_size) + NS_ASSERT (Check (m_current)); + + if (m_current < m_zeroStart) { - m_start = 0; + m_data[m_current] = data; + m_current++; } - NS_ASSERT (m_start <= m_data->m_size); -} - -Buffer::Buffer (uint32_t dataSize) - : m_data (Buffer::Create ()), - m_zeroAreaSize (dataSize), - m_start (m_maxTotalAddStart), - m_size (0) -{ - if (m_start > m_data->m_size) + else { - m_start = 0; + m_data[m_current - (m_zeroEnd-m_zeroStart)] = data; + m_current++; } - NS_ASSERT (m_start <= m_data->m_size); -} - - -Buffer::Buffer (Buffer const&o) - : m_data (o.m_data), - m_zeroAreaSize (o.m_zeroAreaSize), - m_start (o.m_start), - m_size (o.m_size) -{ - m_data->m_count++; - NS_ASSERT (m_start <= m_data->m_size); -} - -Buffer & -Buffer::operator = (Buffer const&o) -{ - if (m_data != o.m_data) - { - // not assignment to self. - m_data->m_count--; - if (m_data->m_count == 0) - { - Recycle (m_data); - } - m_data = o.m_data; - m_data->m_count++; - } - m_zeroAreaSize = o.m_zeroAreaSize; - m_start = o.m_start; - m_size = o.m_size; - NS_ASSERT (m_start <= m_data->m_size); - return *this; -} - -Buffer::~Buffer () -{ - m_data->m_count--; - if (m_data->m_count == 0) - { - Recycle (m_data); - } -} - - -uint8_t * -Buffer::GetStart (void) const -{ - return m_data->m_data + m_start; -} - -uint32_t -Buffer::GetSize (void) const -{ - return m_size + m_zeroAreaSize; -} - -Buffer::Iterator -Buffer::Begin (void) const -{ - return Buffer::Iterator (this, 0); -} -Buffer::Iterator -Buffer::End (void) const -{ - return Buffer::Iterator (this, GetSize ()); -} - - -Buffer::Iterator::Iterator () - : m_zeroStart (0), - m_zeroEnd (0), - m_dataEnd (0), - m_current (0), - m_data (0) -{} -Buffer::Iterator::Iterator (Buffer const*buffer, uint32_t current) - : m_zeroStart (buffer->m_data->m_initialStart-buffer->m_start), - m_zeroEnd (m_zeroStart+buffer->m_zeroAreaSize), - m_dataEnd (buffer->GetSize ()), - m_current (current), - m_data (buffer->m_data->m_data+buffer->m_start) -{} - -void -Buffer::Iterator::Next (void) -{ - NS_ASSERT (m_current + 1 <= m_dataEnd); - m_current++; -} -void -Buffer::Iterator::Prev (void) -{ - NS_ASSERT (m_current >= 1); - m_current--; -} -void -Buffer::Iterator::Next (uint32_t delta) -{ - NS_ASSERT (m_current + delta <= m_dataEnd); - m_current += delta; -} -void -Buffer::Iterator::Prev (uint32_t delta) -{ - NS_ASSERT (m_current >= delta); - m_current -= delta; -} -int32_t -Buffer::Iterator::GetDistanceFrom (Iterator const &o) const -{ - NS_ASSERT (m_data == o.m_data); - int32_t start = m_current; - int32_t end = o.m_current; - return end - start; -} - -bool -Buffer::Iterator::IsEnd (void) const -{ - return m_current == m_dataEnd; -} -bool -Buffer::Iterator::IsStart (void) const -{ - return m_current == 0; -} - -uint32_t -Buffer::Iterator::GetIndex (uint32_t n) -{ - NS_ASSERT ( - (m_current + n <= m_dataEnd) && - ((m_current + n <= m_zeroStart) || - (m_current >= m_zeroEnd) || - m_zeroStart == m_zeroEnd) - ); - uint32_t index; - if (m_current < m_zeroStart) - { - index = m_current; - } - else - { - index = m_current - (m_zeroEnd-m_zeroStart); - } - return index; -} - - -void -Buffer::Iterator::Write (Iterator start, Iterator end) -{ - NS_ASSERT (start.m_data == end.m_data); - NS_ASSERT (start.m_current <= end.m_current); - NS_ASSERT (start.m_zeroStart == end.m_zeroStart); - NS_ASSERT (start.m_zeroEnd == end.m_zeroEnd); - NS_ASSERT (m_data != start.m_data); - uint32_t size = end.m_current - start.m_current; - uint8_t *src = start.m_data + start.GetIndex (size); - uint8_t *dest = m_data + GetIndex (size); - memcpy (dest, src, size); - m_current += size; } void Buffer::Iterator::WriteU8 (uint8_t data, uint32_t len) { - uint8_t *current = m_data + GetIndex (len); - memset (current, data, len); - m_current += len; -} -void -Buffer::Iterator::WriteU8 (uint8_t data) -{ - m_data[GetIndex (1)] = data; - m_current++; -} -void -Buffer::Iterator::WriteU16 (uint16_t data) -{ - uint16_t *buffer = (uint16_t *)(m_data + GetIndex (2)); - *buffer = data; - m_current += 2; -} -void -Buffer::Iterator::WriteU32 (uint32_t data) -{ - uint32_t *buffer = (uint32_t *)(m_data + GetIndex (4)); - *buffer = data; - m_current += 4; -} -void -Buffer::Iterator::WriteU64 (uint64_t data) -{ - uint64_t *buffer = (uint64_t *)(m_data + GetIndex (8)); - *buffer = data; - m_current += 8; -} -void -Buffer::Iterator::WriteHtonU16 (uint16_t data) -{ - uint8_t *current = m_data + GetIndex (2); - *(current+0) = (data >> 8) & 0xff; - *(current+1) = (data >> 0) & 0xff; - m_current += 2; -} -void -Buffer::Iterator::WriteHtonU32 (uint32_t data) -{ - uint8_t *current = m_data + GetIndex (4); - *(current+0) = (data >> 24) & 0xff; - *(current+1) = (data >> 16) & 0xff; - *(current+2) = (data >> 8) & 0xff; - *(current+3) = (data >> 0) & 0xff; - m_current += 4; -} -void -Buffer::Iterator::WriteHtonU64 (uint64_t data) -{ - uint8_t *current = m_data + GetIndex (8); - *(current+0) = (data >> 56) & 0xff; - *(current+1) = (data >> 48) & 0xff; - *(current+2) = (data >> 40) & 0xff; - *(current+3) = (data >> 32) & 0xff; - *(current+4) = (data >> 24) & 0xff; - *(current+5) = (data >> 16) & 0xff; - *(current+6) = (data >> 8) & 0xff; - *(current+7) = (data >> 0) & 0xff; - m_current += 8; -} -void -Buffer::Iterator::Write (uint8_t const*buffer, uint32_t size) -{ - uint8_t *current = m_data + GetIndex (size); - memcpy (current, buffer, size); - m_current += size; + NS_ASSERT (CheckNoZero (m_current, m_current + len)); + if (m_current <= m_zeroStart) + { + memset (&(m_data[m_current]), data, len); + m_current += len; + } + else + { + uint8_t *buffer = &m_data[m_current - (m_zeroEnd-m_zeroStart)]; + memset (buffer, data, len); + m_current += len; + } } uint8_t Buffer::Iterator::ReadU8 (void) { - uint8_t data = m_data[GetIndex(1)]; - m_current++; - return data; -} -uint16_t -Buffer::Iterator::ReadU16 (void) -{ - uint16_t *buffer = reinterpret_cast(m_data + GetIndex (2)); - m_current += 2; - return *buffer; -} -uint32_t -Buffer::Iterator::ReadU32 (void) -{ - uint32_t *buffer = reinterpret_cast(m_data + GetIndex (4)); - m_current += 4; - return *buffer; -} -uint64_t -Buffer::Iterator::ReadU64 (void) -{ - uint64_t *buffer = reinterpret_cast(m_data + GetIndex (8)); - m_current += 8; - return *buffer; -} -uint16_t -Buffer::Iterator::ReadNtohU16 (void) -{ - uint8_t *current = m_data + GetIndex (2); - uint16_t retval = 0; - retval |= static_cast (current[0]) << 8; - retval |= static_cast (current[1]) << 0; - m_current += 2; - return retval; -} -uint32_t -Buffer::Iterator::ReadNtohU32 (void) -{ - uint8_t *current = m_data + GetIndex (4); - uint32_t retval = 0; - retval |= static_cast (current[0]) << 24; - retval |= static_cast (current[1]) << 16; - retval |= static_cast (current[2]) << 8; - retval |= static_cast (current[3]) << 0; - m_current += 4; - return retval; -} -uint64_t -Buffer::Iterator::ReadNtohU64 (void) -{ - uint8_t *current = m_data + GetIndex (8); - uint64_t retval = 0; - retval |= static_cast (current[0]) << 56; - retval |= static_cast (current[1]) << 48; - retval |= static_cast (current[2]) << 40; - retval |= static_cast (current[3]) << 32; - retval |= static_cast (current[4]) << 24; - retval |= static_cast (current[5]) << 16; - retval |= static_cast (current[6]) << 8; - retval |= static_cast (current[7]) << 0; - m_current += 8; - return retval; -} -void -Buffer::Iterator::Read (uint8_t *buffer, uint16_t size) -{ - uint8_t *current = m_data + GetIndex (size); - memcpy (buffer, current, size); - m_current += size; + NS_ASSERT (m_current >= m_dataStart && + m_current <= m_dataEnd); + + if (m_current < m_zeroStart) + { + uint8_t data = m_data[m_current]; + m_current++; + return data; + } + else if (m_current < m_zeroEnd) + { + m_current++; + return 0; + } + else + { + uint8_t data = m_data[m_current - (m_zeroEnd-m_zeroStart)]; + m_current++; + return data; + } } -}; // namespace ns3 +} // namespace ns3 + +#endif /* BUFFER_USE_INLINE */ #endif /* BUFFER_H */ diff --git a/src/common/callback-trace-source.h b/src/common/callback-trace-source.h deleted file mode 100644 index a1e13df9d..000000000 --- a/src/common/callback-trace-source.h +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2005,2006,2007 INRIA - * All rights reserved. - * - * 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: Mathieu Lacage - */ - -#ifndef CALLBACK_TRACE_H -#define CALLBACK_TRACE_H - -#include -#include "ns3/callback.h" -#include "ns3/fatal-error.h" -#include "trace-context.h" - -namespace ns3 { - - -/** - * \brief log arbitrary number of parameters to a matching ns3::Callback - * \ingroup lowleveltracing - * - * Whenever operator () is invoked on this class, the call and its arguments - * are forwarded to the internal matching ns3::Callback. - */ -template -class CallbackTraceSource { -public: - CallbackTraceSource (); - void AddCallback (CallbackBase const & callback, TraceContext const & context); - void RemoveCallback (CallbackBase const & callback); - void operator() (void); - void operator() (T1 a1); - void operator() (T1 a1, T2 a2); - void operator() (T1 a1, T2 a2, T3 a3); - void operator() (T1 a1, T2 a2, T3 a3, T4 a4); - -private: - typedef std::list > CallbackList; - TraceContext m_context; - CallbackList m_callbackList; -}; - -}; // namespace ns3 - -// implementation below. - -namespace ns3 { - -template -CallbackTraceSource::CallbackTraceSource () - : m_callbackList () -{} -template -void -CallbackTraceSource::AddCallback (CallbackBase const & callback, - TraceContext const &context) -{ - Callback cb; - cb.Assign (callback); - m_context.Add (context); - m_callbackList.push_back (cb); -} -template -void -CallbackTraceSource::RemoveCallback (CallbackBase const & callback) -{ - for (typename CallbackList::iterator i = m_callbackList.begin (); - i != m_callbackList.end (); /* empty */) - { - if ((*i).IsEqual (callback)) - { - i = m_callbackList.erase (i); - } - else - { - i++; - } - } -} -template -void -CallbackTraceSource::operator() (void) -{ - for (typename CallbackList::iterator i = m_callbackList.begin (); - i != m_callbackList.end (); i++) - { - (*i) (m_context); - } -} -template -void -CallbackTraceSource::operator() (T1 a1) -{ - for (typename CallbackList::iterator i = m_callbackList.begin (); - i != m_callbackList.end (); i++) - { - (*i) (m_context, a1); - } -} -template -void -CallbackTraceSource::operator() (T1 a1, T2 a2) -{ - for (typename CallbackList::iterator i = m_callbackList.begin (); - i != m_callbackList.end (); i++) - { - (*i) (m_context, a1, a2); - } -} -template -void -CallbackTraceSource::operator() (T1 a1, T2 a2, T3 a3) -{ - for (typename CallbackList::iterator i = m_callbackList.begin (); - i != m_callbackList.end (); i++) - { - (*i) (m_context, a1, a2, a3); - } -} -template -void -CallbackTraceSource::operator() (T1 a1, T2 a2, T3 a3, T4 a4) -{ - for (typename CallbackList::iterator i = m_callbackList.begin (); - i != m_callbackList.end (); i++) - { - (*i) (m_context, a1, a2, a3, a4); - } -} - -}//namespace ns3 - -#endif /* CALLBACK_TRACE_H */ diff --git a/src/common/composite-trace-resolver.cc b/src/common/composite-trace-resolver.cc deleted file mode 100644 index bf60aa81e..000000000 --- a/src/common/composite-trace-resolver.cc +++ /dev/null @@ -1,375 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * All rights reserved. - * - * 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: Mathieu Lacage - */ -#include "composite-trace-resolver.h" - -namespace ns3 { - -CompositeTraceResolver::CompositeTraceResolver (TraceContext const &context) - : TraceResolver (context) -{} - -CompositeTraceResolver::~CompositeTraceResolver () -{} - -void -CompositeTraceResolver::Add (std::string name, - Callback createResolver) -{ - TraceContext traceContext = GetContext (); - DoAdd (name, createResolver, traceContext); -} - -void -CompositeTraceResolver::DoAdd (std::string name, - Callback createResolver, - TraceContext const &context) -{ - struct CallbackTraceSourceItem item; - item.name = name; - item.createResolver = createResolver; - item.context = context; - m_items.push_back (item); -} - -TraceResolver::TraceResolverList -CompositeTraceResolver::DoLookup (std::string id) const -{ - if (id == "*") - { - TraceResolver::TraceResolverList list; - for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) - { - list.push_back (i->createResolver (i->context)); - } - return list; - } - std::string::size_type start, end; - start = id.find_first_of ("(", 0); - end = id.find_first_of (")", 0); - if (start != 0 || end != (id.size ()-1)) - { - for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) - { - if (i->name == id) - { - TraceResolver::TraceResolverList list; - list.push_back (i->createResolver (i->context)); - return list; - } - } - } - std::list names; - std::string alternatives = std::string (id, start+1, end-1); - std::string::size_type next, cur; - next = 0; - cur = 0; - while (true) - { - std::string element; - next = alternatives.find ("|", cur); - if (next == std::string::npos) - { - element = std::string (alternatives, cur, alternatives.size ()); - names.push_back (element); - break; - } - element = std::string (alternatives, cur, next); - names.push_back (element); - cur = next + 1; - } - TraceResolver::TraceResolverList list; - for (std::list::const_iterator i = names.begin (); i != names.end (); i++) - { - for (TraceItems::const_iterator j = m_items.begin (); j != m_items.end (); j++) - { - if (j->name == *i) - { - list.push_back (j->createResolver (j->context)); - break; - } - } - } - return list; -} - -}//namespace ns3 - -#ifdef RUN_SELF_TESTS - -#include "ns3/test.h" -#include "trace-context-element.h" - -namespace ns3 { - -class TraceSourceTest : public TraceContextElement -{ -public: - enum Sources { - DOUBLEA, - DOUBLEB, - SUBRESOLVER, - }; - static uint16_t GetUid (void) - {static uint16_t uid = AllocateUid ("TraceSourceTest"); return uid;} - void Print (std::ostream &os) - {os << "tracesource="; - if (m_sources == DOUBLEA) {os << "doubleA";} - else if (m_sources == DOUBLEB) {os << "doubleB";} - else if (m_sources == SUBRESOLVER) {os << "subresolver";} - } - TraceSourceTest () : m_sources (TraceSourceTest::DOUBLEA) {} - TraceSourceTest (enum Sources sources) :m_sources (sources) {} - bool IsDoubleA (void) {return m_sources == TraceSourceTest::DOUBLEA;} - bool IsDoubleB (void) {return m_sources == TraceSourceTest::DOUBLEB;} -private: - enum TraceSourceTest::Sources m_sources; -}; - -class SubTraceSourceTest : public TraceContextElement -{ -public: - enum Sources { - INT, - }; - static uint16_t GetUid (void) - {static uint16_t uid = AllocateUid ("SubTraceSourceTest"); return uid;} - void Print (std::ostream &os) - {os << "subtracesource=int";} - SubTraceSourceTest () : m_sources (SubTraceSourceTest::INT) {} - SubTraceSourceTest (enum Sources sources) : m_sources (sources) {} -private: - enum Sources m_sources; -}; - -class CompositeTraceResolverTest : public Test -{ -public: - CompositeTraceResolverTest (); - virtual ~CompositeTraceResolverTest (); - virtual bool RunTests (void); -private: - void TraceDouble (TraceContext const &context, double v); - void TraceInt (TraceContext const &context, int v); - TraceResolver *CreateSubResolver (TraceContext const &context); - - - bool m_gotDoubleA; - bool m_gotDoubleB; - CallbackTraceSource m_traceInt; - bool m_gotInt; -}; - -CompositeTraceResolverTest::CompositeTraceResolverTest () - : Test ("CompositeTraceResolver") -{} -CompositeTraceResolverTest::~CompositeTraceResolverTest () -{} -void -CompositeTraceResolverTest::TraceDouble (TraceContext const &context, double v) -{ - TraceSourceTest source; - context.Get (source); - if (source.IsDoubleA ()) - { - m_gotDoubleA = true; - } - else if (source.IsDoubleB ()) - { - m_gotDoubleB = true; - } - else - { - NS_FATAL_ERROR ("should not get any other trace source in this sink"); - } - -} - -void -CompositeTraceResolverTest::TraceInt (TraceContext const &context, int v) -{ - m_gotInt = true; -} - -TraceResolver * -CompositeTraceResolverTest::CreateSubResolver (TraceContext const &context) -{ - CompositeTraceResolver *subresolver = new CompositeTraceResolver (context); - subresolver->Add ("trace-int", m_traceInt, - SubTraceSourceTest (SubTraceSourceTest::INT)); - return subresolver; -} -bool -CompositeTraceResolverTest::RunTests (void) -{ - bool ok = true; - - CallbackTraceSource traceDoubleA; - CallbackTraceSource traceDoubleB; - TraceContext context; - - CompositeTraceResolver resolver (context) ; - - resolver.Add ("trace-double-a", traceDoubleA, - TraceSourceTest (TraceSourceTest::DOUBLEA)); - resolver.Add ("trace-double-b", traceDoubleB, - TraceSourceTest (TraceSourceTest::DOUBLEB)); - - resolver.Connect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); - - m_gotDoubleA = false; - m_gotDoubleB = false; - traceDoubleA (0); - if (!m_gotDoubleA || m_gotDoubleB) - { - ok = false; - } - m_gotDoubleA = false; - traceDoubleA (0); - traceDoubleB (0); - if (!m_gotDoubleA || !m_gotDoubleB) - { - ok = false; - } - m_gotDoubleA = false; - m_gotDoubleB = false; - - resolver.Disconnect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); - - m_gotDoubleA = false; - m_gotDoubleB = false; - traceDoubleA (0); - traceDoubleB (0); - if (m_gotDoubleA || m_gotDoubleB) - { - ok = false; - } - - resolver.Connect ("/trace-double-a", - MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); - m_gotDoubleA = false; - m_gotDoubleB = false; - traceDoubleA (0); - traceDoubleB (0); - if (!m_gotDoubleA || m_gotDoubleB) - { - ok = false; - } - resolver.Disconnect ("/trace-double-a", - MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); - - resolver.Connect ("/(trace-double-a)", - MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); - m_gotDoubleA = false; - m_gotDoubleB = false; - traceDoubleA (0); - traceDoubleB (0); - if (!m_gotDoubleA || m_gotDoubleB) - { - ok = false; - } - resolver.Disconnect ("/trace-double-a", - MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); - - resolver.Connect ("/(trace-double-a|trace-double-b)", - MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); - m_gotDoubleA = false; - m_gotDoubleB = false; - traceDoubleA (0); - traceDoubleB (0); - if (!m_gotDoubleA || !m_gotDoubleB) - { - ok = false; - } - resolver.Disconnect ("/trace-double-a", - MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); - m_gotDoubleA = false; - m_gotDoubleB = false; - traceDoubleA (0); - traceDoubleB (0); - if (m_gotDoubleA || !m_gotDoubleB) - { - ok = false; - } - - - resolver.Disconnect ("/(trace-double-a|trace-double-b)", - MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); - m_gotDoubleA = false; - m_gotDoubleB = false; - traceDoubleA (0); - traceDoubleB (0); - if (m_gotDoubleA || m_gotDoubleB) - { - ok = false; - } - - resolver.Add ("subresolver", - MakeCallback (&CompositeTraceResolverTest::CreateSubResolver, this), - TraceSourceTest (TraceSourceTest::SUBRESOLVER)); - - resolver.Connect ("/subresolver/trace-int", - MakeCallback (&CompositeTraceResolverTest::TraceInt, this)); - m_gotInt = false; - m_traceInt (1); - if (!m_gotInt) - { - ok = false; - } - - resolver.Disconnect ("/subresolver/trace-int", - MakeCallback (&CompositeTraceResolverTest::TraceInt, this)); - m_gotInt = false; - m_traceInt (1); - if (m_gotInt) - { - ok = false; - } - - resolver.Connect ("/*/trace-int", - MakeCallback (&CompositeTraceResolverTest::TraceInt, this)); - m_gotInt = false; - m_traceInt (1); - if (!m_gotInt) - { - ok = false; - } - - resolver.Disconnect ("/subresolver/trace-int", - MakeCallback (&CompositeTraceResolverTest::TraceInt, this)); - m_gotInt = false; - m_traceInt (1); - if (m_gotInt) - { - ok = false; - } - - - - - return ok; -} - -static CompositeTraceResolverTest g_compositeTraceResolverTest; - -}//namespace ns3 - - -#endif /* RUN_SELF_TESTS */ diff --git a/src/common/composite-trace-resolver.h b/src/common/composite-trace-resolver.h deleted file mode 100644 index cadf9da2d..000000000 --- a/src/common/composite-trace-resolver.h +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * All rights reserved. - * - * 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: Mathieu Lacage - */ -#ifndef COMPOSITE_TRACE_RESOLVER_H -#define COMPOSITE_TRACE_RESOLVER_H - -#include "ns3/callback.h" -#include "trace-resolver.h" -#include "callback-trace-source.h" -#include "uv-trace-source.h" -#include "sv-trace-source.h" -#include "fv-trace-source.h" -#include "terminal-trace-resolver.h" - -namespace ns3 { - -/** - * \brief a helper class to aggregate contained TraceResolver and other trace sources. - * \ingroup lowleveltracing - */ -class CompositeTraceResolver : public TraceResolver -{ -public: - CompositeTraceResolver (TraceContext const &context); - virtual ~CompositeTraceResolver (); - /** - * \param name name of trace source - * \param trace a callback trace source - * \param context the context associated to this trace source - * - * Add a callback trace source in this resolver. This trace - * source will match the name specified during namespace - * resolution. The TraceContext of this trace source will also - * be automatically extended to contain the input context. - */ - template - void Add (std::string name, - CallbackTraceSource &trace, T const &context); - /** - * \param name name of trace source - * \param trace a signed variable trace source - * \param context the context associated to this trace source - * - * Add a signed variable trace source in this resolver. - * This trace source will match the name specified during namespace - * resolution. The TraceContext of this trace source will also - * be automatically extended to contain the input context. - */ - template - void Add (std::string name, - SVTraceSource &trace, T const &context); - /** - * \param name name of trace source - * \param trace an unsigned variable trace source - * \param context the context associated to this trace source - * - * Add an unsigned variable trace source in this resolver. - * This trace source will match the name specified during namespace - * resolution. The TraceContext of this trace source will also - * be automatically extended to contain the input context. - */ - template - void Add (std::string name, - UVTraceSource &trace, T const &context); - /** - * \param name name of trace source - * \param trace a floating-point variable trace source - * \param context the context associated to this trace source - * - * Add a floating-point variable trace source in this resolver. - * This trace source will match the name specified during namespace - * resolution. The TraceContext of this trace source will also - * be automatically extended to contain the input context. - */ - template - void Add (std::string name, - FVTraceSource &trace, T const &context); - - /** - * \param name name of child trace resolver - * \param createResolver a trace resolver constructor - * \param context the context associated to this entry - * - * Add a child trace resolver to this resolver. This child - * trace resolver will match the name specified during - * namespace resolution. When this happens, the constructor - * will be invoked to create the child trace resolver and - * the associated TraceContext will be automatically extended - * to contain the input context. - */ - template - void Add (std::string name, - Callback createResolver, - T const &context); - - /** - * \param name name of child trace resolver - * \param createResolver a trace resolver constructor - * - * Add a child trace resolver to this resolver. This child - * trace resolver will match the name specified during - * namespace resolution. When this happens, the constructor - * will be invoked to create the child trace resolver. - */ - void Add (std::string name, - Callback createResolver); -private: - template - void DoAddTraceSource (std::string name, - SOURCE &traceSource, CONTEXT const &context); - template - static TraceResolver *CreateTerminalTraceResolver (SOURCE *trace, - TraceContext const &context); - void DoAdd (std::string name, - Callback createResolver, - TraceContext const &context); - virtual TraceResolverList DoLookup (std::string id) const; - - struct CallbackTraceSourceItem - { - std::string name; - Callback createResolver; - TraceContext context; - }; - - typedef std::list TraceItems; - TraceItems m_items; -}; - -}//namespace ns3 - -namespace ns3 { - -template -void -CompositeTraceResolver::DoAddTraceSource (std::string name, - SOURCE &traceSource, CONTEXT const &context) -{ - TraceContext traceContext = GetContext (); - traceContext.Add (context); - TraceResolver *(*create) (SOURCE *trace, TraceContext const &context); - create = &CompositeTraceResolver::CreateTerminalTraceResolver; - Callback createResolver = - MakeBoundCallback (create, &traceSource); - DoAdd (name, createResolver, traceContext); -} - -template -TraceResolver * -CompositeTraceResolver::CreateTerminalTraceResolver (SOURCE *traceSource, - TraceContext const &context) -{ - return new TerminalTraceResolver (*traceSource, context); -} - - - - -template -void -CompositeTraceResolver::Add (std::string name, - CallbackTraceSource &trace, - T const &context) -{ - DoAddTraceSource (name, trace, context); -} -template -void -CompositeTraceResolver::Add (std::string name, - SVTraceSource &trace, T const &context) -{ - DoAddTraceSource (name, trace, context); -} -template -void -CompositeTraceResolver::Add (std::string name, - UVTraceSource &trace, T const &context) -{ - DoAddTraceSource (name, trace, context); -} -template -void -CompositeTraceResolver::Add (std::string name, - FVTraceSource &trace, T const &context) -{ - DoAddTraceSource (name, trace, context); -} -template -void -CompositeTraceResolver::Add (std::string name, - Callback createResolver, - T const &context) -{ - TraceContext traceContext = GetContext (); - traceContext.Add (context); - DoAdd (name, createResolver, traceContext); -} - -}//namespace ns3 - -#endif /* COMPOSITE_TRACE_RESOLVER_H */ diff --git a/src/common/empty-trace-resolver.h b/src/common/empty-trace-resolver.h deleted file mode 100644 index 04f1c1bc4..000000000 --- a/src/common/empty-trace-resolver.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * All rights reserved. - * - * 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: Mathieu Lacage - */ -#ifndef EMPTY_TRACE_RESOLVER_H -#define EMPTY_TRACE_RESOLVER_H - -#include "trace-resolver.h" - -namespace ns3 { - -class TraceContext; - -/** - * \brief a TraceResolver instance which does not resolve anything. - * \ingroup tracing - * - * Trying to resolve against this class will yield no matches and no - * connections. Returning an instance of this class from a - * CreateTraceResolver method is a hand way of not implementing - * any Tracing code. - */ -class EmptyTraceResolver : public TraceResolver -{ -public: - /** - * \param o necessary context for this class. - * - * The only constructor exported by this class. - */ - EmptyTraceResolver (TraceContext const &o); -}; - -}//namespace ns3 - -#endif /* EMPTY_TRACE_RESOLVER_H */ diff --git a/src/common/packet-metadata-test.cc b/src/common/packet-metadata-test.cc index e3e61c45e..ac4d1f994 100644 --- a/src/common/packet-metadata-test.cc +++ b/src/common/packet-metadata-test.cc @@ -217,6 +217,7 @@ private: template void RegisterTrailer (void); void CleanupPrints (void); + Packet DoAddHeader (Packet p); bool Check (const char *file, int line, std::list expected); @@ -430,6 +431,14 @@ PacketMetadataTest::CheckHistory (Packet p, const char *file, int line, uint32_t } \ } + +Packet +PacketMetadataTest::DoAddHeader (Packet p) +{ + ADD_HEADER (p, 10); + return p; +} + bool PacketMetadataTest::RunTests (void) { @@ -659,6 +668,18 @@ PacketMetadataTest::RunTests (void) ADD_HEADER (p, 10); CHECK_HISTORY (p, 1, 10); + p = Packet (); + ADD_HEADER (p, 10); + p = DoAddHeader (p); + CHECK_HISTORY (p, 2, 10, 10); + + p = Packet (10); + ADD_HEADER (p, 8); + ADD_TRAILER (p, 8); + ADD_TRAILER (p, 8); + p.RemoveAtStart (8+10+8); + CHECK_HISTORY (p, 1, 8); + return ok; } diff --git a/src/common/packet-metadata.cc b/src/common/packet-metadata.cc index 4229e15f8..fe4ad4fe0 100644 --- a/src/common/packet-metadata.cc +++ b/src/common/packet-metadata.cc @@ -21,16 +21,17 @@ #include #include "ns3/assert.h" #include "ns3/fatal-error.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "packet-metadata.h" #include "buffer.h" #include "chunk-registry.h" -NS_DEBUG_COMPONENT_DEFINE ("PacketMetadata"); +NS_LOG_COMPONENT_DEFINE ("PacketMetadata"); namespace ns3 { bool PacketMetadata::m_enable = false; +bool PacketMetadata::m_metadataSkipped = false; uint32_t PacketMetadata::m_maxSize = 0; uint16_t PacketMetadata::m_chunkUid = 0; PacketMetadata::DataFreeList PacketMetadata::m_freeList; @@ -47,6 +48,13 @@ PacketMetadata::DataFreeList::~DataFreeList () void PacketMetadata::Enable (void) { + NS_ASSERT_MSG (!m_metadataSkipped, + "Error: attempting to enable the packet metadata " + "subsystem too late in the simulation, which is not allowed.\n" + "A common cause for this problem is to enable ASCII tracing " + "after sending any packets. One way to fix this problem is " + "to call ns3::PacketMetadata::Enable () near the beginning of" + " the program, before any packets are sent."); m_enable = true; } @@ -610,7 +618,7 @@ PacketMetadata::ReadItems (uint16_t current, struct PacketMetadata::Data * PacketMetadata::Create (uint32_t size) { - NS_DEBUG ("create size="< - */ -#ifndef TERMINAL_TRACE_RESOLVER_H -#define TERMINAL_TRACE_RESOLVER_H - -#include "trace-resolver.h" - -namespace ns3 { - -class TraceContext; - -template -class TerminalTraceResolver : public TraceResolver -{ - public: - TerminalTraceResolver (T &traceSource, TraceContext const &context); - private: - virtual void DoConnect (CallbackBase const &cb); - virtual void DoDisconnect (CallbackBase const &cb); - T &m_traceSource; -}; - -}//namespace ns3 - -namespace ns3 { - -template -TerminalTraceResolver::TerminalTraceResolver (T &traceSource, - TraceContext const &context) - : TraceResolver (context), - m_traceSource (traceSource) -{} -template -void -TerminalTraceResolver::DoConnect (CallbackBase const &cb) -{ - m_traceSource.AddCallback (cb, GetContext ()); -} -template -void -TerminalTraceResolver::DoDisconnect (CallbackBase const &cb) -{ - m_traceSource.RemoveCallback (cb); -} - -}//namespace ns3 - -#endif /* TERMINAL_TRACE_RESOLVER_H */ diff --git a/src/common/trace-resolver.cc b/src/common/trace-resolver.cc deleted file mode 100644 index 251e7cc87..000000000 --- a/src/common/trace-resolver.cc +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * All rights reserved. - * - * 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: Mathieu Lacage - */ -#include "trace-resolver.h" - -namespace ns3 { - -TraceResolver::TraceResolver (TraceContext const &context) - : m_context (context) -{} - -TraceResolver::~TraceResolver () -{} - -TraceContext const & -TraceResolver::GetContext (void) const -{ - return m_context; -} - -void -TraceResolver::Connect (std::string path, CallbackBase const &cb) -{ - std::string::size_type cur = 1; - // check that first char is "/" - std::string::size_type next = path.find ("/", cur); - std::string element = std::string (path, cur, next-1); - TraceResolverList resolverList = DoLookup (element); - for (TraceResolverList::iterator i = resolverList.begin (); i != resolverList.end (); i++) - { - TraceResolver *resolver = *i; - if (next == std::string::npos) - { - // we really break the recursion here. - resolver->DoConnect (cb); - } - else - { - std::string subpath = std::string (path, next, std::string::npos); - resolver->Connect (subpath, cb); - } - delete resolver; - } - resolverList.erase (resolverList.begin (), resolverList.end ()); -} - -void -TraceResolver::Disconnect (std::string path, CallbackBase const &cb) -{ - std::string::size_type cur = 1; - // check that first char is "/" - std::string::size_type next = path.find ("/", cur); - std::string element = std::string (path, cur, next-1); - TraceResolverList resolverList = DoLookup (element); - for (TraceResolverList::iterator i = resolverList.begin (); i != resolverList.end (); i++) - { - TraceResolver *resolver = *i; - if (next == std::string::npos) - { - // we really break the recursion here. - resolver->DoDisconnect (cb); - } - else - { - std::string subpath = std::string (path, next, std::string::npos); - resolver->Disconnect (subpath, cb); - } - delete resolver; - } - resolverList.erase (resolverList.begin (), resolverList.end ()); -} - -TraceResolver::TraceResolverList -TraceResolver::DoLookup (std::string id) const -{ - return TraceResolverList (); -} -void -TraceResolver::DoConnect (CallbackBase const &cb) -{} - -void -TraceResolver::DoDisconnect (CallbackBase const &cb) -{} - - -}//namespace ns3 diff --git a/src/common/trace-resolver.h b/src/common/trace-resolver.h deleted file mode 100644 index 93bf43095..000000000 --- a/src/common/trace-resolver.h +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * All rights reserved. - * - * 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: Mathieu Lacage - */ -#ifndef TRACE_RESOLVER_H -#define TRACE_RESOLVER_H - -#include -#include -#include "trace-context.h" - -namespace ns3 { - -class CallbackBase; - -/** - * \brief the base class which is used to incremental perform trace - * namespace resolution. - * \ingroup lowleveltracing - * - * This class provides a public API to the ns3::TraceRoot object: - * - ns3::TraceResolver::Connect - * - ns3::TraceResolver::Disconnect - * - * It also provides an API for its subclasses. Each subclass should - * implement one of: - * - ns3::TraceResolver::DoLookup - * - ns3::TraceResolver::DoConnect and ns3::TraceResolver::DoDisconnect - * Each subclass must also provide an ns3::TraceContext to the TraceResolver - * constructor. Finally, each subclass can access the ns3::TraceContext - * associated to this ns3::TraceResolver through the - * ns3::TraceResolver::GetContext method. - */ -class TraceResolver -{ -public: - virtual ~TraceResolver (); - /** - * \param path the namespace path to resolver - * \param cb the callback to connect to the matching namespace - * - * This method is typically invoked by ns3::TraceRoot but advanced - * users could also conceivably call it directly if they want to - * skip the ns3::TraceRoot. - */ - void Connect (std::string path, CallbackBase const &cb); - /** - * \param path the namespace path to resolver - * \param cb the callback to disconnect in the matching namespace - * - * This method is typically invoked by ns3::TraceRoot but advanced - * users could also conceivably call it directly if they want to - * skip the ns3::TraceRoot. - */ - void Disconnect (std::string path, CallbackBase const &cb); -protected: - /** - * \param context the context used to initialize this TraceResolver. - * - * Every subclass must call this constructor - */ - TraceResolver (TraceContext const &context); - /** - * \returns the ns3::TraceContext stored in this ns3::TraceResolver. - * - * Subclasses usually invoke this method to get access to the - * TraceContext stored here to pass it down to the TraceResolver - * constructors invoked from within the DoLookup method. - */ - TraceContext const &GetContext (void) const; - typedef std::list TraceResolverList; -private: - TraceResolver (); - /** - * \param id the id to resolve. This is supposed to be - * one element of the global tracing namespace. - * \returns a list of reslvers which match the input namespace element - * - * A subclass which overrides this method should return a potentially - * empty list of pointers to ns3::TraceResolver instances which match - * the input namespace element. Each of these TraceResolver should be - * instanciated with a TraceContext which holds enough context - * information to identify the type of the TraceResolver. - */ - virtual TraceResolverList DoLookup (std::string id) const; - /** - * \param cb callback to connect - * - * This method is invoked on leaf trace resolvers. - */ - virtual void DoConnect (CallbackBase const &cb); - /** - * \param cb callback to disconnect - * - * This method is invoked on leaf trace resolvers. - */ - virtual void DoDisconnect (CallbackBase const &cb); - TraceContext m_context; -}; - -}//namespace ns3 - -#endif /* TRACE_RESOLVER_H */ diff --git a/src/common/trace-root.cc b/src/common/trace-root.cc deleted file mode 100644 index 5bb270b8c..000000000 --- a/src/common/trace-root.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * All rights reserved. - * - * 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: Mathieu Lacage - */ -#include "trace-root.h" -#include "ns3/composite-trace-resolver.h" -#include "ns3/trace-context.h" - -namespace ns3 { - -void -TraceRoot::Connect (std::string path, CallbackBase const &cb) -{ - TraceResolver *resolver = GetComposite (); - resolver->Connect (path, cb); -} -void -TraceRoot::Disconnect (std::string path, CallbackBase const &cb) -{ - TraceResolver *resolver = GetComposite (); - resolver->Disconnect (path, cb); -} -void -TraceRoot::Register (std::string name, - Callback createResolver) -{ - CompositeTraceResolver *resolver = GetComposite (); - resolver->Add (name, createResolver); -} - -CompositeTraceResolver * -TraceRoot::GetComposite (void) -{ - static CompositeTraceResolver resolver = CompositeTraceResolver (TraceContext ()); - return &resolver; -} - -} // namespace ns3 diff --git a/src/common/trace-root.h b/src/common/trace-root.h deleted file mode 100644 index a07f923cd..000000000 --- a/src/common/trace-root.h +++ /dev/null @@ -1,335 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * All rights reserved. - * - * 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: Mathieu Lacage - */ -#ifndef TRACE_ROOT_H -#define TRACE_ROOT_H - -#include -#include "ns3/callback.h" - -/** - * \defgroup lowleveltracing Low-level tracing - * - * This low-level API is built around a few concepts: - * - There can be any number of trace source objects. Each trace source - * object can generate any number of trace events. The current - * trace source objects are: ns3::CallbackTraceSourceSource, ns3::UVTraceSource, - * ns3::SVTraceSource, and, ns3::FVTraceSource. - * - Each trace source can be connected to any number of trace sinks. - * A trace sink is a ns3::Callback with a very special signature. Its - * first argument is always a ns3::TraceContext. - * - Every trace source is uniquely identified by a ns3::TraceContext. Every - * trace sink can query a ns3::TraceContext for information. This allows - * a trace sink which is connected to multiple trace sources to identify - * from which source each event is coming from. - * - * To define new trace sources, a model author needs to instante one trace source - * object for each kind of tracing event he wants to export. The trace source objects - * currently defined are: - * - ns3::CallbackTraceSourceSource: this trace source can be used to convey any kind of - * trace event to the user. It is a functor, that is, it is a variable - * which behaves like a function which will forward every event to every - * connected trace sink (i.e., ns3::Callback). This trace source takes - * up to four arguments and forwards these 4 arguments together with the - * ns3::TraceContext which identifies this trace source to the connected - * trace sinks. - * - ns3::UVTraceSource: this trace source is used to convey key state variable - * changes to the user. It behaves like a normal integer unsigned variable: - * you can apply every normal arithmetic operator to it. It will forward - * every change in the value of the variable back to every connected trace - * sink by providing a TraceContext, the old value and the new value. - * - ns3::SVTraceSource: this is the signed integer equivalent of - * ns3::UVTraceSource. - * - ns3::FVTraceSource: this is the floating point equivalent of - * ns3::UVTraceSource and ns3::SVTraceSource. - * - * For example, to define a trace source which notifies you of a new packet - * being transmitted, you would have to: - * \code - * class MyModel - * { - * public: - * void Tx (Packet const &p); - * private: - * CallbackTraceSource m_txTrace; - * }; - * - * void - * MyModel::Tx (Packet const &p) - * { - * // trace packet tx event. - * m_txTrace (p); - * // ... send the packet for real. - * } - * \endcode - * - * Once the model author has instantiated these objects and has wired them - * in his simulation code (that is, he calls them wherever he wants to trigger - * a trace event), he needs to make these trace sources available to users - * to allow them to connect any number of trace sources to any number - * of user trace sinks. While it would be possible to make each model - * export directly each of his trace source instances and request users to - * invoke a source->Connect (callback) method to perform the connection - * explicitely, it was felt that this was a bit cumbersome to do. - * - * As such, the ``connection'' between a set of sources and a sink is - * performed through a third-party class, the TraceResolver, which - * can be used to automate the connection of multiple matching trace sources - * to a single sink. This TraceResolver works by defining a hierarchical - * tracing namespace: the root of this namespace is accessed through the - * ns3::TraceRoot class. The namespace is represented as a string made of - * multiple elements, each of which is separated from the other elements - * by the '/' character. A namespace string always starts with a '/'. - * - * By default, the current simulation models provide a '/nodes' tracing root. - * This '/nodes' namespace is structured as follows: - * \code - * /nodes/n/arp - * /nodes/n/udp - * /nodes/n/ipv4 - * /tx - * /rx - * /drop - * /interfaces/n/netdevice - * /queue/ - * /enque - * /deque - * /drop - * \endcode - * - * The 'n' element which follows the /nodes and /interfaces namespace elements - * identify a specific node and interface through their index within the - * ns3::NodeList and ns3::Ipv4 objects respectively. - * - * To connect a trace sink to a trace source identified by a namespace string, - * a user can call the ns3::TraceRoot::Connect method (the ns3::TraceRoot::Disconnect - * method does the symmetric operation). This connection method can accept - * fully-detailed namespace strings but it can also perform pattern matching - * on the user-provided namespace strings to connect multiple trace sources - * to a single trace sink in a single connection operation. - * - * The syntax of the pattern matching rules are loosely based on regular - * expressions: - * - the '*' character matches every element - * - the (a|b) construct matches element 'a' or 'b' - * - the [ss-ee] construct matches all numerical values which belong - * to the interval which includes ss and ee - * - * For example, the user could use the following to connect a single sink - * to the ipv4 tx, rx, and drop trace events: - * - * \code - * void MyTraceSink (TraceContext const &context, Packet &packet); - * TraceRoot::Connect ("/nodes/ * /ipv4/ *", MakeCallback (&MyTraceSink)); - * \endcode - * - * Of course, this code would work only if the signature of the trace sink - * is exactly equal to the signature of all the trace sources which match - * the namespace string (if one of the matching trace source does not match - * exactly, a fatal error will be triggered at runtime during the connection - * process). The ns3::TraceContext extra argument contains - * information on where the trace source is located in the namespace tree. - * In that example, if there are multiple nodes in this scenario, each - * call to the MyTraceSink function would receive a different TraceContext, - * each of which would contain a different NodeList::NodeIndex object. - * - * It is important to understand exactly what an ns3::TraceContext - * is. It is a container for a number of type instances. Each instance of - * a ns3::TraceContext contains one and only one instance of a given type. - * ns3::TraceContext::Add can be called to add a type instance into a - * TraceContext instance and ns3::TraceContext::Get can be called to get - * a copy of a type instance stored into the ns3::TraceContext. If ::Get - * cannot retrieve the requested type, a fatal error is triggered at - * runtime. The values stored into an ns3::TraceContext attached to a - * trace source are automatically determined during the namespace - * resolution process. To retrieve a value from a ns3::TraceContext, the - * code can be as simple as this: - * \code - * void MyTraceSink (TraceContext const &context, Packet &packet) - * { - * NodeList::NodeIndex index; - * context.Get (index); - * std::cout << "node id=" << NodeList::GetNode (index)->GetId () << std::endl; - * } - * \endcode - * - * The hierarchical global namespace described here is not implemented - * in a single central location: it was felt that doing this would make - * it too hard to introduce user-specific models which could hook - * automatically into the overal tracing system. If the tracing - * namespace was implemented in a single central location, every model - * author would have had to modify this central component to make - * his own model available to trace users. - * - * Instead, the handling of the namespace is distributed across every relevant - * model: every model implements only the part of the namespace it is - * really responsible for. To do this, every model is expected - * to provide an instance of a TraceResolver whose - * responsability is to recursively provide access to the trace sources - * defined in its model. Each TraceResolver instance should be a subclass - * of the TraceResolver base class which implements either the DoLookup - * or the DoConnect and DoDisconnect methods. Because implementing these - * methods can be a bit tedious, our tracing framework provides a number - * of helper template classes which should save the model author from - * having to implement his own in most cases: - * - ns3::CompositeTraceResolver: this subclass of ns3::TraceResolver can - * be used to aggregate together multiple trace sources and multiple other - * ns3::TraceResolver instances. - * - ns3::ArrayTraceResolver: this subclass of ns3::TraceResolver can be - * used to match any number of elements within an array where every element - * is identified by its index. - * - * Once you can instantiate your own ns3::TraceResolver object instance, you - * have to hook it up into the global namespace. There are two ways to do this: - * - you can hook your ns3::TraceResolver creation method as a new trace - * root by using the ns3::TraceRoot::Register method - * - you can hook your new ns3::TraceResolver creation method into the - * container of your model. This step will obvsiouly depend on which model - * contains your own model but, if you wrote a new l3 protocol, all you - * would have to do to hook into your container L3Demux class is to implement - * the pure virtual method inherited from the L3Protocol class whose name is - * ns3::L3protocol::CreateTraceResolver. - * - * So, in most cases, exporting a model's trace sources is a matter of - * implementing a method CreateTraceResolver as shown below: - * \code - * class MyModel - * { - * public: - * enum TraceType { - * TX, - * RX, - * ... - * }; - * TraceResolver *CreateTraceResolver (TraceContext const &context); - * void Tx (Packet const &p); - * private: - * CallbackTraceSource m_txTrace; - * }; - * - * TraceResolver * - * MyModel::CreateTraceResolver (TraceContext const &context) - * { - * CompositeTraceResolver *resolver = new CompositeTraceResolver (context); - * resolver->Add ("tx", m_txTrace, MyModel::TX); - * return resolver; - * } - * void - * MyModel::Tx (Packet const &p) - * { - * m_txTrace (p); - * } - * \endcode - * - * If you really want to have fun and implement your own ns3::TraceResolver - * subclass, you need to understand the basic Connection and Disconnection - * algorithm. The code of that algorithm is wholy contained in the - * ns3::TraceResolver::Connect and ns3::TraceResolver::Disconnect methods. - * The idea is that we recursively parse the input namespace string by removing - * the first namespace element. This element is 'resolved' is calling - * the ns3::TraceResolver::DoLookup method which returns a list of - * TraceResolver instances. Each of the returned TraceResolver instance is - * then given what is left of the namespace by calling ns3::TraceResolver::Connect - * until the last namespace element is processed. At this point, we invoke - * the ns3::TraceResolver::DoConnect or ns3::TraceResolver::DoDisconnect - * methods to break the recursion. A good way to understand this algorithm - * is to trace its behavior. Let's say that you want to connect to - * '/nodes/ * /ipv4/interfaces/ * /netdevice/queue/ *'. It would generate - * the following call traces: - * - * \code - * TraceRoot::Connect ("/nodes/ * /ipv4/interfaces/ * /netdevice/queue/ *", callback); - * traceContext = TraceContext (); - * rootResolver = CompositeTraceResolver (traceContext); - * rootResolver->Connect ("/nodes/ * /ipv4/interfaces/ * /netdevice/queue/ *", callback); - * resolver = CompositeTraceResolver::DoLookup ("nodes"); - * return NodeList::CreateTraceResolver (GetContext ()); - * return ArrayTraceResolver (context); - * resolver->Connect ("/ * /ipv4/interfaces/ * /netdevice/queue/ *", callback); - * ArrayTraceResolver::DoLookup ("*"); - * for (i = 0; i < n_nodes; i++) - * resolver = nodes[i]->CreateTraceResolver (GetContext ()); - * return CompositeTraceResolver (context); - * resolvers.add (resolver); - * return resolvers; - * for resolver in (resolvers) - * resolver->Connect ("/ipv4/interfaces/ * /netdevice/queue/ *", callback); - * CompositeTraceResolver::DoLookup ("ipv4"); - * resolver = ipv4->CreateTraceResolver (GetContext ()); - * return CompositeTraceResolver (context); - * return resolver; - * resolver->Connect ("/interfaces/ * /netdevice/queue/ *", callback); - * CompositeTraceResolver::DoLookup ("interfaces"); - * resolver = ArrayTraceResolver (GetContext ()); - * resolver->Connect ("/ * /netdevice/queue/ *", callback); - * ArrayTraceResolver::DoLookup ("*"); - * for (i = 0; i < n_interfaces; i++) - * resolver = interfaces[i]->CreateTraceResolver (GetContext ()); - * return CompositeTraceResolver () - * resolvers.add (resolver); - * return resolvers; - * resolver->Connect ("/netdevice/queue/ *", callback); - * CompositeTraceResolver::DoLookup ("netdevice"); - * resolver = NetDevice::CreateTraceResolver (GetContext ()); - * return CompositeTraceResolver (); - * return resolver; - * resolver->Connect ("/queue/ *", callback); - * CompositeTraceResolver::DoLookup ("queue"); - * resolver = Queue::CreateTraceResolver (GetContext ()); - * return CompositeTraceResolver (); - * return resolver - * resolver->Connect ("*", callback); - * CompositeTraceResolver::DoLookup ("*"); - * for match in (matches) - * resolver = TerminalTraceResolver ("match"); - * resolvers.add (resolver) - * return resolvers; - * for resolver in (resolvers) - * TerminalTraceResolver->DoConnect (callback); - * \endcode - */ - -namespace ns3 { - -class CompositeTraceResolver; -class TraceResolver; -class TraceContext; -class CallbackBase; - -/** - * \brief The main class used to access tracing functionality for - * a user. - * - * \ingroup lowleveltracing - */ -class TraceRoot -{ -public: - static void Connect (std::string path, CallbackBase const &cb); - static void Disconnect (std::string path, CallbackBase const &cb); - static void Register (std::string name, - Callback createResolver); -private: - static CompositeTraceResolver *GetComposite (void); -}; - -}// namespace ns3 - -#endif /* TRACE_ROOT_H */ diff --git a/src/common/waf b/src/common/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/common/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/common/wscript b/src/common/wscript index c6e9cb45d..2472ecd1e 100644 --- a/src/common/wscript +++ b/src/common/wscript @@ -12,14 +12,6 @@ def build(bld): 'tags.cc', 'tag-registry.cc', 'pcap-writer.cc', - 'variable-tracer-test.cc', - 'trace-context.cc', - 'trace-context-element.cc', - 'trace-resolver.cc', - 'callback-trace-source.cc', - 'empty-trace-resolver.cc', - 'composite-trace-resolver.cc', - 'trace-root.cc', 'data-rate.cc', ] @@ -35,18 +27,6 @@ def build(bld): 'packet.h', 'packet-printer.h', 'packet-metadata.h', - 'uv-trace-source.h', - 'sv-trace-source.h', - 'fv-trace-source.h', 'pcap-writer.h', - 'callback-trace-source.h', - 'trace-context.h', - 'trace-context-element.h', - 'trace-resolver.h', - 'empty-trace-resolver.h', - 'composite-trace-resolver.h', - 'array-trace-resolver.h', - 'trace-root.h', - 'terminal-trace-resolver.h', 'data-rate.h', ] diff --git a/src/core/array-trace-resolver.h b/src/core/array-trace-resolver.h new file mode 100644 index 000000000..ecbc63d5d --- /dev/null +++ b/src/core/array-trace-resolver.h @@ -0,0 +1,205 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * All rights reserved. + * + * 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: Mathieu Lacage + */ +#ifndef ARRAY_TRACE_RESOLVER_H +#define ARRAY_TRACE_RESOLVER_H + +#include +#include +#include "callback.h" +#include "trace-resolver.h" +#include "object.h" + +namespace ns3 { + +/** + * \brief a helper class to offer trace resolution for an array of objects. + * \ingroup tracing + * + * \class ArrayTraceResolver + * + * An ArrayTraceResolver is a resolver which can match any input integer + * against an element in an array. The array is accessed using a + * pair iterators. Each element of the array is expected + * to be a subclass of the Object base class. + * + * When the Connect method is called, this trace resolver will + * automatically store in the TraceContext of each resolved object + * its index through an object of type INDEX specified during the + * instanciation of the ArrayTraceResolver template. + */ +template +class ArrayTraceResolver : public TraceResolver +{ +public: + ArrayTraceResolver (); + ~ArrayTraceResolver (); + + /** + * \param begin an iterator which points to the start of the array. + * \param end an iterator which points to the end of the array. + */ + template + void SetIterators (T begin, T end); + + // inherited from TraceResolver + virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); + virtual void Disconnect (std::string path, CallbackBase const &cb); + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection); + virtual void TraceAll (std::ostream &os, const TraceContext &context); + +private: + class IteratorBase + { + public: + virtual ~IteratorBase () {} + virtual void Next (void) = 0; + virtual bool HasNext (void) = 0; + virtual Ptr Get (void) = 0; + virtual void Rewind (void) = 0; + }; + IteratorBase *m_iter; +}; +}//namespace ns3 + + +// implementation +namespace ns3 { + +template +ArrayTraceResolver::ArrayTraceResolver () + : m_iter (0) +{} + +template +ArrayTraceResolver::~ArrayTraceResolver () +{ + delete m_iter; +} + +template +template +void +ArrayTraceResolver::SetIterators (T begin, T end) +{ + class Iterator : public IteratorBase + { + public: + Iterator (T begin, T end) + : m_begin (begin), m_end (end), m_cur (begin) + {} + virtual void Next (void) + {m_cur++;} + virtual bool HasNext (void) + {return m_cur != m_end;} + virtual Ptr Get (void) + {return *m_cur;} + virtual void Rewind (void) + {m_cur = m_begin;} + private: + T m_begin; + T m_end; + T m_cur; + }; + delete m_iter; + m_iter = new Iterator (begin, end); +} + +template +void +ArrayTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) +{ + if (path == "") + { + return; + } + std::string id = GetElement (path); + std::string subpath = GetSubpath (path); + if (id == "*") + { + uint32_t j = 0; + for (m_iter->Rewind (); m_iter->HasNext (); m_iter->Next ()) + { + TraceContext tmp = context; + INDEX index = j; + tmp.AddElement (index); + Ptr obj = m_iter->Get (); + obj->GetTraceResolver ()->Connect (subpath, cb, tmp); + j++; + } + } +} +template +void +ArrayTraceResolver::Disconnect (std::string path, CallbackBase const &cb) +{ + if (path == "") + { + return; + } + std::string id = GetElement (path); + std::string subpath = GetSubpath (path); + if (id == "*") + { + for (m_iter->Rewind (); m_iter->HasNext (); m_iter->Next ()) + { + Ptr obj = m_iter->Get (); + obj->TraceDisconnect (subpath, cb); + } + } +} +template +void +ArrayTraceResolver::CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) +{ + path.append ("/[0-n]"); + uint32_t j = 0; + for (m_iter->Rewind (); m_iter->HasNext (); m_iter->Next ()) + { + TraceContext tmp = context; + INDEX index = j; + tmp.AddElement (index); + Ptr obj = m_iter->Get (); + obj->GetTraceResolver ()->CollectSources (path, tmp, collection); + j++; + } +} + +template +void +ArrayTraceResolver::TraceAll (std::ostream &os, const TraceContext &context) +{ + uint32_t j = 0; + for (m_iter->Rewind (); m_iter->HasNext (); m_iter->Next ()) + { + TraceContext tmp = context; + INDEX index = j; + tmp.AddElement (index); + Ptr obj = m_iter->Get (); + obj->GetTraceResolver ()->TraceAll (os, tmp); + j++; + } +} + +}//namespace ns3 + +#endif /* ARRAY_TRACE_RESOLVER_H */ diff --git a/src/core/callback-test.cc b/src/core/callback-test.cc index 9e8cf259f..4fb062321 100644 --- a/src/core/callback-test.cc +++ b/src/core/callback-test.cc @@ -57,6 +57,21 @@ void *Test10 (bool *a, int const & b) return a; } +void TestFZero (void) {} +void TestFOne (int) {} +void TestFTwo (int, int) {} +void TestFThree (int, int, int) {} +void TestFFour (int, int, int, int) {} +void TestFFive (int, int, int, int, int) {} +void TestFSix (int, int, int, int, int, int) {} + +void TestFROne (int &) {} +void TestFRTwo (int &, int &) {} +void TestFRThree (int &, int &, int &) {} +void TestFRFour (int &, int &, int &, int &) {} +void TestFRFive (int &, int &, int &, int &, int &) {} +void TestFRSix (int &, int &, int &, int &, int &, int &) {} + class CallbackTest : public ns3::Test { private: bool m_test1; @@ -73,6 +88,22 @@ public: void Test3 (double a); int Test4 (double a, int b); void Test8 (Callback callback); + + void TestZero (void) {} + void TestOne (int) {} + void TestTwo (int, int) {} + void TestThree (int, int, int) {} + void TestFour (int, int, int, int) {} + void TestFive (int, int, int, int, int) {} + void TestSix (int, int, int, int, int, int) {} + + void TestCZero (void) const {} + void TestCOne (int) const {} + void TestCTwo (int, int) const {} + void TestCThree (int, int, int) const {} + void TestCFour (int, int, int, int) const {} + void TestCFive (int, int, int, int, int) const {} + void TestCSix (int, int, int, int, int, int) const {} }; CallbackTest::CallbackTest () @@ -110,6 +141,7 @@ CallbackTest::Test8 (Callback callback) { callback (3); } + bool CallbackTest::IsWrong (void) { @@ -216,6 +248,53 @@ CallbackTest::RunTests (void) MakeBoundCallback (&Test9, &v); MakeBoundCallback (&Test10, &v); + + MakeCallback (&CallbackTest::TestZero, this); + MakeCallback (&CallbackTest::TestOne, this); + MakeCallback (&CallbackTest::TestTwo, this); + MakeCallback (&CallbackTest::TestThree, this); + MakeCallback (&CallbackTest::TestFour, this); + MakeCallback (&CallbackTest::TestFive, this); + MakeCallback (&CallbackTest::TestSix, this); + + MakeCallback (&CallbackTest::TestCZero, this); + MakeCallback (&CallbackTest::TestCOne, this); + MakeCallback (&CallbackTest::TestCTwo, this); + MakeCallback (&CallbackTest::TestCThree, this); + MakeCallback (&CallbackTest::TestCFour, this); + MakeCallback (&CallbackTest::TestCFive, this); + MakeCallback (&CallbackTest::TestCSix, this); + + MakeCallback (&TestFZero); + MakeCallback (&TestFOne); + MakeCallback (&TestFTwo); + MakeCallback (&TestFThree); + MakeCallback (&TestFFour); + MakeCallback (&TestFFive); + MakeCallback (&TestFSix); + + MakeCallback (&TestFROne); + MakeCallback (&TestFRTwo); + MakeCallback (&TestFRThree); + MakeCallback (&TestFRFour); + MakeCallback (&TestFRFive); + MakeCallback (&TestFRSix); + + + MakeBoundCallback (&TestFOne, 1); + MakeBoundCallback (&TestFTwo, 1); + MakeBoundCallback (&TestFThree, 1); + MakeBoundCallback (&TestFFour, 1); + MakeBoundCallback (&TestFFive, 1); + + MakeBoundCallback (&TestFROne, 1); + MakeBoundCallback (&TestFRTwo, 1); + MakeBoundCallback (&TestFRThree, 1); + MakeBoundCallback (&TestFRFour, 1); + MakeBoundCallback (&TestFRFive, 1); + + + return ok; } diff --git a/src/common/callback-trace-source.cc b/src/core/callback-trace-source.cc similarity index 80% rename from src/common/callback-trace-source.cc rename to src/core/callback-trace-source.cc index d35b4f860..02298520e 100644 --- a/src/common/callback-trace-source.cc +++ b/src/core/callback-trace-source.cc @@ -19,7 +19,10 @@ * Author: Mathieu Lacage */ #include "callback-trace-source.h" -#include "ns3/test.h" + +#ifdef RUN_SELF_TESTS + +#include "test.h" namespace ns3 { @@ -55,7 +58,7 @@ CallbackTraceSourceTest::CbTwo (TraceContext const &context, uint8_t a, double b bool CallbackTraceSourceTest::RunTests (void) { - bool ok = true; + bool result = true; TraceContext ctx; CallbackTraceSource trace; @@ -64,32 +67,35 @@ CallbackTraceSourceTest::RunTests (void) m_one = false; m_two = false; trace (1, 2); - if (!m_one || !m_two) - { - ok = false; - } + NS_TEST_ASSERT (m_one); + NS_TEST_ASSERT (m_two); + trace.RemoveCallback (MakeCallback (&CallbackTraceSourceTest::CbOne, this)); m_one = false; m_two = false; trace (1, 2); - if (m_one || !m_two) - { - ok = false; - } + NS_TEST_ASSERT (!m_one); + NS_TEST_ASSERT (m_two); trace.RemoveCallback (MakeCallback (&CallbackTraceSourceTest::CbTwo, this)); m_one = false; m_two = false; trace (1, 2); - if (m_one || m_two) - { - ok = false; - } + NS_TEST_ASSERT (!m_one); + NS_TEST_ASSERT (!m_two); - return ok; + trace.AddCallback (MakeCallback (&CallbackTraceSourceTest::CbOne, this), ctx); + trace.AddCallback (MakeCallback (&CallbackTraceSourceTest::CbTwo, this), ctx); + m_one = false; + m_two = false; + trace (1, 2); + NS_TEST_ASSERT (m_one); + NS_TEST_ASSERT (m_two); + + return result; } CallbackTraceSourceTest g_callbackTraceTest; - - }//namespace ns3 + +#endif /* RUN_SELF_TESTS */ diff --git a/src/core/callback-trace-source.h b/src/core/callback-trace-source.h new file mode 100644 index 000000000..2e302cdc2 --- /dev/null +++ b/src/core/callback-trace-source.h @@ -0,0 +1,251 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2005,2006,2007 INRIA + * All rights reserved. + * + * 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: Mathieu Lacage + */ + +#ifndef CALLBACK_TRACE_H +#define CALLBACK_TRACE_H + +#include +#include "callback.h" +#include "fatal-error.h" +#include "trace-context.h" +#include "trace-source.h" + +namespace ns3 { + +/** + * \brief log arbitrary number of parameters to a matching ns3::Callback + * \ingroup tracing + * + * Whenever operator () is invoked on this class, the call and its arguments + * are forwarded to the internal matching ns3::Callback. + */ +template +class CallbackTraceSource : public TraceSource { +public: + CallbackTraceSource (); + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context); + virtual void RemoveCallback (CallbackBase const & callback); + virtual void ConnectPrinter (std::ostream &os, const TraceContext &context); + void operator() (void) const; + void operator() (T1 a1) const; + void operator() (T1 a1, T2 a2) const; + void operator() (T1 a1, T2 a2, T3 a3) const; + void operator() (T1 a1, T2 a2, T3 a3, T4 a4) const; + +private: + typedef std::list > CallbackList; + TraceContext m_context; + CallbackList m_callbackList; +}; + +}; // namespace ns3 + +// implementation below. + +namespace ns3 { + +namespace internal { + +template +class TraceSinkPrint; + +template +class TraceSinkPrint +{ +public: + static Callback Make (std::ostream &os) + { + return ns3::MakeBoundCallback (&DoPrint, &os); + } +private: + static void DoPrint (std::ostream *os, const TraceContext &context, T1 a1, T2 a2, T3 a3, T4 a4) + { + *os << "context=\"" << context << "\" arg1=\"" << a1 << "\" arg2=\"" << a2 << "\" arg3=\"" << a3 << "\" arg4=\"" << a4 << "\"" << std::endl; + } +}; + +template +class TraceSinkPrint +{ +public: + static Callback Make (std::ostream &os) + { + return ns3::MakeBoundCallback (&DoPrint, &os); + } +private: + static void DoPrint (std::ostream *os, const TraceContext &context, T1 a1, T2 a2, T3 a3) + { + *os << "context=\"" << context << "\" arg1=\"" << a1 << "\" arg2=\"" << a2 << "\" arg3=\"" << a3 << "\"" << std::endl; + } +}; + +template +class TraceSinkPrint +{ +public: + static Callback Make (std::ostream &os) + { + return ns3::MakeBoundCallback (&DoPrint, &os); + } +private: + static void DoPrint (std::ostream *os, const TraceContext &context, T1 a1, T2 a2) + { + *os << "context=\"" << context << "\" arg1=\"" << a1 << "\" arg2=\"" << a2 << "\"" << std::endl; + } +}; + +template +class TraceSinkPrint +{ +public: + static Callback Make (std::ostream &os) + { + return ns3::MakeBoundCallback (&DoPrint, &os); + } +private: + static void DoPrint (std::ostream *os, const TraceContext &context, T1 a1) + { + *os << "context=\"" << context << "\" arg1=\"" << a1 << "\"" << std::endl; + } +}; + +template <> +class TraceSinkPrint +{ +public: + static Callback Make (std::ostream &os) + { + return ns3::MakeBoundCallback (&DoPrint, &os); + } +private: + static void DoPrint (std::ostream *os, const TraceContext &context) + { + *os << "context=\"" << context << std::endl; + } +}; + +} // namespace internal + + +template +CallbackTraceSource::CallbackTraceSource () + : m_callbackList () +{} +template +void +CallbackTraceSource::AddCallback (CallbackBase const & callback, + TraceContext const &context) +{ + Callback cb; + cb.Assign (callback); + m_context.Union (context); + m_callbackList.push_back (cb); +} +template +void +CallbackTraceSource::RemoveCallback (CallbackBase const & callback) +{ + for (typename CallbackList::iterator i = m_callbackList.begin (); + i != m_callbackList.end (); /* empty */) + { + if ((*i).IsEqual (callback)) + { + i = m_callbackList.erase (i); + } + else + { + i++; + } + } +} +template +void +CallbackTraceSource::ConnectPrinter (std::ostream &os, const TraceContext &context) +{ + AddCallback (ns3::internal::TraceSinkPrint::Make (os), context); +} +template +void +CallbackTraceSource::operator() (void) const +{ + for (typename CallbackList::const_iterator i = m_callbackList.begin (); + i != m_callbackList.end (); i++) + { + (*i) (m_context); + } +} +template +void +CallbackTraceSource::operator() (T1 a1) const +{ + for (typename CallbackList::const_iterator i = m_callbackList.begin (); + i != m_callbackList.end (); i++) + { + (*i) (m_context, a1); + } +} +template +void +CallbackTraceSource::operator() (T1 a1, T2 a2) const +{ + for (typename CallbackList::const_iterator i = m_callbackList.begin (); + i != m_callbackList.end (); i++) + { + (*i) (m_context, a1, a2); + } +} +template +void +CallbackTraceSource::operator() (T1 a1, T2 a2, T3 a3) const +{ + for (typename CallbackList::const_iterator i = m_callbackList.begin (); + i != m_callbackList.end (); i++) + { + (*i) (m_context, a1, a2, a3); + } +} +template +void +CallbackTraceSource::operator() (T1 a1, T2 a2, T3 a3, T4 a4) const +{ + for (typename CallbackList::const_iterator i = m_callbackList.begin (); + i != m_callbackList.end (); i++) + { + (*i) (m_context, a1, a2, a3, a4); + } +} + +}//namespace ns3 + +#endif /* CALLBACK_TRACE_H */ diff --git a/src/core/callback.h b/src/core/callback.h index 94e58ca92..ff04de447 100644 --- a/src/core/callback.h +++ b/src/core/callback.h @@ -25,6 +25,7 @@ #include "ptr.h" #include "fatal-error.h" #include "empty.h" +#include "type-traits.h" namespace ns3 { @@ -89,55 +90,62 @@ private: }; // declare the CallbackImpl class -template +template class CallbackImpl; // define CallbackImpl for 0 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (void) = 0; }; // define CallbackImpl for 1 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (T1) = 0; }; // define CallbackImpl for 2 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (T1, T2) = 0; }; // define CallbackImpl for 3 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (T1, T2, T3) = 0; }; // define CallbackImpl for 4 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (T1, T2, T3, T4) = 0; }; // define CallbackImpl for 5 params template -class CallbackImpl : public CallbackImplBase { +class CallbackImpl : public CallbackImplBase { public: virtual ~CallbackImpl () {} virtual R operator() (T1, T2, T3, T4, T5) = 0; }; +// define CallbackImpl for 6 params + template +class CallbackImpl : public CallbackImplBase { +public: + virtual ~CallbackImpl () {} + virtual R operator() (T1, T2, T3, T4, T5, T6) = 0; +}; // an impl for Functors: -template -class FunctorCallbackImpl : public CallbackImpl { +template +class FunctorCallbackImpl : public CallbackImpl { public: FunctorCallbackImpl (T const &functor) : m_functor (functor) {} @@ -160,9 +168,12 @@ public: R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) { return m_functor (a1,a2,a3,a4,a5); } + R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) { + return m_functor (a1,a2,a3,a4,a5,a6); + } virtual bool IsEqual (CallbackImplBase const *other) const { - FunctorCallbackImpl const *otherDerived = - dynamic_cast const *> (other); + FunctorCallbackImpl const *otherDerived = + dynamic_cast const *> (other); if (otherDerived == 0) { return false; @@ -178,8 +189,8 @@ private: }; // an impl for pointer to member functions -template -class MemPtrCallbackImpl : public CallbackImpl { +template +class MemPtrCallbackImpl : public CallbackImpl { public: MemPtrCallbackImpl (OBJ_PTR const&objPtr, MEM_PTR mem_ptr) : m_objPtr (objPtr), m_memPtr (mem_ptr) {} @@ -202,9 +213,12 @@ public: R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) { return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3, a4, a5); } + R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) { + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3, a4, a5, a6); + } virtual bool IsEqual (CallbackImplBase const *other) const { - MemPtrCallbackImpl const *otherDerived = - dynamic_cast const *> (other); + MemPtrCallbackImpl const *otherDerived = + dynamic_cast const *> (other); if (otherDerived == 0) { return false; @@ -260,22 +274,22 @@ public: template + typename T5 = empty, typename T6 = empty> class Callback : public CallbackBase { public: // There are two dummy args below to ensure that this constructor is // always properly disambiguited by the c++ compiler template Callback (FUNCTOR const &functor, bool, bool) - : m_impl (Create > (functor)) + : m_impl (Create > (functor)) {} template Callback (OBJ_PTR const &objPtr, MEM_PTR mem_ptr) - : m_impl (Create > (objPtr, mem_ptr)) + : m_impl (Create > (objPtr, mem_ptr)) {} - Callback (Ptr > const &impl) + Callback (Ptr > const &impl) : m_impl (impl) {} @@ -305,14 +319,17 @@ public: R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5) const { return (*(PeekImpl ())) (a1,a2,a3,a4,a5); } + R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6) const { + return (*(PeekImpl ())) (a1,a2,a3,a4,a5,a6); + } - bool IsEqual (CallbackBase const &other) { + bool IsEqual (CallbackBase const &other) const { return PeekImpl ()->IsEqual (other.PeekImpl ()); } - bool CheckType (CallbackBase const& other) { + bool CheckType (CallbackBase const& other) const { CallbackImplBase *otherBase = other.PeekImpl (); - if (dynamic_cast *> (otherBase) != 0) + if (dynamic_cast *> (otherBase) != 0) { return true; } @@ -328,27 +345,27 @@ public: " got=" << typeid (other).name () << ", expected=" << typeid (*this).name ()); } - const Callback *goodType = static_cast *> (&other); + const Callback *goodType = static_cast *> (&other); *this = *goodType; } void Assign (Ptr other) { - CallbackImpl *impl = dynamic_cast *> (PeekPointer (other)); + CallbackImpl *impl = dynamic_cast *> (PeekPointer (other)); if (other == 0) { NS_FATAL_ERROR ("Incompatible types. (feed to \"c++filt -t\")" " got=" << typeid (other).name () << ", expected=" << typeid (*impl).name ()); } - *this = Callback (impl); + *this = Callback (impl); } virtual PtrGetImpl (void) const { return m_impl; } private: - virtual CallbackImpl *PeekImpl (void) const { + virtual CallbackImpl *PeekImpl (void) const { return PeekPointer (m_impl); } - Ptr > m_impl; + Ptr > m_impl; }; /** @@ -369,7 +386,7 @@ Callback MakeCallback (R (T::*memPtr) (void), OBJ objPtr) { return Callback (objPtr, memPtr); } template -Callback MakeCallback (R (T::*mem_ptr) () const, OBJ const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) () const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -381,11 +398,11 @@ Callback MakeCallback (R (T::*mem_ptr) () const, OBJ const objPtr) { * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1), OBJ *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1) const, OBJ const *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -397,11 +414,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1) const, OBJ const *const objPtr * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2), OBJ *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2) const, OBJ const*const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -413,11 +430,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2) const, OBJ const*const o * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3), OBJ *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3) const, OBJ const*const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -429,11 +446,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3) const, OBJ const*c * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4), OBJ *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4) const, OBJ const*const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -445,13 +462,29 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4) const, OBJ c * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ *const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5) const, OBJ const*const objPtr) { +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } +/** + * \ingroup MakeCallback + * \param mem_ptr class method member pointer + * \param objPtr class instance + * \return a wrapper Callback + * Build Callbacks for class method members which takes five arguments + * and potentially return a value. + */ +template +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6), OBJ objPtr) { + return Callback (objPtr, mem_ptr); +} +template +Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6) const, OBJ objPtr) { + return Callback (objPtr, mem_ptr); +} /** * \ingroup MakeCallback @@ -519,6 +552,17 @@ template MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5)) { return Callback (fnPtr, true, true); } +/** + * \ingroup MakeCallback + * \param fnPtr function pointer + * \return a wrapper Callback + * Build Callbacks for functions which takes five arguments + * and potentially return a value. + */ +template +Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5,T6)) { + return Callback (fnPtr, true, true); +} @@ -587,6 +631,17 @@ template MakeNullCallback (void) { return Callback (); } +/** + * \ingroup MakeCallback + * \overload Callback MakeNullCallback (void) + * \return a wrapper Callback + * Build a null callback which takes five arguments + * and potentially return a value. + */ +template +Callback MakeNullCallback (void) { + return Callback (); +} /* @@ -596,9 +651,10 @@ Callback MakeNullCallback (void) { */ // an impl for Bound Functors: template -class BoundFunctorCallbackImpl : public CallbackImpl { +class BoundFunctorCallbackImpl : public CallbackImpl { public: - BoundFunctorCallbackImpl (T const &functor, TX a) + template + BoundFunctorCallbackImpl (FUNCTOR functor, ARG a) : m_functor (functor), m_a (a) {} virtual ~BoundFunctorCallbackImpl () {} R operator() (void) { @@ -635,38 +691,48 @@ public: } private: T m_functor; - TX m_a; + typename TypeTraits::ReferencedType m_a; }; -template -Callback MakeBoundCallback (R (*fnPtr) (TX), TX a) { - Ptr > impl = +template +Callback MakeBoundCallback (R (*fnPtr) (TX), ARG a) { + Ptr > impl = Create >(fnPtr, a); return Callback (impl); } -template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1), TX a) { - Ptr > impl = +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1), ARG a) { + Ptr > impl = Create > (fnPtr, a); return Callback (impl); } -template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2), TX a) { - Ptr > impl = +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2), ARG a) { + Ptr > impl = Create > (fnPtr, a); return Callback (impl); } -template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4), TX a) { - Ptr > impl = +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3), ARG a) { + Ptr > impl = + Create > (fnPtr, a); + return Callback (impl); +} +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4), ARG a) { + Ptr > impl = Create > (fnPtr, a); return Callback (impl); } - -template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5), TX a) { - Ptr > impl = +template +Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5), ARG a) { + Ptr > impl = Create > (fnPtr, a); return Callback (impl); } diff --git a/src/core/command-line.cc b/src/core/command-line.cc index 481c925b4..d66ce53da 100644 --- a/src/core/command-line.cc +++ b/src/core/command-line.cc @@ -85,9 +85,7 @@ CommandLine::PrintHelp (void) void CommandLine::Parse (int argc, char *argv[]) { - argc--; - argv++; - while (argc > 0) + for (argc--, argv++; argc > 0; argc--, argv++) { // remove "--" or "-" heading. std::string param = *argv; @@ -142,8 +140,6 @@ CommandLine::Parse (int argc, char *argv[]) continue; } } - argc--; - argv++; } } diff --git a/src/core/composite-trace-resolver.cc b/src/core/composite-trace-resolver.cc new file mode 100644 index 000000000..fa2eb327e --- /dev/null +++ b/src/core/composite-trace-resolver.cc @@ -0,0 +1,595 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * All rights reserved. + * + * 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: Mathieu Lacage + */ +#include "composite-trace-resolver.h" +#include "log.h" + +NS_LOG_COMPONENT_DEFINE ("CompositeTraceResolver"); + +namespace ns3 { + +CompositeTraceResolver::CompositeTraceResolver () +{} + +CompositeTraceResolver::~CompositeTraceResolver () +{ + for (TraceItems::iterator i = m_items.begin (); i != m_items.end (); i++) + { + delete *i; + } + m_items.clear (); +} + +void +CompositeTraceResolver::AddItem (ResolveItem *item) +{ + m_items.push_back (item); +} + +void +CompositeTraceResolver::Add (std::string name, + Callback > createResolver) +{ + class MakerResolveItem : public ResolveItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {maker ()->Connect (subpath, cb, context);} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {maker ()->Disconnect (subpath, cb);} + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) + { + path.append ("/"); + path.append (this->name); + TraceContext ctx = context; + ctx.Union (this->context); + this->maker ()->CollectSources (path, ctx, collection); + } + virtual void TraceAll (std::ostream &os, const TraceContext &context) + { + TraceContext ctx = context; + ctx.Union (this->context); + this->maker ()->TraceAll (os, ctx); + } + Callback > maker; + } *item = new MakerResolveItem (); + item->name = name; + item->context = TraceContext (); + item->maker = createResolver; + AddItem (item); +} + +void +CompositeTraceResolver::AddSource (std::string name, + const TraceDoc &doc, + const TraceSource &trace) +{ + DoAddSource (name, doc, trace, TraceContext ()); +} + +void +CompositeTraceResolver::DoAddSource (std::string name, + const TraceDoc &doc, + const TraceSource &trace, + const TraceContext &context) +{ + class SourceResolveItem : public ResolveItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {if (subpath == "") {trace->AddCallback (cb, context);}} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {if (subpath == "") {trace->RemoveCallback (cb);}} + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) + { + path.append ("/"); + path.append (this->name); + TraceContext ctx = context; + ctx.Union (this->context); + collection->AddUnique (path, ctx, this->doc); + } + virtual void TraceAll (std::ostream &os, const TraceContext &context) + { + TraceContext ctx = context; + ctx.Union (this->context); + this->trace->ConnectPrinter (os, ctx); + } + TraceSource *trace; + TraceDoc doc; + } *item = new SourceResolveItem (); + item->name = name; + item->context = context; + item->trace = const_cast (&trace); + item->doc = doc; + AddItem (item); +} + + + + +void +CompositeTraceResolver::AddComposite (std::string name, Ptr composite) +{ + DoAddComposite (name, composite, TraceContext ()); +} +void +CompositeTraceResolver::DoAddComposite (std::string name, Ptr composite, const TraceContext &context) +{ + class CompositeResolveItem : public ResolveItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {composite->GetTraceResolver ()->Connect (subpath, cb, context);} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {composite->TraceDisconnect (subpath, cb);} + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) + { + path.append ("/"); + path.append (this->name); + TraceContext ctx = context; + ctx.Union (this->context); + this->composite->GetTraceResolver ()->CollectSources (path, ctx, collection); + } + virtual void TraceAll (std::ostream &os, const TraceContext &context) + { + TraceContext ctx = context; + ctx.Union (this->context); + this->composite->GetTraceResolver ()->TraceAll (os, ctx); + } + + Ptr composite; + } *item = new CompositeResolveItem (); + item->name = name; + item->context = context; + item->composite = composite; + AddItem (item); +} + +void +CompositeTraceResolver::SetParentResolver (Ptr resolver) +{ + m_parent = resolver; +} + +void +CompositeTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) +{ + NS_LOG_LOGIC ("connect path="<name == id) + { + operation.Do (subpath, *i); + operation.DoParent (path, m_parent); + return; + } + } + } + std::list names; + std::string alternatives = std::string (id, start+1, end-1); + std::string::size_type next_pos, cur_pos; + next_pos = 0; + cur_pos = 0; + while (true) + { + std::string element; + next_pos = alternatives.find ("|", cur_pos); + if (next_pos == std::string::npos) + { + element = std::string (alternatives, cur_pos, alternatives.size ()); + names.push_back (element); + break; + } + element = std::string (alternatives, cur_pos, next_pos); + names.push_back (element); + cur_pos = next_pos + 1; + } + for (std::list::const_iterator i = names.begin (); i != names.end (); i++) + { + for (TraceItems::const_iterator j = m_items.begin (); j != m_items.end (); j++) + { + if ((*j)->name == *i) + { + operation.Do (subpath, *j); + break; + } + } + } + operation.DoParent (path, m_parent); +} + +void +CompositeTraceResolver::Disconnect (std::string path, CallbackBase const &cb) +{ + NS_LOG_LOGIC ("disconnect path="<name); + (*i)->CollectSources (path, context, collection); + } + if (m_parent != 0) + { + m_parent->CollectSources (path, context, collection); + } +} +void +CompositeTraceResolver::TraceAll (std::ostream &os, const TraceContext &context) +{ + for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++) + { + NS_LOG_LOGIC ("print " << (*i)->name); + (*i)->TraceAll (os, context); + } + if (m_parent != 0) + { + m_parent->TraceAll (os, context); + } +} + + +}//namespace ns3 + +#ifdef RUN_SELF_TESTS + +#include "test.h" +#include "trace-context-element.h" + +namespace ns3 { + +class TraceSourceTest : public TraceContextElement +{ +public: + enum Sources { + DOUBLEA, + DOUBLEB, + UINT16_T + }; + static uint16_t GetUid (void) + {static uint16_t uid = AllocateUid ("TraceSourceTest"); return uid;} + void Print (std::ostream &os) + {os << "tracesource="; + if (m_sources == DOUBLEA) {os << "doubleA";} + else if (m_sources == DOUBLEB) {os << "doubleB";} + else if (m_sources == UINT16_T) {os << "uint16_t";} + } + std::string GetTypeName (void) {return "ns3::TraceSourceTest";} + TraceSourceTest () : m_sources (TraceSourceTest::DOUBLEA) {} + TraceSourceTest (enum Sources sources) :m_sources (sources) {} + bool IsDoubleA (void) const {return m_sources == TraceSourceTest::DOUBLEA;} + bool IsDoubleB (void) const {return m_sources == TraceSourceTest::DOUBLEB;} + bool IsUint16 (void) const {return m_sources == TraceSourceTest::UINT16_T;} +private: + enum TraceSourceTest::Sources m_sources; +}; + +class SubTraceSourceTest : public TraceContextElement +{ +public: + enum Sources { + INT, + }; + static uint16_t GetUid (void) + {static uint16_t uid = AllocateUid ("SubTraceSourceTest"); return uid;} + void Print (std::ostream &os) + {os << "subtracesource=int";} + std::string GetTypeName (void) const {return "ns3::SubTraceSourceTest";} + SubTraceSourceTest () : m_sources (SubTraceSourceTest::INT) {} + SubTraceSourceTest (enum Sources sources) : m_sources (sources) {} +private: + enum Sources m_sources; +}; + +class CompositeTraceResolverTest : public Test +{ +public: + CompositeTraceResolverTest (); + virtual ~CompositeTraceResolverTest (); + virtual bool RunTests (void); +private: + void TraceDouble (TraceContext const &context, double v); + void TraceInt (TraceContext const &context, int v); + Ptr CreateSubResolver (); + + + bool m_gotDoubleA; + bool m_gotDoubleB; + CallbackTraceSource m_traceInt; + bool m_gotInt; +}; + +CompositeTraceResolverTest::CompositeTraceResolverTest () + : Test ("CompositeTraceResolver") +{} +CompositeTraceResolverTest::~CompositeTraceResolverTest () +{} +void +CompositeTraceResolverTest::TraceDouble (TraceContext const &context, double v) +{ + TraceSourceTest source; + context.GetElement (source); + if (source.IsDoubleA ()) + { + m_gotDoubleA = true; + } + else if (source.IsDoubleB ()) + { + m_gotDoubleB = true; + } + else + { + NS_FATAL_ERROR ("should not get any other trace source in this sink"); + } + +} + +void +CompositeTraceResolverTest::TraceInt (TraceContext const &context, int v) +{ + m_gotInt = true; +} + +Ptr +CompositeTraceResolverTest::CreateSubResolver (void) +{ + Ptr subresolver = Create (); + subresolver->AddSource ("trace-int", TraceDoc ("test source"), m_traceInt, + SubTraceSourceTest (SubTraceSourceTest::INT)); + return subresolver; +} +bool +CompositeTraceResolverTest::RunTests (void) +{ + bool ok = true; + + CallbackTraceSource traceDoubleA; + CallbackTraceSource traceDoubleB; + TraceContext context; + + CompositeTraceResolver resolver; + + resolver.AddSource ("trace-double-a", TraceDoc ("test source"), traceDoubleA, + TraceSourceTest (TraceSourceTest::DOUBLEA)); + resolver.AddSource ("trace-double-b", TraceDoc ("test source"), traceDoubleB, + TraceSourceTest (TraceSourceTest::DOUBLEB)); + + resolver.Connect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); + + m_gotDoubleA = false; + m_gotDoubleB = false; + traceDoubleA (0); + if (!m_gotDoubleA || m_gotDoubleB) + { + ok = false; + } + m_gotDoubleA = false; + traceDoubleA (0); + traceDoubleB (0); + if (!m_gotDoubleA || !m_gotDoubleB) + { + ok = false; + } + m_gotDoubleA = false; + m_gotDoubleB = false; + + resolver.Disconnect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); + + m_gotDoubleA = false; + m_gotDoubleB = false; + traceDoubleA (0); + traceDoubleB (0); + if (m_gotDoubleA || m_gotDoubleB) + { + ok = false; + } + + resolver.Connect ("/trace-double-a", + MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); + m_gotDoubleA = false; + m_gotDoubleB = false; + traceDoubleA (0); + traceDoubleB (0); + if (!m_gotDoubleA || m_gotDoubleB) + { + ok = false; + } + resolver.Disconnect ("/trace-double-a", + MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); + + resolver.Connect ("/(trace-double-a)", + MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); + m_gotDoubleA = false; + m_gotDoubleB = false; + traceDoubleA (0); + traceDoubleB (0); + if (!m_gotDoubleA || m_gotDoubleB) + { + ok = false; + } + resolver.Disconnect ("/trace-double-a", + MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); + + resolver.Connect ("/(trace-double-a|trace-double-b)", + MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ()); + m_gotDoubleA = false; + m_gotDoubleB = false; + traceDoubleA (0); + traceDoubleB (0); + if (!m_gotDoubleA || !m_gotDoubleB) + { + ok = false; + } + resolver.Disconnect ("/trace-double-a", + MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); + m_gotDoubleA = false; + m_gotDoubleB = false; + traceDoubleA (0); + traceDoubleB (0); + if (m_gotDoubleA || !m_gotDoubleB) + { + ok = false; + } + + + resolver.Disconnect ("/(trace-double-a|trace-double-b)", + MakeCallback (&CompositeTraceResolverTest::TraceDouble, this)); + m_gotDoubleA = false; + m_gotDoubleB = false; + traceDoubleA (0); + traceDoubleB (0); + if (m_gotDoubleA || m_gotDoubleB) + { + ok = false; + } + + resolver.Add ("subresolver", + MakeCallback (&CompositeTraceResolverTest::CreateSubResolver, this)); + + resolver.Connect ("/subresolver/trace-int", + MakeCallback (&CompositeTraceResolverTest::TraceInt, this), TraceContext ()); + m_gotInt = false; + m_traceInt (1); + if (!m_gotInt) + { + ok = false; + } + + resolver.Disconnect ("/subresolver/trace-int", + MakeCallback (&CompositeTraceResolverTest::TraceInt, this)); + m_gotInt = false; + m_traceInt (1); + if (m_gotInt) + { + ok = false; + } + + resolver.Connect ("/*/trace-int", + MakeCallback (&CompositeTraceResolverTest::TraceInt, this), TraceContext ()); + m_gotInt = false; + m_traceInt (1); + if (!m_gotInt) + { + ok = false; + } + + resolver.Disconnect ("/subresolver/trace-int", + MakeCallback (&CompositeTraceResolverTest::TraceInt, this)); + m_gotInt = false; + m_traceInt (1); + if (m_gotInt) + { + ok = false; + } + + SVTraceSource source; + + resolver.AddSource ("uint16_t", TraceDoc ("test source"), source, TraceSourceTest (TraceSourceTest::UINT16_T)); + + + return ok; +} + +static CompositeTraceResolverTest g_compositeTraceResolverTest; + +}//namespace ns3 + + +#endif /* RUN_SELF_TESTS */ diff --git a/src/core/composite-trace-resolver.h b/src/core/composite-trace-resolver.h new file mode 100644 index 000000000..ceca4044a --- /dev/null +++ b/src/core/composite-trace-resolver.h @@ -0,0 +1,233 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * All rights reserved. + * + * 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: Mathieu Lacage + */ +#ifndef COMPOSITE_TRACE_RESOLVER_H +#define COMPOSITE_TRACE_RESOLVER_H + +#include +#include "callback.h" +#include "ptr.h" +#include "trace-resolver.h" +#include "callback-trace-source.h" +#include "uv-trace-source.h" +#include "sv-trace-source.h" +#include "fv-trace-source.h" +#include "array-trace-resolver.h" +#include "trace-doc.h" + +namespace ns3 { + +/** + * \brief a helper class to aggregate contained TraceResolver and other trace sources. + * \ingroup tracing + */ +class CompositeTraceResolver : public TraceResolver +{ +public: + CompositeTraceResolver (); + virtual ~CompositeTraceResolver (); + /** + * \param name name of trace source + * \param doc the documentation associated to this trace source + * \param trace a callback trace source + * \param context the context associated to this trace source + * + * Add a callback trace source in this resolver. This trace + * source will match the name specified during namespace + * resolution. The TraceContext of this trace source will also + * be automatically extended to contain the input context. + */ + template + void AddSource (std::string name, const TraceDoc &doc, + const TraceSource &trace, T const &context); + /** + * \param name name of trace source + * \param doc the documentation associated to this trace source + * \param trace a callback trace source + * + * Add a callback trace source in this resolver. This trace + * source will match the name specified during namespace + * resolution. + */ + void AddSource (std::string name, + const TraceDoc &doc, + const TraceSource &trace); + + /** + * \param name the name of the composite element + * \param composite the composite object + * + * The input composite object will be used to resolve a connection + * of a disconnection attempt if its name matches the trace path. + * + */ + void AddComposite (std::string name, Ptr composite); + + /** + * \param name the name of the composite element + * \param composite the composite object + * \param contextElement the context element associated to the composite + * + * The input composite object will be used to resolve a connection + * of a disconnection attempt if its name matches the trace path. + * The contextElement will be appended to the TraceContext during connection. + */ + template + void AddComposite (std::string name, Ptr composite, const T &contextElement); + + /** + * \param name the name of the array + * \param begin an iterator which points to the first element of the array + * \param end an iterator which points to the last element of the array + * \param index an object which can store the index of an element in the + * array. In practice, this object should support a constructor + * whose single argument is an array index. + */ + template + void AddArray (std::string name, + ITERATOR begin, ITERATOR end, INDEX index); + + /** + * \param parent the parent trace resolver + * + * The parent trace resolver is the trace resolver returned by the + * GetTraceResolver method of the base class of the caller. It is + * used during connection and disconnection to chain up the connect + * and disconnect calls to the parent. + */ + void SetParentResolver (Ptr parent); + + +private: + virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); + virtual void Disconnect (std::string path, CallbackBase const &cb); + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection); + virtual void TraceAll (std::ostream &os, const TraceContext &context); + friend class CompositeTraceResolverTest; + class ResolveItem + { + public: + virtual ~ResolveItem () {} + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) = 0; + virtual void Disconnect (std::string subpath, const CallbackBase &cb) = 0; + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) = 0; + virtual void TraceAll (std::ostream &os, const TraceContext &context) = 0; + + std::string name; + TraceContext context; + }; + typedef std::vector TraceItems; + class Operation + { + public: + virtual ~Operation () {} + virtual void Do (std::string subpath, ResolveItem *item) const = 0; + virtual void DoParent (std::string path, Ptr parent) const = 0; + }; + + void AddItem (ResolveItem *item); + void DoRecursiveOperation (std::string path, + const Operation &operation); + void DoRecursiveOperationForParent (std::string path, + const Operation &operation); + void DoAddComposite (std::string name, Ptr composite, const TraceContext &context); + void DoAddSource (std::string name, + const TraceDoc &doc, + const TraceSource &trace, + const TraceContext &context); + void Add (std::string name, + Callback > createResolver); + + + CompositeTraceResolver::TraceItems m_items; + Ptr m_parent; +}; + +}//namespace ns3 + +namespace ns3 { + + + +template +void +CompositeTraceResolver::AddSource (std::string name, + const TraceDoc &doc, + const TraceSource &trace, + T const &context) +{ + TraceContext ctx; + ctx.AddElement (context); + DoAddSource (name, doc, trace, ctx); +} + +template +void +CompositeTraceResolver::AddArray (std::string name, + ITERATOR begin, ITERATOR end, INDEX index) +{ + class ArrayResolveItem : public ResolveItem + { + public: + virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context) + {array->Connect (subpath, cb, context);} + virtual void Disconnect (std::string subpath, const CallbackBase &cb) + {array->Disconnect (subpath, cb);} + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) + { + path.append ("/"); + path.append (this->name); + TraceContext ctx = context; + ctx.Union (this->context); + array->CollectSources (path, ctx, collection); + } + virtual void TraceAll (std::ostream &os, const TraceContext &context) + { + TraceContext ctx = context; + ctx.Union (this->context); + array->TraceAll (os, ctx); + } + + Ptr > array; + } *item = new ArrayResolveItem (); + item->name = name; + item->context = TraceContext (); + item->array = Create > (); + item->array->SetIterators (begin, end); + AddItem (item); +} + +template +void +CompositeTraceResolver::AddComposite (std::string name, Ptr composite, const T &contextElement) +{ + TraceContext context; + context.AddElement (contextElement); + DoAddComposite (name, composite, context); +} + + + +}//namespace ns3 + +#endif /* COMPOSITE_TRACE_RESOLVER_H */ diff --git a/src/core/fatal-error.h b/src/core/fatal-error.h index 2c83de580..6dcf049b8 100644 --- a/src/core/fatal-error.h +++ b/src/core/fatal-error.h @@ -32,9 +32,8 @@ * * When this macro is hit at runtime, the user-specified * error message is output and the program is halted by calling - * the NS_DEBUG_BREAKPOINT macro. This macro is enabled - * unconditionally in all builds, including debug and optimized - * builds. + * the NS_BREAKPOINT macro. This macro is enabled unconditionally + * in all builds, including debug and optimized builds. */ #define NS_FATAL_ERROR(msg) \ do \ diff --git a/src/common/fv-trace-source.h b/src/core/fv-trace-source.h similarity index 82% rename from src/common/fv-trace-source.h rename to src/core/fv-trace-source.h index 2e059303b..c0f816dbb 100644 --- a/src/common/fv-trace-source.h +++ b/src/core/fv-trace-source.h @@ -23,11 +23,12 @@ #define F_VARIABLE_TRACER_H #include "callback-trace-source.h" +#include "trace-source.h" #include namespace ns3 { -class FVTraceSourceBase { +class FVTraceSourceBase : public TraceSource { public: typedef CallbackTraceSource ChangeNotifyCallback; @@ -39,12 +40,15 @@ public: ~FVTraceSourceBase () {} - void AddCallback (CallbackBase const & callback, TraceContext const & context) { + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) { m_callback.AddCallback (callback, context); } - void RemoveCallback (CallbackBase const & callback) { + virtual void RemoveCallback (CallbackBase const & callback) { m_callback.RemoveCallback (callback); } + virtual void ConnectPrinter (std::ostream &os, const TraceContext &context) { + m_callback.ConnectPrinter (os, context); + } protected: void notify (double oldVal, double newVal) { if (oldVal != newVal) diff --git a/src/core/log.cc b/src/core/log.cc new file mode 100644 index 000000000..6f5bd6acf --- /dev/null +++ b/src/core/log.cc @@ -0,0 +1,331 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006,2007 INRIA + * + * 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: Mathieu Lacage + */ + +#ifdef NS3_LOG_ENABLE + +#include +#include +#include +#include "log.h" +#include "assert.h" +#include "ns3/core-config.h" +#include "fatal-error.h" + +#ifdef HAVE_STDLIB_H +#include +#endif + +namespace ns3 { + +typedef std::list > ComponentList; +typedef std::list >::iterator ComponentListI; + +static +ComponentList *GetComponentList (void) +{ + static ComponentList components; + return &components; +} + +void +LogComponentEnableEnvVar (void) +{ + static bool isFirstLog = true; + if (!isFirstLog) + { + return; + } +#ifdef HAVE_GETENV + char *envVar = getenv("NS_LOG"); + if (envVar == 0) + { + isFirstLog = false; + return; + } + std::string env = envVar; + if (env == "print-list") + { + LogComponentPrintList (); + isFirstLog = false; + return; + } + bool allFound = true; + std::string::size_type cur = 0; + std::string::size_type next = 0; + while (true) + { + next = env.find_first_of (";", cur); + std::string tmp = std::string (env, cur, next); + { + /* The following code is a workaround for a bug in the g++ + * c++ string library. Its goal is to remove any trailing ';' + * from the string even though there should not be any in + * it. This code should be safe even if the bug is not there. + */ + std::string::size_type trailing = tmp.find_first_of (";"); + tmp = tmp.substr (0, trailing); + } + if (tmp.size () == 0) + { + break; + } + std::string::size_type equal = tmp.find ("="); + std::string component; + int level; + if (equal == std::string::npos) + { + component = tmp; + level = LOG_DEBUG; + } + else + { + component = tmp.substr (0, equal); + std::string::size_type cur_lev; + std::string::size_type next_lev = equal; + do + { + cur_lev = next_lev + 1; + next_lev = tmp.find ("|", cur_lev); + std::string lev = tmp.substr (cur_lev, next_lev - cur_lev); + if (lev == "error") + { + level |= LOG_ERROR; + } + else if (lev == "warn") + { + level |= LOG_WARN; + } + else if (lev == "debug") + { + level |= LOG_DEBUG; + } + else if (lev == "info") + { + level |= LOG_INFO; + } + else if (lev == "function") + { + level |= LOG_FUNCTION; + } + else if (lev == "param") + { + level |= LOG_PARAM; + } + else if (lev == "logic") + { + level |= LOG_LOGIC; + } + else if (lev == "all") + { + level |= LOG_ALL; + } + else if (lev == "errorlevel") + { + level |= LOG_LEVEL_ERROR; + } + else if (lev == "warnlevel") + { + level |= LOG_LEVEL_WARN; + } + else if (lev == "debuglevel") + { + level |= LOG_LEVEL_DEBUG; + } + else if (lev == "infolevel") + { + level |= LOG_LEVEL_INFO; + } + else if (lev == "functionlevel") + { + level |= LOG_LEVEL_FUNCTION; + } + else if (lev == "paramlevel") + { + level |= LOG_LEVEL_PARAM; + } + else if (lev == "logiclevel") + { + level |= LOG_LEVEL_LOGIC; + } + else if (lev == "alllevel") + { + level |= LOG_LEVEL_ALL; + } + } while (next_lev != std::string::npos); + } + bool found = false; + ComponentList *components = GetComponentList (); + for (ComponentListI i = components->begin (); + i != components->end (); + i++) + { + if (i->first.compare (component) == 0) + { + found = true; + + i->second->Enable ((enum LogLevel)level); + break; + } + } + if (!found) + { + allFound = false; + } + if (next == std::string::npos) + { + break; + } + cur = next + 1; + if (cur >= env.size ()) + { + break; + } + } + if (allFound) + { + isFirstLog = false; + } + +#endif +} + +LogComponent::LogComponent (char const * name) + : m_levels (0) +{ + ComponentList *components = GetComponentList (); + for (ComponentListI i = components->begin (); + i != components->end (); + i++) + { + NS_ASSERT (i->first != name); + } + components->push_back (std::make_pair (name, this)); +} + +bool +LogComponent::IsEnabled (enum LogLevel level) const +{ + LogComponentEnableEnvVar (); + return (level & m_levels) ? 1 : 0; +} + +bool +LogComponent::IsNoneEnabled (void) const +{ + return m_levels == 0; +} + +void +LogComponent::Enable (enum LogLevel level) +{ + m_levels |= level; +} + +void +LogComponent::Disable (enum LogLevel level) +{ + m_levels &= ~level; +} + +void +LogComponentEnable (char const *name, enum LogLevel level) +{ + ComponentList *components = GetComponentList (); + for (ComponentListI i = components->begin (); + i != components->end (); + i++) + { + if (i->first.compare (name) == 0) + { + i->second->Enable (level); + break; + } + } +} + +void +LogComponentDisable (char const *name, enum LogLevel level) +{ + ComponentList *components = GetComponentList (); + for (ComponentListI i = components->begin (); + i != components->end (); + i++) + { + if (i->first.compare (name) == 0) + { + i->second->Disable (level); + break; + } + } +} + +void +LogComponentPrintList (void) +{ + ComponentList *components = GetComponentList (); + for (ComponentListI i = components->begin (); + i != components->end (); + i++) + { + std::cout << i->first << "="; + if (i->second->IsNoneEnabled ()) + { + std::cout << "0" << std::endl; + continue; + } + if (i->second->IsEnabled (LOG_ERROR)) + { + std::cout << "error"; + } + if (i->second->IsEnabled (LOG_WARN)) + { + std::cout << "|warn"; + } + if (i->second->IsEnabled (LOG_DEBUG)) + { + std::cout << "|debug"; + } + if (i->second->IsEnabled (LOG_INFO)) + { + std::cout << "|info"; + } + if (i->second->IsEnabled (LOG_FUNCTION)) + { + std::cout << "|function"; + } + if (i->second->IsEnabled (LOG_PARAM)) + { + std::cout << "|param"; + } + if (i->second->IsEnabled (LOG_LOGIC)) + { + std::cout << "|logic"; + } + if (i->second->IsEnabled (LOG_ALL)) + { + std::cout << "|all"; + } + std::cout << std::endl; + } +} + +} // namespace ns3 + +#endif // NS3_LOG_ENABLE diff --git a/src/core/log.h b/src/core/log.h new file mode 100644 index 000000000..267419bf5 --- /dev/null +++ b/src/core/log.h @@ -0,0 +1,251 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006,2007 INRIA + * + * 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: Mathieu Lacage + */ + +#ifndef __LOG_H__ +#define __LOG_H__ + +#include +#include + +/** + * \defgroup logging Logging + * \brief Logging functions and macros + * + * LOG functionality: macros which allow developers to + * send information out on screen. All logging messages + * are disabled by default. To enable selected logging + * messages, use the ns3::LogComponentEnable + * function. + * + * Alternatively, you can use the NS_LOG + * environment variable to define a ';'-separated list of + * logging components to enable. For example, NS_LOG=a;b;c;DAFD;GH + * would enable the components 'a', 'b', 'c', 'DAFD', and, 'GH'. + * + * For each component, the "debug" log level is enabled by default + * but more components can be enabled selectively with the following + * syntax: NS_LOG='Component1=func|param|warn;Component2=error|debug' + * This example would enable the 'func', 'param', and 'warn' log + * levels for 'Component1' and the 'error' and 'debug' log levels + * for 'Component2'. + * + * The list of available log components can be printed on stdout + * with the NS_LOG=print-list syntax. + */ + +/** + * \ingroup logging + * \param name a string + * + * Define a Log component with a specific name. This macro + * should be used at the top of every file in which you want + * to use the NS_LOG macro. This macro defines a new + * "log component" which can be later selectively enabled + * or disabled with the ns3::LogComponentEnable and + * ns3::LogComponentDisable functions or with the NS_LOG + * environment variable. + */ + +#ifdef NS3_LOG_ENABLE + +#define NS_LOG_COMPONENT_DEFINE(name) \ + static ns3::LogComponent g_log = ns3::LogComponent (name) + +#else + +#define NS_LOG_COMPONENT_DEFINE(name) + +#endif + +/** + * \ingroup logging + * \param msg message to output + * + * Generate logging output in the "log component" of the + * current file. i.e., every call to NS_LOG from within + * a file implicitely generates out within the component + * defined with the NS_LOG_COMPONENT_DEFINE macro in the + * same file. + */ + +#ifdef NS3_LOG_ENABLE + +#define NS_LOG(level, msg) \ + do \ + { \ + if (g_log.IsEnabled (level)) \ + { \ + std::clog << __PRETTY_FUNCTION__ << " ==> " << \ + msg << std::endl; \ + } \ + } \ + while (false) + +#define NS_LOG_F(level) \ + do \ + { \ + if (g_log.IsEnabled (level)) \ + { \ + std::clog << __PRETTY_FUNCTION__ << std::endl;\ + } \ + } \ + while (false) + +#define NS_LOG_ERROR(msg) \ + NS_LOG(ns3::LOG_ERROR, msg) + +#define NS_LOG_WARN(msg) \ + NS_LOG(ns3::LOG_WARN, msg) + +#define NS_LOG_DEBUG(msg) \ + NS_LOG(ns3::LOG_DEBUG, msg) + +#define NS_LOG_INFO(msg) \ + NS_LOG(ns3::LOG_INFO, msg) + +#define NS_LOG_FUNCTION \ + NS_LOG_F(ns3::LOG_FUNCTION) + +#define NS_LOG_PARAM(msg) \ + NS_LOG(ns3::LOG_PARAM, msg) + +#define NS_LOG_LOGIC(msg) \ + NS_LOG(ns3::LOG_LOGIC, msg) + +#define NS_LOG_ALL(msg) \ + NS_LOG(ns3::LOG_ALL, msg) + +#define NS_LOG_UNCOND(msg) \ + do \ + { \ + std::clog << msg << std::endl; \ + } \ + while (false) + +#else + +#define NS_LOG(level, msg) +#define NS_LOG_F(level) +#define NS_LOG_ERROR(msg) +#define NS_LOG_WARN(msg) +#define NS_LOG_DEBUG(msg) +#define NS_LOG_INFO(msg) +#define NS_LOG_FUNCTION +#define NS_LOG_PARAM(msg) +#define NS_LOG_LOGIC(msg) +#define NS_LOG_ALL(msg) +#define NS_LOG_UNCOND(msg) + +#endif + +namespace ns3 { + +#ifdef NS3_LOG_ENABLE + +enum LogLevel { + LOG_ERROR = 0x0001, // serious error messages only + LOG_LEVEL_ERROR = 0x0001, + + LOG_WARN = 0x0002, // warning messages + LOG_LEVEL_WARN = 0x0003, + + LOG_DEBUG = 0x0004, // rare ad-hoc debug messages + LOG_LEVEL_DEBUG = 0x0007, + + LOG_INFO = 0x0008, // informational messages (e.g., banners) + LOG_LEVEL_INFO = 0x000f, + + LOG_FUNCTION = 0x0010, // function tracing + LOG_LEVEL_FUNCTION = 0x001f, + + LOG_PARAM = 0x0020, // parameters to functions + LOG_LEVEL_PARAM = 0x003f, + + LOG_LOGIC = 0x0040, // control flow tracing within functions + LOG_LEVEL_LOGIC = 0x007f, + + LOG_ALL = 0x4000, // print everything + LOG_LEVEL_ALL = 0x7fff +}; + +#endif + +/** + * \param name a log component name + * \ingroup logging + * + * Enable the logging output associated with that log component. + * The logging output can be later disabled with a call + * to ns3::LogComponentDisable. + */ +#ifdef NS3_LOG_ENABLE +void LogComponentEnable (char const *name, enum LogLevel level); +#else +#define LogComponentEnable(a,b) +#endif + +/** + * \param name a log component name + * \ingroup logging + * + * Disable the logging output associated with that log component. + * The logging output can be later re-enabled with a call + * to ns3::LogComponentEnable. + */ +#ifdef NS3_LOG_ENABLE +void LogComponentDisable (char const *name, enum LogLevel level); +#else +#define LogComponentDisable(a,b) +#endif + +/** + * \ingroup logging + * + * Print the list of logging messages available. + * The output of this function can be obtained by setting + * the NS_LOG environment variable to the special value + * 'print-list'. + * + * For example: NS_LOG=print-list + */ +#ifdef NS3_LOG_ENABLE +void LogComponentPrintList (void); +#else +#define LogComponentPrintList() +#endif + +#ifdef NS3_LOG_ENABLE + +class LogComponent { +public: + LogComponent (char const *name); + bool IsEnabled (enum LogLevel level) const; + bool IsNoneEnabled (void) const; + void Enable (enum LogLevel level); + void Disable (enum LogLevel level); +private: + int32_t m_levels; +}; + +#endif + +} // namespace ns3 + +#endif // __LOG_H__ diff --git a/src/core/object.cc b/src/core/object.cc index 9b4812c42..1049b6cab 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -22,8 +22,12 @@ #include "assert.h" #include "singleton.h" #include "uid-manager.h" +#include "trace-resolver.h" +#include "log.h" #include +NS_LOG_COMPONENT_DEFINE ("Object"); + namespace { class IidManager : public ns3::UidManager @@ -34,6 +38,7 @@ class IidTree public: void SetParent (uint16_t child, const uint16_t *parent); uint16_t LookupParent (uint16_t child); + private: std::vector m_parents; }; @@ -55,6 +60,68 @@ IidTree::LookupParent (uint16_t child) namespace ns3 { +class InterfaceIdTraceResolver : public TraceResolver +{ +public: + InterfaceIdTraceResolver (Ptr aggregate); + virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context); + virtual void Disconnect (std::string path, CallbackBase const &cb); + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection); + virtual void TraceAll (std::ostream &os, const TraceContext &context); +private: + Ptr ParseForInterface (std::string path); + Ptr m_aggregate; +}; + +InterfaceIdTraceResolver::InterfaceIdTraceResolver (Ptr aggregate) + : m_aggregate (aggregate) +{} +Ptr +InterfaceIdTraceResolver::ParseForInterface (std::string path) +{ + std::string element = GetElement (path); + std::string::size_type dollar_pos = element.find ("$"); + if (dollar_pos != 0) + { + return 0; + } + std::string interfaceName = element.substr (1, std::string::npos); + InterfaceId interfaceId = InterfaceId::LookupByName (interfaceName); + Ptr interface = m_aggregate->QueryInterface (interfaceId); + return interface; +} +void +InterfaceIdTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context) +{ + Ptr interface = ParseForInterface (path); + if (interface != 0) + { + interface->GetTraceResolver ()->Connect (GetSubpath (path), cb, context); + } +} +void +InterfaceIdTraceResolver::Disconnect (std::string path, CallbackBase const &cb) +{ + Ptr interface = ParseForInterface (path); + if (interface != 0) + { + interface->TraceDisconnect (GetSubpath (path), cb); + } +} +void +InterfaceIdTraceResolver::CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) +{ + m_aggregate->DoCollectSources (path, context, collection); +} +void +InterfaceIdTraceResolver::TraceAll (std::ostream &os, const TraceContext &context) +{ + m_aggregate->DoTraceAll (os, context); +} + + InterfaceId::InterfaceId (uint16_t iid) : m_iid (iid) {} @@ -72,6 +139,12 @@ InterfaceId::LookupParent (InterfaceId iid) { return Singleton::Get ()->LookupParent (iid.m_iid); } +std::string +InterfaceId::GetName (void) const +{ + std::string name = Singleton::Get ()->LookupByUid (m_iid); + return name; +} bool operator == (const InterfaceId &a, const InterfaceId &b) { @@ -109,6 +182,7 @@ Object::Object () : m_count (1), m_iid (Object::iid), m_disposed (false), + m_collecting (false), m_next (this) {} Object::~Object () @@ -118,7 +192,7 @@ Object::~Object () Ptr Object::DoQueryInterface (InterfaceId iid) const { - NS_ASSERT (Check ()); + NS_ASSERT (CheckLoose ()); const Object *currentObject = this; do { NS_ASSERT (currentObject != 0); @@ -153,14 +227,27 @@ Object::AddInterface (Ptr o) { NS_ASSERT (!m_disposed); NS_ASSERT (!o->m_disposed); - NS_ASSERT (Check ()); - NS_ASSERT (o->Check ()); + NS_ASSERT (CheckLoose ()); + NS_ASSERT (o->CheckLoose ()); Object *other = PeekPointer (o); Object *next = m_next; m_next = other->m_next; other->m_next = next; - NS_ASSERT (Check ()); - NS_ASSERT (o->Check ()); + NS_ASSERT (CheckLoose ()); + NS_ASSERT (o->CheckLoose ()); +} + +void +Object::TraceConnect (std::string path, const CallbackBase &cb) const +{ + NS_ASSERT (CheckLoose ()); + GetTraceResolver ()->Connect (path, cb, TraceContext ()); +} +void +Object::TraceDisconnect (std::string path, const CallbackBase &cb) const +{ + NS_ASSERT (CheckLoose ()); + GetTraceResolver ()->Disconnect (path, cb); } void @@ -176,12 +263,43 @@ Object::DoDispose (void) NS_ASSERT (!m_disposed); } +Ptr +Object::GetTraceResolver (void) const +{ + NS_ASSERT (CheckLoose ()); + Ptr resolver = + Create (this); + return resolver; +} + bool Object::Check (void) const { return (m_count > 0); } +/* In some cases, when an event is scheduled against a subclass of + * Object, and if no one owns a reference directly to this object, the + * object is alive, has a refcount of zero and the method ran when the + * event expires runs against the raw pointer which means that we are + * manipulating an object with a refcount of zero. So, instead we + * check the aggregate reference count. + */ +bool +Object::CheckLoose (void) const +{ + uint32_t refcount = 0; + const Object *current = this; + do + { + refcount += current->m_count; + current = current->m_next; + } + while (current != this); + + return (refcount > 0); +} + void Object::MaybeDelete (void) const { @@ -209,12 +327,77 @@ Object::MaybeDelete (void) const } while (current != end); } +void +Object::DoCollectSources (std::string path, const TraceContext &context, + TraceResolver::SourceCollection *collection) const +{ + const Object *current; + current = this; + do { + if (current->m_collecting) + { + return; + } + current = current->m_next; + } while (current != this); + + m_collecting = true; + + current = this->m_next; + while (current != this) + { + NS_ASSERT (current != 0); + NS_LOG_LOGIC ("collect current=" << current); + InterfaceId cur = current->m_iid; + while (cur != Object::iid) + { + std::string name = cur.GetName (); + std::string fullpath = path; + fullpath.append ("/$"); + fullpath.append (name); + NS_LOG_LOGIC("collect: " << fullpath); + current->GetTraceResolver ()->CollectSources (fullpath, context, collection); + cur = InterfaceId::LookupParent (cur); + } + current = current->m_next; + } + + m_collecting = false; +} +void +Object::DoTraceAll (std::ostream &os, const TraceContext &context) const +{ + const Object *current; + current = this; + do { + if (current->m_collecting) + { + return; + } + current = current->m_next; + } while (current != this); + + m_collecting = true; + + current = this->m_next; + while (current != this) + { + NS_ASSERT (current != 0); + current->GetTraceResolver ()->TraceAll (os, context); + current = current->m_next; + } + + m_collecting = false; +} + } // namespace ns3 #ifdef RUN_SELF_TESTS #include "test.h" +#include "sv-trace-source.h" +#include "composite-trace-resolver.h" namespace { @@ -226,7 +409,18 @@ public: { SetInterfaceId (BaseA::iid); } + void BaseGenerateTrace (int16_t v) + { m_source = v; } virtual void Dispose (void) {} + virtual ns3::Ptr GetTraceResolver (void) const + { + ns3::Ptr resolver = + ns3::Create (); + resolver->AddSource ("basea-x", ns3::TraceDoc ("test source"), m_source); + resolver->SetParentResolver (Object::GetTraceResolver ()); + return resolver; + } + ns3::SVTraceSource m_source; }; class DerivedA : public BaseA @@ -237,9 +431,20 @@ public: { SetInterfaceId (DerivedA::iid); } + void DerivedGenerateTrace (int16_t v) + { m_sourceDerived = v; } virtual void Dispose (void) { BaseA::Dispose (); } + virtual ns3::Ptr GetTraceResolver (void) const + { + ns3::Ptr resolver = + ns3::Create (); + resolver->AddSource ("deriveda-x", ns3::TraceDoc ("test source"), m_sourceDerived); + resolver->SetParentResolver (BaseA::GetTraceResolver ()); + return resolver; + } + ns3::SVTraceSource m_sourceDerived; }; const ns3::InterfaceId BaseA::iid = @@ -255,7 +460,18 @@ public: { SetInterfaceId (BaseB::iid); } + void BaseGenerateTrace (int16_t v) + { m_source = v; } virtual void Dispose (void) {} + virtual ns3::Ptr GetTraceResolver (void) const + { + ns3::Ptr resolver = + ns3::Create (); + resolver->AddSource ("baseb-x", ns3::TraceDoc ("test source"), m_source); + resolver->SetParentResolver (Object::GetTraceResolver ()); + return resolver; + } + ns3::SVTraceSource m_source; }; class DerivedB : public BaseB @@ -266,9 +482,20 @@ public: { SetInterfaceId (DerivedB::iid); } + void DerivedGenerateTrace (int16_t v) + { m_sourceDerived = v; } virtual void Dispose (void) { BaseB::Dispose (); } + virtual ns3::Ptr GetTraceResolver (void) const + { + ns3::Ptr resolver = + ns3::Create (); + resolver->AddSource ("derivedb-x", ns3::TraceDoc ("test source"), m_sourceDerived); + resolver->SetParentResolver (BaseB::GetTraceResolver ()); + return resolver; + } + ns3::SVTraceSource m_sourceDerived; }; const ns3::InterfaceId BaseB::iid = @@ -285,120 +512,82 @@ class ObjectTest : public Test public: ObjectTest (); virtual bool RunTests (void); +private: + void BaseATrace (const TraceContext &context, int64_t oldValue, int64_t newValue); + void DerivedATrace (const TraceContext &context, int64_t oldValue, int64_t newValue); + void BaseBTrace (const TraceContext &context, int64_t oldValue, int64_t newValue); + void DerivedBTrace (const TraceContext &context, int64_t oldValue, int64_t newValue); + + bool m_baseATrace; + bool m_derivedATrace; + bool m_baseBTrace; + bool m_derivedBTrace; }; ObjectTest::ObjectTest () : Test ("Object") {} +void +ObjectTest::BaseATrace (const TraceContext &context, int64_t oldValue, int64_t newValue) +{ + m_baseATrace = true; +} +void +ObjectTest::DerivedATrace (const TraceContext &context, int64_t oldValue, int64_t newValue) +{ + m_derivedATrace = true; +} +void +ObjectTest::BaseBTrace (const TraceContext &context, int64_t oldValue, int64_t newValue) +{ + m_baseBTrace = true; +} +void +ObjectTest::DerivedBTrace (const TraceContext &context, int64_t oldValue, int64_t newValue) +{ + m_derivedBTrace = true; +} + bool ObjectTest::RunTests (void) { - bool ok = true; + bool result = true; Ptr baseA = Create (); - if (baseA->QueryInterface (BaseA::iid) != baseA) - { - ok = false; - } - if (baseA->QueryInterface (DerivedA::iid) != 0) - { - ok = false; - } - if (baseA->QueryInterface (DerivedA::iid) != 0) - { - ok = false; - } + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (BaseA::iid), baseA); + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), 0); + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), 0); baseA = Create (10); - if (baseA->QueryInterface (BaseA::iid) != baseA) - { - ok = false; - } - if (baseA->QueryInterface (DerivedA::iid) != baseA) - { - ok = false; - } - if (baseA->QueryInterface (DerivedA::iid) == 0) - { - ok = false; - } + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (BaseA::iid), baseA); + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), baseA); + NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (DerivedA::iid), 0); baseA = Create (); Ptr baseB = Create (); Ptr baseBCopy = baseB; baseA->AddInterface (baseB); - if (baseA->QueryInterface (BaseA::iid) == 0) - { - ok = false; - } - if (baseA->QueryInterface (DerivedA::iid) != 0) - { - ok = false; - } - if (baseA->QueryInterface (BaseB::iid) == 0) - { - ok = false; - } - if (baseA->QueryInterface (DerivedB::iid) != 0) - { - ok = false; - } - if (baseB->QueryInterface (BaseB::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (DerivedB::iid) != 0) - { - ok = false; - } - if (baseB->QueryInterface (BaseA::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (DerivedA::iid) != 0) - { - ok = false; - } - if (baseBCopy->QueryInterface (BaseA::iid) == 0) - { - ok = false; - } + NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (BaseA::iid), 0); + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (BaseB::iid), 0); + NS_TEST_ASSERT_EQUAL (baseA->QueryInterface (DerivedB::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (BaseB::iid), 0); + NS_TEST_ASSERT_EQUAL (baseB->QueryInterface (DerivedB::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (BaseA::iid), 0); + NS_TEST_ASSERT_EQUAL (baseB->QueryInterface (DerivedA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface (BaseA::iid), 0); baseA = Create (1); baseB = Create (1); baseBCopy = baseB; baseA->AddInterface (baseB); - if (baseA->QueryInterface (DerivedB::iid) == 0) - { - ok = false; - } - if (baseA->QueryInterface (BaseB::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (DerivedA::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (BaseA::iid) == 0) - { - ok = false; - } - if (baseBCopy->QueryInterface (DerivedA::iid) == 0) - { - ok = false; - } - if (baseBCopy->QueryInterface (BaseA::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (DerivedB::iid) == 0) - { - ok = false; - } - if (baseB->QueryInterface (BaseB::iid) == 0) - { - ok = false; - } + NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (DerivedB::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseA->QueryInterface (BaseB::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (DerivedA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (BaseA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface (DerivedA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseBCopy->QueryInterface (BaseA::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (DerivedB::iid), 0); + NS_TEST_ASSERT_UNEQUAL (baseB->QueryInterface (BaseB::iid), 0) baseA = Create (); baseB = Create (); @@ -406,7 +595,76 @@ ObjectTest::RunTests (void) baseA = 0; baseA = baseB->QueryInterface (BaseA::iid); - return ok; + baseA = Create (); + baseA->TraceConnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + m_baseATrace = false; + baseA->BaseGenerateTrace (1); + NS_TEST_ASSERT (m_baseATrace); + baseA->TraceDisconnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + + baseB = Create (); + baseB->TraceConnect ("/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this)); + m_baseBTrace = false; + baseB->BaseGenerateTrace (2); + NS_TEST_ASSERT (m_baseBTrace); + baseB->TraceDisconnect ("/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this)); + + baseA->AddInterface (baseB); + + baseA->TraceConnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + m_baseATrace = false; + baseA->BaseGenerateTrace (3); + NS_TEST_ASSERT (m_baseATrace); + baseA->TraceDisconnect ("/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + + baseA->TraceConnect ("/$BaseB/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this)); + m_baseBTrace = false; + baseB->BaseGenerateTrace (4); + NS_TEST_ASSERT (m_baseBTrace); + baseA->TraceDisconnect ("/$BaseB/baseb-x", MakeCallback (&ObjectTest::BaseBTrace, this)); + m_baseBTrace = false; + baseB->BaseGenerateTrace (5); + NS_TEST_ASSERT (!m_baseBTrace); + + baseB->TraceConnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + m_baseATrace = false; + baseA->BaseGenerateTrace (6); + NS_TEST_ASSERT (m_baseATrace); + baseB->TraceDisconnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + + baseA->TraceConnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + m_baseATrace = false; + baseA->BaseGenerateTrace (7); + NS_TEST_ASSERT (m_baseATrace); + baseA->TraceDisconnect ("/$BaseA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + + Ptr derivedA; + derivedA = Create (1); + baseB = Create (); + derivedA->AddInterface (baseB); + baseB->TraceConnect ("/$DerivedA/deriveda-x", MakeCallback (&ObjectTest::DerivedATrace, this)); + baseB->TraceConnect ("/$DerivedA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + m_derivedATrace = false; + m_baseATrace = false; + derivedA->DerivedGenerateTrace (8); + derivedA->BaseGenerateTrace (9); + NS_TEST_ASSERT (m_derivedATrace); + NS_TEST_ASSERT (m_baseATrace); + baseB->TraceDisconnect ("/$DerivedA/deriveda-x", MakeCallback (&ObjectTest::BaseATrace, this)); + baseB->TraceDisconnect ("/$DerivedA/basea-x", MakeCallback (&ObjectTest::BaseATrace, this)); + + baseB->TraceConnect ("/$DerivedA/*", MakeCallback (&ObjectTest::DerivedATrace, this)); + m_derivedATrace = false; + derivedA->DerivedGenerateTrace (10); + NS_TEST_ASSERT (m_derivedATrace); + // here, we have connected the derived trace sink to all + // trace sources, including the base trace source. + m_derivedATrace = false; + derivedA->BaseGenerateTrace (11); + NS_TEST_ASSERT (m_derivedATrace); + baseB->TraceDisconnect ("/$DerivedA/*", MakeCallback (&ObjectTest::BaseATrace, this)); + + return result; } static ObjectTest g_interfaceObjectTests; diff --git a/src/core/object.h b/src/core/object.h index d45d7f67c..34ce9fe38 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -24,9 +24,13 @@ #include #include #include "ptr.h" +#include "trace-resolver.h" namespace ns3 { +class TraceContext; +class CallbackBase; + /** * \brief a unique identifier for an interface. * @@ -56,6 +60,11 @@ public: * id is not a valid interface id. */ static InterfaceId LookupParent (InterfaceId iid); + + /** + * \returns the name of this interface. + */ + std::string GetName (void) const; ~InterfaceId (); private: InterfaceId (uint16_t iid); @@ -131,6 +140,30 @@ public: * on one to get the other, and vice-versa. */ void AddInterface (Ptr other); + + /** + * \param path the path to match for the callback + * \param cb callback to connect + * + * Connect the input callback to all trace sources which + * match the input path. + * + */ + void TraceConnect (std::string path, const CallbackBase &cb) const; + /** + * \param path the path to match for the callback + * \param cb callback to disconnect + * + * Disconnect the input callback from all trace sources which + * match the input path. + */ + void TraceDisconnect (std::string path, const CallbackBase &cb) const; + /** + * \returns the trace resolver associated to this object. + * + * This method should be rarely called by users. + */ + virtual Ptr GetTraceResolver (void) const; protected: /** * \param iid an InterfaceId @@ -147,12 +180,18 @@ protected: */ virtual void DoDispose (void); private: + friend class InterfaceIdTraceResolver; Ptr DoQueryInterface (InterfaceId iid) const; + void DoCollectSources (std::string path, const TraceContext &context, + TraceResolver::SourceCollection *collection) const; + void DoTraceAll (std::ostream &os, const TraceContext &context) const; bool Check (void) const; + bool CheckLoose (void) const; void MaybeDelete (void) const; mutable uint32_t m_count; InterfaceId m_iid; bool m_disposed; + mutable bool m_collecting; Object *m_next; }; diff --git a/src/core/random-variable-default-value.cc b/src/core/random-variable-default-value.cc index 3217c3513..58597c545 100644 --- a/src/core/random-variable-default-value.cc +++ b/src/core/random-variable-default-value.cc @@ -19,9 +19,9 @@ * Author: Mathieu Lacage */ #include "random-variable-default-value.h" -#include "ns3/debug.h" +#include "log.h" -NS_DEBUG_COMPONENT_DEFINE ("RandomVariableDefaultValue"); +NS_LOG_COMPONENT_DEFINE ("RandomVariableDefaultValue"); namespace ns3 { @@ -75,12 +75,12 @@ RandomVariableDefaultValue::Parse (const std::string &value, double constant = ReadAsDouble (v, ok); if (mustCreate) { - NS_DEBUG ("create Constant constant=" << constant); + NS_LOG_LOGIC ("create Constant constant=" << constant); *pVariable = new ConstantVariable (constant); } else { - NS_DEBUG ("parse Constant constant=" << constant); + NS_LOG_LOGIC ("parse Constant constant=" << constant); } return ok; } @@ -99,12 +99,12 @@ RandomVariableDefaultValue::Parse (const std::string &value, maxVal = ReadAsDouble (max, ok); if (mustCreate) { - NS_DEBUG ("create Uniform min=" << min << ", max=" << max); + NS_LOG_LOGIC ("create Uniform min=" << min << ", max=" << max); *pVariable = new UniformVariable (minVal, maxVal); } else { - NS_DEBUG ("parse Uniform min=" << min << ", max=" << max); + NS_LOG_LOGIC ("parse Uniform min=" << min << ", max=" << max); } return ok; } diff --git a/src/common/stream-tracer-test.cc b/src/core/stream-tracer-test.cc similarity index 98% rename from src/common/stream-tracer-test.cc rename to src/core/stream-tracer-test.cc index f38e80dc4..f708015b6 100644 --- a/src/common/stream-tracer-test.cc +++ b/src/core/stream-tracer-test.cc @@ -19,7 +19,7 @@ * Author: Mathieu Lacage */ #include "stream-tracer.h" -#include "ns3/test.h" +#include "test.h" #include #ifdef RUN_SELF_TESTS diff --git a/src/common/stream-tracer.h b/src/core/stream-tracer.h similarity index 100% rename from src/common/stream-tracer.h rename to src/core/stream-tracer.h diff --git a/src/common/sv-trace-source.h b/src/core/sv-trace-source.h similarity index 93% rename from src/common/sv-trace-source.h rename to src/core/sv-trace-source.h index ce5511705..8cbb2447b 100644 --- a/src/common/sv-trace-source.h +++ b/src/core/sv-trace-source.h @@ -23,11 +23,12 @@ #define SV_TRACE_SOURCE_H #include "callback-trace-source.h" +#include "trace-source.h" #include namespace ns3 { -class SVTraceSourceBase { +class SVTraceSourceBase : public TraceSource { public: typedef CallbackTraceSource ChangeNotifyCallback; @@ -37,14 +38,17 @@ public: return *this; } - ~SVTraceSourceBase () {} + virtual ~SVTraceSourceBase () {} - void AddCallback (CallbackBase const & callback, TraceContext const & context) { + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) { m_callback.AddCallback (callback, context); } - void RemoveCallback (CallbackBase const & callback) { + virtual void RemoveCallback (CallbackBase const & callback) { m_callback.RemoveCallback (callback); } + virtual void ConnectPrinter (std::ostream &os, const TraceContext &context) { + m_callback.ConnectPrinter (os, context); + } protected: void Notify (int64_t oldVal, int64_t newVal) { if (oldVal != newVal) @@ -62,7 +66,7 @@ class UVTraceSource; /** * \brief trace variables of type "signed integer" - * \ingroup lowleveltracing + * \ingroup tracing * * This template class implements a POD type: it * behaves like any other variable of type "signed integer" @@ -74,7 +78,7 @@ class UVTraceSource; * ns3::UVTraceSource : \code #include - #include "ns3/sv-trace-source.h" + #include "sv-trace-source.h" ns3::SVTraceSource var; \endcode diff --git a/src/core/test.h b/src/core/test.h index 356c08ee2..809c44f0d 100644 --- a/src/core/test.h +++ b/src/core/test.h @@ -118,6 +118,23 @@ private: << ", got " << (got) << std::endl; \ result = false; \ } +/** + * Convenience macro to check that a value returned by a test is what + * is expected. Note: this macro assumes a 'bool result = true' + * declaration exists in the test function body, and that the function + * returns that value. + * + * \param got value obtained from the test + * \param expected value that the test is expected to return + */ +#define NS_TEST_ASSERT_UNEQUAL(got, expected) \ + if ((got) == (expected)) \ + { \ + Failure () << __FILE__ << ":" <<__LINE__ \ + << ": did not want " << (expected) \ + << ", got " << (got) << std::endl; \ + result = false; \ + } /** * Convenience macro to check an assertion is held during an unit * test. Note: this macro assumes a 'bool result = true' declaration diff --git a/src/common/trace-context-element.cc b/src/core/trace-context-element.cc similarity index 80% rename from src/common/trace-context-element.cc rename to src/core/trace-context-element.cc index 838250af8..dee4e97f4 100644 --- a/src/common/trace-context-element.cc +++ b/src/core/trace-context-element.cc @@ -2,6 +2,13 @@ namespace ns3 { +std::string +ElementRegistry::GetTypeName (uint16_t uid) +{ + InfoVector *vec = GetInfoVector (); + struct Info info = (*vec)[uid - 1]; + return info.getTypeName (); +} uint32_t ElementRegistry::GetSize (uint16_t uid) { diff --git a/src/common/trace-context-element.h b/src/core/trace-context-element.h similarity index 87% rename from src/common/trace-context-element.h rename to src/core/trace-context-element.h index e1c36c4d9..aba7c2598 100644 --- a/src/common/trace-context-element.h +++ b/src/core/trace-context-element.h @@ -37,6 +37,8 @@ namespace ns3 { * This method takes a c++ output stream and argument and is * expected to write an ascii string describing its content * in this output stream. + * - a public GetTypeName method which returns the fully-qualified + * c++ type name of this subclass as a string. * * A typical subclass should look like this: * \code @@ -48,6 +50,7 @@ namespace ns3 { * MyContext (); * ~MyContext (); * void Print (std::ostream &os) const; + * std::string GetTypeName (void) const; * * // the user-specific API to manipulate the context. * void SetData (uint8_t data); @@ -71,6 +74,12 @@ namespace ns3 { * { * os << "mycontext=" << (uint32_t) m_myContextData; * } + * std::string + * MyContext::GetTypeName (void) const + * { + * // return a fully-qualified c++ type name + * return "MyContext"; + * } * void * MyContext::SetData (uint8_t data) * { @@ -115,19 +124,24 @@ public: static uint32_t GetSize (uint16_t uid); static void Print (uint16_t uid, uint8_t *instance, std::ostream &os); + static std::string GetTypeName (uint16_t uid); static void Destroy (uint16_t uid, uint8_t *instance); private: + typedef std::string (*GetTypeNameCb) (void); typedef void (*PrintCb) (uint8_t *instance, std::ostream &os); typedef void (*DestroyCb) (uint8_t *instance); struct Info { uint32_t size; std::string uidString; + GetTypeNameCb getTypeName; PrintCb print; DestroyCb destroy; }; typedef std::vector InfoVector; static InfoVector *GetInfoVector (void); template + static std::string DoGetTypeName (void); + template static void DoPrint (uint8_t *instance, std::ostream &os); template static void DoDestroy (uint8_t *instance); @@ -143,6 +157,13 @@ ElementRegistry::DoPrint (uint8_t *instance, std::ostream &os) obj.Print (os); } template +std::string +ElementRegistry::DoGetTypeName (void) +{ + static T obj; + return obj.GetTypeName (); +} +template void ElementRegistry::DoDestroy (uint8_t *instance) { @@ -169,6 +190,7 @@ ElementRegistry::AllocateUid (std::string name) struct Info info; info.size = sizeof (T); info.uidString = name; + info.getTypeName = &ElementRegistry::DoGetTypeName; info.print = &ElementRegistry::DoPrint; info.destroy = &ElementRegistry::DoDestroy; vec->push_back (info); diff --git a/src/common/trace-context.cc b/src/core/trace-context.cc similarity index 65% rename from src/common/trace-context.cc rename to src/core/trace-context.cc index 50e9d0a73..af3ac2cfa 100644 --- a/src/common/trace-context.cc +++ b/src/core/trace-context.cc @@ -20,10 +20,56 @@ */ #include "trace-context.h" #include "trace-context-element.h" -#include "ns3/assert.h" +#include "assert.h" namespace ns3 { +TraceContext::Iterator::Iterator () + : m_buffer (0), + m_size (0), + m_current (0) +{} +TraceContext::Iterator::Iterator (uint8_t *buffer, uint16_t size) + : m_buffer (buffer), + m_size (size), + m_current (0) +{ + m_uid = m_buffer[m_current]; +} +bool +TraceContext::Iterator::IsLast (void) const +{ + if (m_buffer == 0 || m_uid == 0 || m_current >= m_size) + { + return true; + } + return false; +} +void +TraceContext::Iterator::Next (void) +{ + if (m_buffer == 0) + { + return; + } + if (m_uid == 0) + { + return; + } + else + { + uint8_t size = ElementRegistry::GetSize (m_uid); + m_current += 1 + size; + } + m_uid = m_buffer[m_current]; +} +std::string +TraceContext::Iterator::Get (void) const +{ + std::string name = ElementRegistry::GetTypeName (m_uid); + return name; +} + TraceContext::TraceContext () : m_data (0) {} @@ -68,7 +114,7 @@ TraceContext::~TraceContext () } void -TraceContext::Add (TraceContext const &o) +TraceContext::Union (TraceContext const &o) { if (o.m_data == 0) { @@ -230,10 +276,93 @@ TraceContext::Print (std::ostream &os) const } } while (true); } +TraceContext::Iterator +TraceContext::Begin (void) const +{ + if (m_data == 0) + { + return Iterator (); + } + return Iterator (m_data->data, m_data->size); +} + +void +TraceContext::PrintAvailable (std::ostream &os, std::string separator) const +{ + if (m_data == 0) + { + return; + } + uint8_t currentUid; + uint16_t i = 0; + do { + currentUid = m_data->data[i]; + uint8_t size = ElementRegistry::GetSize (currentUid); + os << ElementRegistry::GetTypeName (currentUid); + i += 1 + size; + if (i < m_data->size && currentUid != 0) + { + os << separator; + } + else + { + break; + } + } while (true); +} + +bool +TraceContext::IsSimilar (const TraceContext &o) const +{ + if (m_data == 0 && o.m_data == 0) + { + return true; + } + if ((m_data != 0 && o.m_data == 0) || + (m_data == 0 && o.m_data != 0)) + { + return false; + } + uint8_t myCurrentUid; + uint16_t myI = 0; + uint8_t otherCurrentUid; + uint16_t otherI = 0; + + myCurrentUid = m_data->data[myI]; + otherCurrentUid = o.m_data->data[otherI]; + + while (myCurrentUid == otherCurrentUid && + myCurrentUid != 0 && + otherCurrentUid != 0 && + myI < m_data->size && + otherI < o.m_data->size) + { + uint8_t mySize = ElementRegistry::GetSize (myCurrentUid); + uint8_t otherSize = ElementRegistry::GetSize (otherCurrentUid); + myI += 1 + mySize; + otherI += 1 + otherSize; + myCurrentUid = m_data->data[myI]; + otherCurrentUid = o.m_data->data[otherI]; + } + if (myCurrentUid == 0 && otherCurrentUid == 0) + { + return true; + } + else + { + return false; + } +} + +std::ostream& operator<< (std::ostream& os, const TraceContext &context) +{ + context.Print (os); + return os; +} }//namespace ns3 -#include "ns3/test.h" +#include "test.h" #include namespace ns3 { @@ -242,8 +371,8 @@ template class Ctx : public TraceContextElement { public: - static uint16_t GetUid (void) {static uint16_t uid = AllocateUid > (GetName ()); return uid;} - static std::string GetName (void) {std::ostringstream oss; oss << "Ctx" << N; return oss.str ();} + static uint16_t GetUid (void) {static uint16_t uid = AllocateUid > (GetTypeName ()); return uid;} + static std::string GetTypeName (void) {std::ostringstream oss; oss << "Ctx" << N; return oss.str ();} Ctx () : m_v (0) {} Ctx (int v) : m_v (v) {} void Print (std::ostream &os) {os << N;} @@ -278,31 +407,31 @@ TraceContextTest::RunTests (void) { ok = false; } - ctx.Add (v0); - ctx.Add (v0); + ctx.AddElement (v0); + ctx.AddElement (v0); if (ctx.SafeAdd (v01)) { ok = false; } - ctx.Get (v0); - ctx.Add (v1); - ctx.Get (v1); - ctx.Get (v0); - ctx.Get (v1); + ctx.GetElement (v0); + ctx.AddElement (v1); + ctx.GetElement (v1); + ctx.GetElement (v0); + ctx.GetElement (v1); TraceContext copy = ctx; - ctx.Get (v0); - ctx.Get (v1); - copy.Get (v0); - copy.Get (v1); - copy.Add (v2); - copy.Get (v0); - copy.Get (v1); - copy.Get (v2); - ctx.Add (v3); - ctx.Get (v0); - ctx.Get (v1); - ctx.Get (v3); + ctx.GetElement (v0); + ctx.GetElement (v1); + copy.GetElement (v0); + copy.GetElement (v1); + copy.AddElement (v2); + copy.GetElement (v0); + copy.GetElement (v1); + copy.GetElement (v2); + ctx.AddElement (v3); + ctx.GetElement (v0); + ctx.GetElement (v1); + ctx.GetElement (v3); if (ctx.SafeGet (v2)) { @@ -312,14 +441,14 @@ TraceContextTest::RunTests (void) { ok = false; } - ctx.Add (copy); - ctx.Get (v2); + ctx.Union (copy); + ctx.GetElement (v2); if (copy.SafeGet (v3)) { ok = false; } - copy.Add (ctx); - copy.Get (v3); + copy.Union (ctx); + copy.GetElement (v3); return ok; } diff --git a/src/common/trace-context.h b/src/core/trace-context.h similarity index 65% rename from src/common/trace-context.h rename to src/core/trace-context.h index eee3c960c..908f3ecb9 100644 --- a/src/common/trace-context.h +++ b/src/core/trace-context.h @@ -23,26 +23,28 @@ #include #include -#include "ns3/fatal-error.h" +#include "fatal-error.h" #include "trace-context-element.h" namespace ns3 { /** * \brief Provide context to trace sources - * \ingroup lowleveltracing + * \ingroup tracing * * Instances of this class are used to hold context * for each trace source. Each instance holds a list of - * 'contexts'. Trace sinks can lookup these contexts + * TraceContextElement. Trace sinks can lookup these contexts * from this list with the ns3::TraceContext::Get method. + * They can also ask the TraceContext for the list of + * TraceContextElements it contains with the PrintAvailable method. * * This class is implemented * using Copy On Write which means that copying unmodified * versions of this class is very cheap. However, modifying * the content of this class through a call - * to ns3::TraceContext::Add will trigger a costly memory - * reallocation if needed. + * to ns3::TraceContext::AddElement or ns3::TraceContext::Union + * will trigger a costly memory reallocation if needed. */ class TraceContext { @@ -54,32 +56,73 @@ public: /** * \param context add context to list of trace contexts. + * + * A copy of the input context is appended at the end of the list + * stored in this TraceContext. */ template - void Add (T const &context); + void AddElement (T const &context); /** * \param o the other context * * Perform the Union operation (in the sense of set theory) on the * two input lists of elements. This method is used in the - * ns3::CallbackTraceSourceSource class when multiple sinks are connected + * ns3::CallbackTraceSource class when multiple sinks are connected * to a single source to ensure that the source does not need * to store a single TraceContext instance per connected sink. * Instead, all sinks share the same TraceContext. */ - void Add (TraceContext const &o); + void Union (TraceContext const &o); /** * \param context context to get from this list of trace contexts. - * - * This method cannot fail. If the requested trace context is not - * stored in this TraceContext, then, the program will halt. + * \returns true if the requested trace context element was found + * in this TraceContext, false otherwise. */ template - void Get (T &context) const; + bool GetElement (T &context) const; + /** + * \param os a c++ STL output stream + * + * Iterate over the list of TraceContextElement stored in this + * TraceContext and invoke each of their Print method. + */ void Print (std::ostream &os) const; + /** + * \param os a c++ STL output stream + * \param separator the separator inserted between each TraceContextElement typename. + * + * Print the typename of each TraceContextElement stored in this TraceContext. + */ + void PrintAvailable (std::ostream &os, std::string separator) const; + class Iterator + { + public: + void Next (void); + bool IsLast (void) const; + std::string Get (void) const; + private: + friend class TraceContext; + Iterator (); + Iterator (uint8_t *buffer, uint16_t index); + uint8_t *m_buffer; + uint16_t m_size; + uint16_t m_current; + uint8_t m_uid; + }; + Iterator Begin (void) const; + /** + * \param o another trace context + * \returns true if the input trace context contains exactly the same set of + * TraceContextElement instances, false otherwise. + * + * This method does not test for equality: the content of each matching + * TraceContextElement could be different. It merely checks that both + * trace contexts contain the same types of TraceContextElements. + */ + bool IsSimilar (const TraceContext &o) const; private: friend class TraceContextTest; // used exclusively for testing code. @@ -99,13 +142,15 @@ private: } * m_data; }; +std::ostream& operator<< (std::ostream& os, const TraceContext &context); + }//namespace ns3 namespace ns3 { template void -TraceContext::Add (T const &context) +TraceContext::AddElement (T const &context) { const TraceContextElement *parent; // if the following assignment fails, it is because the input @@ -119,8 +164,8 @@ TraceContext::Add (T const &context) } } template -void -TraceContext::Get (T &context) const +bool +TraceContext::GetElement (T &context) const { TraceContextElement *parent; // if the following assignment fails, it is because the input @@ -128,10 +173,7 @@ TraceContext::Get (T &context) const parent = &context; uint8_t *data = (uint8_t *) &context; bool found = DoGet (T::GetUid (), data); - if (!found) - { - NS_FATAL_ERROR ("Type not stored in TraceContext"); - } + return found; } template bool diff --git a/src/core/trace-doc.cc b/src/core/trace-doc.cc new file mode 100644 index 000000000..b41089d10 --- /dev/null +++ b/src/core/trace-doc.cc @@ -0,0 +1,74 @@ +#include "trace-doc.h" + +namespace ns3 { + +TraceDoc::TraceDoc () + : m_help ("empty help") +{} + +TraceDoc::TraceDoc (std::string help) + : m_help (help) +{} +TraceDoc::TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help) + : m_help (help) +{ + m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); +} +TraceDoc::TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help, + std::string arg1Type, + std::string arg1Help) + : m_help (help) +{ + m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); + m_argVector.push_back (std::make_pair (arg1Type, arg1Help)); +} +TraceDoc::TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help, + std::string arg1Type, + std::string arg1Help, + std::string arg2Type, + std::string arg2Help) + : m_help (help) +{ + m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); + m_argVector.push_back (std::make_pair (arg1Type, arg1Help)); + m_argVector.push_back (std::make_pair (arg2Type, arg2Help)); +} +TraceDoc::TraceDoc (std::string help, + std::string arg0Type, + std::string arg0Help, + std::string arg1Type, + std::string arg1Help, + std::string arg2Type, + std::string arg2Help, + std::string arg3Type, + std::string arg3Help) + : m_help (help) +{ + m_argVector.push_back (std::make_pair (arg0Type, arg0Help)); + m_argVector.push_back (std::make_pair (arg1Type, arg1Help)); + m_argVector.push_back (std::make_pair (arg2Type, arg2Help)); + m_argVector.push_back (std::make_pair (arg3Type, arg3Help)); +} +std::string +TraceDoc::GetHelp (void) const +{ + return m_help; +} +TraceDoc::Iterator +TraceDoc::ArgsBegin (void) const +{ + return m_argVector.begin (); +} +TraceDoc::Iterator +TraceDoc::ArgsEnd (void) const +{ + return m_argVector.end (); +} + +} // namespace ns3 diff --git a/src/core/trace-doc.h b/src/core/trace-doc.h new file mode 100644 index 000000000..e3236826a --- /dev/null +++ b/src/core/trace-doc.h @@ -0,0 +1,103 @@ +#ifndef TRACE_DOC_H +#define TRACE_DOC_H + +#include +#include + +namespace ns3 { + +/** + * \brief describe the signature of a trace source + */ +class TraceDoc +{ + typedef std::vector > ArgVector; +public: + typedef ArgVector::const_iterator Iterator; + TraceDoc (); + /** + * \param help a description of the purpose of the trace source + */ + TraceDoc (std::string help); + /** + * \param help a description of the purpose of the trace source + * \param arg1Type the fully-qualified typename of the first argument of the trace source + * \param arg1Help the purpose of the first argument of the trace source + */ + TraceDoc (std::string help, + std::string arg1Type, + std::string arg1Help); + /** + * \param help a description of the purpose of the trace source + * \param arg1Type the fully-qualified typename of the first argument of the trace source + * \param arg1Help the purpose of the first argument of the trace source + * \param arg2Type the fully-qualified typename of the second argument of the trace source + * \param arg2Help the purpose of the second argument of the trace source + */ + TraceDoc (std::string help, + std::string arg1Type, + std::string arg1Help, + std::string arg2Type, + std::string arg2Help); + /** + * \param help a description of the purpose of the trace source + * \param arg1Type the fully-qualified typename of the first argument of the trace source + * \param arg1Help the purpose of the first argument of the trace source + * \param arg2Type the fully-qualified typename of the second argument of the trace source + * \param arg2Help the purpose of the second argument of the trace source + * \param arg3Type the fully-qualified typename of the third argument of the trace source + * \param arg3Help the purpose of the third argument of the trace source + */ + TraceDoc (std::string help, + std::string arg1Type, + std::string arg1Help, + std::string arg2Type, + std::string arg2Help, + std::string arg3Type, + std::string arg3Help); + /** + * \param help a description of the purpose of the trace source + * \param arg1Type the fully-qualified typename of the first argument of the trace source + * \param arg1Help the purpose of the first argument of the trace source + * \param arg2Type the fully-qualified typename of the second argument of the trace source + * \param arg2Help the purpose of the second argument of the trace source + * \param arg3Type the fully-qualified typename of the third argument of the trace source + * \param arg3Help the purpose of the third argument of the trace source + * \param arg4Type the fully-qualified typename of the fourth argument of the trace source + * \param arg4Help the purpose of the fourth argument of the trace source + */ + TraceDoc (std::string help, + std::string arg1Type, + std::string arg1Help, + std::string arg2Type, + std::string arg2Help, + std::string arg3Type, + std::string arg3Help, + std::string arg4Type, + std::string arg4Help); + /** + * \returns the help string associated to this trace source + */ + std::string GetHelp (void) const; + /** + * \returns an iterator which points to the first descriptor of the trace source. + * + * Each descriptor is a pair of strings. The first one describes the type of the argument + * while the second one describeds the purpose of the argument. + */ + Iterator ArgsBegin (void) const; + /** + * \returns an iterator which points to the last descriptor of the trace source. + * + * Each descriptor is a pair of strings. The first one describes the type of the argument + * while the second one describeds the purpose of the argument. + */ + Iterator ArgsEnd (void) const; +private: + ArgVector m_argVector; + std::string m_help; +}; + +} // namespace ns3 + +#endif /* TRACE_DOC_H */ diff --git a/src/core/trace-resolver.cc b/src/core/trace-resolver.cc new file mode 100644 index 000000000..6569e206d --- /dev/null +++ b/src/core/trace-resolver.cc @@ -0,0 +1,107 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * All rights reserved. + * + * 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: Mathieu Lacage + */ +#include "trace-resolver.h" +#include "log.h" + +NS_LOG_COMPONENT_DEFINE ("TraceResolver"); + +namespace ns3 { + +TraceResolver::TraceResolver () + : m_count (1) +{} + +TraceResolver::~TraceResolver () +{} + +void +TraceResolver::Ref (void) +{ + m_count++; +} +void +TraceResolver::Unref (void) +{ + m_count--; + if (m_count == 0) + { + NS_LOG_LOGIC ("delete "<path == path && + context.IsSimilar (i->context)) + { + return; + } + } + struct Source source; + source.path = path; + source.context = context; + source.doc = doc; + m_sources.push_back (source); +} +TraceResolver::SourceCollection::Iterator +TraceResolver::SourceCollection::Begin (void) const +{ + return m_sources.begin (); +} +TraceResolver::SourceCollection::Iterator +TraceResolver::SourceCollection::End (void) const +{ + return m_sources.end (); +} +}//namespace ns3 diff --git a/src/core/trace-resolver.h b/src/core/trace-resolver.h new file mode 100644 index 000000000..027beb5c1 --- /dev/null +++ b/src/core/trace-resolver.h @@ -0,0 +1,159 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * All rights reserved. + * + * 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: Mathieu Lacage + */ +#ifndef TRACE_RESOLVER_H +#define TRACE_RESOLVER_H + +#include +#include +#include "trace-context.h" +#include "trace-doc.h" + +namespace ns3 { + +class CallbackBase; + +/** + * \brief the base class which is used to recursively perform trace + * namespace resolution. + * \ingroup tracing + * + * Although users could conceivably implement their own trace resolver + * subclasses, doing so is complicated so, it is recommended to use + * the default implementation ns3::CompositeTraceResolver instead. + */ +class TraceResolver +{ +public: + + TraceResolver (); + virtual ~TraceResolver (); + void Ref (void); + void Unref (void); + + /** + * \param path the namespace path to resolver + * \param cb the callback to connect to the matching namespace + * \param context the context in which to store the trace context + * + * First, extract the leading path element from the input path, and + * match this leading patch element against any terminal trace source + * contained in this trace resolver. + * Second, recursively resolve the rest of the path using other + * objects if there are any. + * If there is any TraceContextElement associated to one of the matching + * elements, it should be added to the input TraceContext. + */ + virtual void Connect (std::string path, CallbackBase const &cb, const TraceContext &context) = 0; + /** + * \param path the namespace path to resolver + * \param cb the callback to disconnect in the matching namespace + * + * This method should behave as Connect. + */ + virtual void Disconnect (std::string path, CallbackBase const &cb) = 0; + + /** + * \brief hold a list of trace sources + */ + class SourceCollection + { + public: + /** + * \brief describe a single trace source + */ + struct Source + { + /** + * The trace path associated to this trace source + */ + std::string path; + /** + * The trace context associated to this trace source + */ + TraceContext context; + /** + * Document the signature of this trace source + */ + TraceDoc doc; + }; + typedef std::vector::const_iterator Iterator; + void AddUnique (std::string path, + const TraceContext &context, + const TraceDoc &doc); + + /** + * \returns an iterator which points to the first element of the set of + * trace sources collected in this SourceCollection object. + */ + Iterator Begin (void) const; + /** + * \returns an iterator which points to the last element of the set of + * trace sources collected in this SourceCollection object. + */ + Iterator End (void) const; + private: + typedef std::vector SourceVector; + SourceVector m_sources; + }; + /** + * \param path the path to the current recursive level. + * \param context the trace context associated to the current recursive level + * \param collection the collection in which to gather every trace source found. + * + * This method is invoked recursively until all trace sources have been + * stored in the output SourceCollection argument. + */ + virtual void CollectSources (std::string path, const TraceContext &context, + SourceCollection *collection) = 0; + + /** + * \param os the output stream to which ascii output should be written. + * \param context the context associated to the current recursive level. + * + * This method is invoked recursively until each trace source has been + * connected to a trace sink which can output an ascii representation + * of each trace event on the output stream specified. + */ + virtual void TraceAll (std::ostream &os, const TraceContext &context) = 0; +protected: + /** + * \param path a namespace path + * \returns the initial element of the path. + * + * If the input path is "/foo/...", the return + * value is "foo". + */ + std::string GetElement (std::string path); + /** + * \param path a namespace path + * \returns the subpath. + * + * If the input path is "/foo/bar/...", the return + * value is "/bar/...". + */ + std::string GetSubpath (std::string path); +private: + uint32_t m_count; +}; + +}//namespace ns3 + +#endif /* TRACE_RESOLVER_H */ diff --git a/src/common/empty-trace-resolver.cc b/src/core/trace-source.cc similarity index 80% rename from src/common/empty-trace-resolver.cc rename to src/core/trace-source.cc index 18b9e5301..64c7d8960 100644 --- a/src/common/empty-trace-resolver.cc +++ b/src/core/trace-source.cc @@ -1,7 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 @@ -18,8 +17,15 @@ * * Author: Mathieu Lacage */ -#include "empty-trace-resolver.h" +#include "trace-source.h" +#include "trace-context.h" -ns3::EmptyTraceResolver::EmptyTraceResolver (TraceContext const &context) - : TraceResolver (context) -{} +namespace ns3 { + +void +TraceSource::AddCallback (CallbackBase const & callback) +{ + AddCallback (callback, TraceContext ()); +} + +} // namespace ns3 diff --git a/src/core/trace-source.h b/src/core/trace-source.h new file mode 100644 index 000000000..9a35a80ad --- /dev/null +++ b/src/core/trace-source.h @@ -0,0 +1,61 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * All rights reserved. + * + * 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: Mathieu Lacage + */ +#ifndef TRACE_SOURCE_H +#define TRACE_SOURCE_H + +#include + +namespace ns3 { + +class CallbackBase; +class TraceContext; + +/** + * \brief the base class for all trace sources + * + * Every trace source which wishes to be connectable and disconnectable with + * the TraceResolver system should derive from this base class and implement + * all three methods below. + */ +class TraceSource +{ +public: + virtual ~TraceSource () {} + /** + * \param callback the callback to connect to this trace source + * \param context the context associated to the input callback which should be passed + * back to the user. + */ + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) = 0; + /** + * \param callback the callback to connect to this trace source + */ + void AddCallback (CallbackBase const & callback); + /** + * \param callback the callback to disconnect from this trace source + */ + virtual void RemoveCallback (CallbackBase const & callback) = 0; + virtual void ConnectPrinter (std::ostream &os, TraceContext const &context) = 0; +}; + +} // namespace ns3 + +#endif /* TRACE_SOURCE_H */ diff --git a/src/core/uid-manager.cc b/src/core/uid-manager.cc index f6aa3f6de..364ab769c 100644 --- a/src/core/uid-manager.cc +++ b/src/core/uid-manager.cc @@ -19,8 +19,8 @@ * Author: Mathieu Lacage */ #include "uid-manager.h" -#include "ns3/fatal-error.h" -#include "ns3/assert.h" +#include "fatal-error.h" +#include "assert.h" namespace ns3 { diff --git a/src/common/uv-trace-source.h b/src/core/uv-trace-source.h similarity index 93% rename from src/common/uv-trace-source.h rename to src/core/uv-trace-source.h index b83873580..0fe84c826 100644 --- a/src/common/uv-trace-source.h +++ b/src/core/uv-trace-source.h @@ -23,11 +23,12 @@ #define UV_TRACE_SOURCE_H #include "callback-trace-source.h" +#include "trace-source.h" #include namespace ns3 { -class UVTraceSourceBase { +class UVTraceSourceBase : public TraceSource { public: typedef CallbackTraceSource ChangeNotifyCallback; @@ -42,11 +43,14 @@ public: } ~UVTraceSourceBase () {} - void AddCallback (CallbackBase const & callback, TraceContext const & context) { + virtual void AddCallback (CallbackBase const & callback, TraceContext const & context) { m_callback.AddCallback (callback, context); } - void RemoveCallback (CallbackBase const & callback) { - m_callback.RemoveCallback (callback); + virtual void RemoveCallback (CallbackBase const & callback) { + m_callback.RemoveCallback (callback); + } + virtual void ConnectPrinter (std::ostream &os, const TraceContext &context) { + m_callback.ConnectPrinter (os, context); } protected: @@ -66,7 +70,7 @@ class SVTraceSource; /** * \brief trace variables of type "unsigned integer" - * \ingroup lowleveltracing + * \ingroup tracing * * This template class implements a POD type: it * behaves like any other variable of type "unsigned integer" @@ -78,7 +82,7 @@ class SVTraceSource; * ns3::UVTraceSource : \code #include - #include "ns3/uv-trace-source.h" + #include "uv-trace-source.h" ns3::UVTraceSource var; \endcode diff --git a/src/common/variable-tracer-test.cc b/src/core/variable-tracer-test.cc similarity index 98% rename from src/common/variable-tracer-test.cc rename to src/core/variable-tracer-test.cc index 29f3fc148..bd996e739 100644 --- a/src/common/variable-tracer-test.cc +++ b/src/core/variable-tracer-test.cc @@ -22,8 +22,8 @@ #include "uv-trace-source.h" #include "sv-trace-source.h" #include "trace-context.h" -#include "ns3/test.h" -#include "ns3/callback.h" +#include "test.h" +#include "callback.h" namespace ns3 { diff --git a/src/core/waf b/src/core/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/core/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/core/wscript b/src/core/wscript index bba53ae71..5806f254b 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -30,6 +30,7 @@ def build(bld): core.source = [ 'callback-test.cc', 'debug.cc', + 'log.cc', 'breakpoint.cc', 'ptr.cc', 'object.cc', @@ -42,6 +43,14 @@ def build(bld): 'type-name.cc', 'component-manager.cc', 'random-variable-default-value.cc', + 'variable-tracer-test.cc', + 'trace-context.cc', + 'trace-context-element.cc', + 'trace-resolver.cc', + 'callback-trace-source.cc', + 'composite-trace-resolver.cc', + 'trace-doc.cc', + 'trace-source.cc', ] if sys.platform == 'win32': @@ -61,6 +70,7 @@ def build(bld): 'ptr.h', 'object.h', 'debug.h', + 'log.h', 'assert.h', 'breakpoint.h', 'fatal-error.h', @@ -73,5 +83,16 @@ def build(bld): 'component-manager.h', 'type-traits.h', 'random-variable-default-value.h', + 'trace-source.h', + 'uv-trace-source.h', + 'sv-trace-source.h', + 'fv-trace-source.h', + 'callback-trace-source.h', + 'trace-context.h', + 'trace-context-element.h', + 'trace-resolver.h', + 'composite-trace-resolver.h', + 'array-trace-resolver.h', + 'trace-doc.h', ] diff --git a/src/devices/csma/csma-channel.cc b/src/devices/csma/csma-channel.cc index 9ba42d854..a46f41d6c 100644 --- a/src/devices/csma/csma-channel.cc +++ b/src/devices/csma/csma-channel.cc @@ -23,9 +23,9 @@ #include "csma-net-device.h" #include "ns3/packet.h" #include "ns3/simulator.h" -#include "ns3/debug.h" +#include "ns3/log.h" -NS_DEBUG_COMPONENT_DEFINE ("CsmaChannel"); +NS_LOG_COMPONENT_DEFINE ("CsmaChannel"); namespace ns3 { @@ -55,7 +55,7 @@ CsmaChannel::CsmaChannel() m_bps (DataRate(0xffffffff)), m_delay (Seconds(0)) { - NS_DEBUG("CsmaChannel::CsmaChannel ()"); + NS_LOG_FUNCTION; Init(); } @@ -67,8 +67,9 @@ CsmaChannel::CsmaChannel( m_bps (bps), m_delay (delay) { - NS_DEBUG("CsmaChannel::CsmaChannel (" << Channel::GetName() - << ", " << bps.GetBitRate() << ", " << delay << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << Channel::GetName() << ", " << bps.GetBitRate() << + ", " << delay << ")"); Init(); } @@ -81,8 +82,9 @@ CsmaChannel::CsmaChannel( m_bps (bps), m_delay (delay) { - NS_DEBUG("CsmaChannel::CsmaChannel (" << name << ", " << - bps.GetBitRate() << ", " << delay << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << name << ", " << bps.GetBitRate() << ", " << delay << + ")"); Init(); } @@ -94,7 +96,8 @@ void CsmaChannel::Init() { int32_t CsmaChannel::Attach(Ptr device) { - NS_DEBUG("CsmaChannel::Attach (" << device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << device << ")"); NS_ASSERT(device != 0); CsmaDeviceRec rec(device); @@ -106,7 +109,8 @@ CsmaChannel::Attach(Ptr device) bool CsmaChannel::Reattach(Ptr device) { - NS_DEBUG("CsmaChannel::Reattach (" << device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << device << ")"); NS_ASSERT(device != 0); std::vector::iterator it; @@ -131,7 +135,9 @@ CsmaChannel::Reattach(Ptr device) bool CsmaChannel::Reattach(uint32_t deviceId) { - NS_DEBUG("CsmaChannel::Reattach (" << deviceId << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << deviceId << ")"); + if (deviceId < m_deviceList.size()) { return false; @@ -151,22 +157,23 @@ CsmaChannel::Reattach(uint32_t deviceId) bool CsmaChannel::Detach(uint32_t deviceId) { - NS_DEBUG("CsmaChannel::Detach (" << deviceId << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << deviceId << ")"); if (deviceId < m_deviceList.size()) { if (!m_deviceList[deviceId].active) { - NS_DEBUG("CsmaChannel::Detach Device is already detached (" - << deviceId << ")"); + NS_LOG_WARN ("CsmaChannel::Detach Device is already detached (" << + deviceId << ")"); return false; } m_deviceList[deviceId].active = false; if ((m_state == TRANSMITTING) && (m_currentSrc == deviceId)) { - NS_DEBUG("CsmaChannel::Detach Device is currently" - << "transmitting (" << deviceId << ")"); + NS_LOG_WARN ("CsmaChannel::Detach Device is currently" << + "transmitting (" << deviceId << ")"); // Here we will need to place a warning in the packet } @@ -181,7 +188,8 @@ CsmaChannel::Detach(uint32_t deviceId) bool CsmaChannel::Detach(Ptr device) { - NS_DEBUG("CsmaChannel::Detach (" << device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << device << ")"); NS_ASSERT(device != 0); std::vector::iterator it; @@ -199,25 +207,23 @@ CsmaChannel::Detach(Ptr device) bool CsmaChannel::TransmitStart(Packet& p, uint32_t srcId) { - NS_DEBUG ("CsmaChannel::TransmitStart (" << &p << ", " << srcId - << ")"); - NS_DEBUG ("CsmaChannel::TransmitStart (): UID is " << - p.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << srcId << ")"); + NS_LOG_INFO ("UID is " << p.GetUid () << ")"); if (m_state != IDLE) { - NS_DEBUG("CsmaChannel::TransmitStart (): state is not IDLE"); + NS_LOG_WARN ("state is not IDLE"); return false; } if (!IsActive(srcId)) { - NS_DEBUG("CsmaChannel::TransmitStart (): ERROR: Seclected " - << "source is not currently attached to network"); + NS_LOG_ERROR ("Seclected source is not currently attached to network"); return false; } - NS_DEBUG("CsmaChannel::TransmitStart (): switch to TRANSMITTING"); + NS_LOG_LOGIC ("switch to TRANSMITTING"); m_currentPkt = p; m_currentSrc = srcId; m_state = TRANSMITTING; @@ -233,10 +239,9 @@ CsmaChannel::IsActive(uint32_t deviceId) bool CsmaChannel::TransmitEnd() { - NS_DEBUG("CsmaChannel::TransmitEnd (" << &m_currentPkt << ", " - << m_currentSrc << ")"); - NS_DEBUG("CsmaChannel::TransmitEnd (): UID is " << - m_currentPkt.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &m_currentPkt << ", " << m_currentSrc << ")"); + NS_LOG_INFO ("UID is " << m_currentPkt.GetUid () << ")"); NS_ASSERT(m_state == TRANSMITTING); m_state = PROPAGATING; @@ -244,13 +249,12 @@ CsmaChannel::TransmitEnd() bool retVal = true; if (!IsActive(m_currentSrc)) { - NS_DEBUG("CsmaChannel::TransmitEnd (): ERROR: Seclected source " - << "was detached before the end of the transmission"); + NS_LOG_ERROR ("Seclected source was detached before the end of the" + "transmission"); retVal = false; } - NS_DEBUG ("CsmaChannel::TransmitEnd (): Schedule event in " << - m_delay.GetSeconds () << "sec"); + NS_LOG_LOGIC ("Schedule event in " << m_delay.GetSeconds () << " sec"); Simulator::Schedule (m_delay, &CsmaChannel::PropagationCompleteEvent, @@ -261,14 +265,13 @@ CsmaChannel::TransmitEnd() void CsmaChannel::PropagationCompleteEvent() { - NS_DEBUG("CsmaChannel::PropagationCompleteEvent (" - << &m_currentPkt << ")"); - NS_DEBUG ("CsmaChannel::PropagationCompleteEvent (): UID is " << - m_currentPkt.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &m_currentPkt << ")"); + NS_LOG_INFO ("UID is " << m_currentPkt.GetUid () << ")"); NS_ASSERT(m_state == PROPAGATING); - NS_DEBUG ("CsmaChannel::PropagationCompleteEvent (): Receive"); + NS_LOG_LOGIC ("Receive"); std::vector::iterator it; for (it = m_deviceList.begin(); it < m_deviceList.end(); it++) diff --git a/src/devices/csma/csma-ipv4-topology.cc b/src/devices/csma/csma-ipv4-topology.cc index 02cd0e487..750860f4d 100644 --- a/src/devices/csma/csma-ipv4-topology.cc +++ b/src/devices/csma/csma-ipv4-topology.cc @@ -20,7 +20,6 @@ #include #include "ns3/assert.h" -#include "ns3/debug.h" #include "ns3/fatal-error.h" #include "ns3/nstime.h" #include "ns3/internet-node.h" @@ -35,82 +34,79 @@ namespace ns3 { uint32_t -CsmaIpv4Topology::AddIpv4CsmaNode(Ptr n1, - Ptr ch, - Eui48Address addr) +CsmaIpv4Topology::AddIpv4CsmaNetDevice( + Ptr node, + Ptr channel, + Mac48Address addr) { Ptr q = Queue::CreateDefault (); // assume full-duplex - Ptr nd0 = Create (n1, addr, - ns3::CsmaNetDevice::IP_ARP, - true, true); - nd0->AddQueue(q); - nd0->Attach (ch); - return nd0->GetIfIndex (); + Ptr nd = Create (node, addr, + ns3::CsmaNetDevice::IP_ARP, true, true); + + nd->AddQueue(q); + nd->Attach (channel); + return nd->GetIfIndex (); } void CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr n1, - Ptr ch, - Eui48Address addr) + Ptr ch, + Mac48Address addr) { Ptr q = Queue::CreateDefault (); Ptr nd0 = Create (n1, addr, - ns3::CsmaNetDevice::LLC, - true, false); + ns3::CsmaNetDevice::LLC, + true, false); nd0->AddQueue(q); nd0->Attach (ch); Ptr nd1 = Create (n1, addr, - ns3::CsmaNetDevice::LLC, - false, true); + ns3::CsmaNetDevice::LLC, + false, true); nd1->AddQueue(q); nd1->Attach (ch); } void CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr n1, - Ptr ch, - Eui48Address addr) + Ptr ch, + Mac48Address addr) { Ptr q = Queue::CreateDefault (); Ptr nd0 = Create (n1, addr, - ns3::CsmaNetDevice::RAW, - true, false); + ns3::CsmaNetDevice::RAW, + true, false); nd0->AddQueue(q); nd0->Attach (ch); Ptr nd1 = Create (n1, addr, - ns3::CsmaNetDevice::RAW, - false, true); + ns3::CsmaNetDevice::RAW, + false, true); nd1->AddQueue(q); nd1->Attach (ch); } -void -CsmaIpv4Topology::AddIpv4Address(Ptr n1, - int ndNum, - const Ipv4Address& addr1, - const Ipv4Mask& netmask1) +uint32_t +CsmaIpv4Topology::AddIpv4Address( + Ptr node, + uint32_t netDeviceNumber, + const Ipv4Address address, + const Ipv4Mask mask) { + Ptr nd = node->GetDevice(netDeviceNumber); - // Duplex link is assumed to be subnetted as a /30 - // May run this unnumbered in the future? - Ipv4Mask netmask(netmask1); - - Ptr nd1 = n1->GetDevice(ndNum); - - Ptr ip1 = n1->QueryInterface (Ipv4::iid); - uint32_t index1 = ip1->AddInterface (nd1); - - ip1->SetAddress (index1, addr1); - ip1->SetNetworkMask (index1, netmask); - ip1->SetUp (index1); + Ptr ipv4 = node->QueryInterface (Ipv4::iid); + uint32_t ifIndex = ipv4->AddInterface (nd); + ipv4->SetAddress (ifIndex, address); + ipv4->SetNetworkMask (ifIndex, mask); + ipv4->SetUp (ifIndex); + return ifIndex; } void @@ -133,7 +129,7 @@ CsmaIpv4Topology::AddIpv4Routes ( found = true; } } - NS_ASSERT(found); + NS_ASSERT (found); uint32_t index2 = 0; found = false; @@ -145,7 +141,7 @@ CsmaIpv4Topology::AddIpv4Routes ( found = true; } } - NS_ASSERT(found); + NS_ASSERT (found); ip1->AddHostRouteTo (ip2-> GetAddress (index2), index1); ip2->AddHostRouteTo (ip1-> GetAddress (index1), index2); diff --git a/src/devices/csma/csma-ipv4-topology.h b/src/devices/csma/csma-ipv4-topology.h index 86be99d7a..415ea6257 100644 --- a/src/devices/csma/csma-ipv4-topology.h +++ b/src/devices/csma/csma-ipv4-topology.h @@ -61,9 +61,9 @@ public: * * \return ifIndex of the device */ - static uint32_t AddIpv4CsmaNode( Ptr n1, - Ptr ch, - Eui48Address addr); + static uint32_t AddIpv4CsmaNetDevice(Ptr node, + Ptr channel, + Mac48Address addr); /** * \param n1 Node to be attached to the Csma channel @@ -76,7 +76,7 @@ public: */ static void AddIpv4RawCsmaNode( Ptr n1, Ptr ch, - Eui48Address addr); + Mac48Address addr); /** * \param n1 Node to be attached to the Csma channel @@ -89,23 +89,28 @@ public: */ static void AddIpv4LlcCsmaNode( Ptr n1, Ptr ch, - Eui48Address addr); + Mac48Address addr); /** - * \param n1 Node - * \param ndNum NetDevice number with which to associate address - * \param addr1 Ipv4 Address for ndNum of n1 - * \param netmask1 network mask for ndNum of node n1 + * \brief Create an Ipv4 interface for a net device and assign an + * Ipv4Address to that interface. + * + * \param node The node to which to add the new address and corresponding + * interface. + * \param netDeviceNumber The NetDevice index number with which to associate + * the address. + * \param address The Ipv4 Address for the interface. + * \param network The network mask for the interface * * Add an Ipv4Address to the Ipv4 interface associated with the - * ndNum CsmaIpv4NetDevices on the provided - * CsmaIpv4Channel + * ndNum CsmaIpv4NetDevices on the provided CsmaIpv4Channel */ - static void AddIpv4Address(Ptr n1, int ndNum, - const Ipv4Address& addr1, - const Ipv4Mask& netmask1); + static uint32_t AddIpv4Address(Ptr node, + uint32_t netDeviceNumber, + const Ipv4Address address, + const Ipv4Mask mask); /** * \param nd1 Node diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index 531bf7314..e4fd05a1b 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -19,9 +19,7 @@ * Author: Emmanuelle Laprise */ -#include -#include -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/queue.h" #include "ns3/simulator.h" #include "ns3/composite-trace-resolver.h" @@ -31,16 +29,22 @@ #include "ns3/ethernet-trailer.h" #include "ns3/llc-snap-header.h" -NS_DEBUG_COMPONENT_DEFINE ("CsmaNetDevice"); +NS_LOG_COMPONENT_DEFINE ("CsmaNetDevice"); namespace ns3 { CsmaTraceType::CsmaTraceType (enum Type type) : m_type (type) -{} +{ + NS_LOG_FUNCTION; +} + CsmaTraceType::CsmaTraceType () : m_type (RX) -{} +{ + NS_LOG_FUNCTION; +} + void CsmaTraceType::Print (std::ostream &os) const { @@ -53,41 +57,59 @@ CsmaTraceType::Print (std::ostream &os) const break; } } + uint16_t CsmaTraceType::GetUid (void) { + NS_LOG_FUNCTION; static uint16_t uid = AllocateUid ("CsmaTraceType"); return uid; } +std::string +CsmaTraceType::GetTypeName (void) const +{ + NS_LOG_FUNCTION; + return "ns3::CsmaTraceType"; +} + +enum CsmaTraceType::Type +CsmaTraceType::Get (void) const +{ + NS_LOG_FUNCTION; + return m_type; +} CsmaNetDevice::CsmaNetDevice (Ptr node) - : NetDevice (node, Eui48Address::Allocate ()), + : NetDevice (node, Mac48Address::Allocate ()), m_bps (DataRate (0xffffffff)) { - NS_DEBUG ("CsmaNetDevice::CsmaNetDevice (" << node << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << node << ")"); m_encapMode = IP_ARP; Init(true, true); } -CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, - CsmaEncapsulationMode encapMode) +CsmaNetDevice::CsmaNetDevice (Ptr node, Mac48Address addr, + CsmaEncapsulationMode encapMode) : NetDevice(node, addr), m_bps (DataRate (0xffffffff)) { - NS_DEBUG ("CsmaNetDevice::CsmaNetDevice (" << node << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << node << ")"); m_encapMode = encapMode; Init(true, true); } -CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, - CsmaEncapsulationMode encapMode, - bool sendEnable, bool receiveEnable) +CsmaNetDevice::CsmaNetDevice (Ptr node, Mac48Address addr, + CsmaEncapsulationMode encapMode, + bool sendEnable, bool receiveEnable) : NetDevice(node, addr), m_bps (DataRate (0xffffffff)) { - NS_DEBUG ("CsmaNetDevice::CsmaNetDevice (" << node << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << node << ")"); m_encapMode = encapMode; Init(sendEnable, receiveEnable); @@ -95,13 +117,14 @@ CsmaNetDevice::CsmaNetDevice (Ptr node, Eui48Address addr, CsmaNetDevice::~CsmaNetDevice() { - NS_DEBUG ("CsmaNetDevice::~CsmaNetDevice ()"); + NS_LOG_FUNCTION; m_queue = 0; } void CsmaNetDevice::DoDispose () { + NS_LOG_FUNCTION; m_channel = 0; NetDevice::DoDispose (); } @@ -118,7 +141,8 @@ CsmaNetDevice::DoDispose () CsmaNetDevice& CsmaNetDevice::operator= (const CsmaNetDevice nd) { - NS_DEBUG ("CsmaNetDevice::operator= (" << &nd << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &nd << ")"); return *this; } */ @@ -126,13 +150,14 @@ CsmaNetDevice::operator= (const CsmaNetDevice nd) void CsmaNetDevice::Init(bool sendEnable, bool receiveEnable) { + NS_LOG_FUNCTION; m_txMachineState = READY; m_tInterframeGap = Seconds(0); m_channel = 0; m_queue = 0; - EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); - EnableMulticast(); + EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff")); + EnableMulticast (Mac48Address ("01:00:5e:00:00:00")); SetSendEnable (sendEnable); SetReceiveEnable (receiveEnable); @@ -141,60 +166,70 @@ CsmaNetDevice::Init(bool sendEnable, bool receiveEnable) void CsmaNetDevice::SetSendEnable (bool sendEnable) { + NS_LOG_FUNCTION; m_sendEnable = sendEnable; } void CsmaNetDevice::SetReceiveEnable (bool receiveEnable) { + NS_LOG_FUNCTION; m_receiveEnable = receiveEnable; } + bool CsmaNetDevice::IsSendEnabled (void) { + NS_LOG_FUNCTION; return (m_sendEnable); } bool CsmaNetDevice::IsReceiveEnabled (void) { + NS_LOG_FUNCTION; return (m_receiveEnable); } void CsmaNetDevice::SetDataRate (DataRate bps) { + NS_LOG_FUNCTION; m_bps = bps; } void CsmaNetDevice::SetInterframeGap (Time t) { + NS_LOG_FUNCTION; m_tInterframeGap = t; } void CsmaNetDevice::SetBackoffParams (Time slotTime, uint32_t minSlots, - uint32_t maxSlots, uint32_t ceiling, - uint32_t maxRetries) + uint32_t maxSlots, uint32_t ceiling, + uint32_t maxRetries) { + NS_LOG_FUNCTION; m_backoff.m_slotTime = slotTime; m_backoff.m_minSlots = minSlots; m_backoff.m_maxSlots = maxSlots; m_backoff.m_ceiling = ceiling; m_backoff.m_maxRetries = maxRetries; } + void -CsmaNetDevice::AddHeader (Packet& p, Eui48Address dest, +CsmaNetDevice::AddHeader (Packet& p, Mac48Address dest, uint16_t protocolNumber) { + NS_LOG_FUNCTION; if (m_encapMode == RAW) { return; } EthernetHeader header (false); EthernetTrailer trailer; - Eui48Address source = Eui48Address::ConvertFrom (GetAddress ()); + Mac48Address source = Mac48Address::ConvertFrom (GetAddress ()); header.SetSource(source); header.SetDestination(dest); @@ -221,9 +256,11 @@ CsmaNetDevice::AddHeader (Packet& p, Eui48Address dest, trailer.CalcFcs(p); p.AddTrailer(trailer); } + bool CsmaNetDevice::ProcessHeader (Packet& p, uint16_t & param) { + NS_LOG_FUNCTION; if (m_encapMode == RAW) { return true; @@ -262,6 +299,7 @@ CsmaNetDevice::ProcessHeader (Packet& p, uint16_t & param) bool CsmaNetDevice::DoNeedsArp (void) const { + NS_LOG_FUNCTION; if ((m_encapMode == IP_ARP) || (m_encapMode == LLC)) { return true; @@ -278,9 +316,10 @@ CsmaNetDevice::SendTo ( const Address& dest, uint16_t protocolNumber) { + NS_LOG_FUNCTION; Packet p = packet; - NS_DEBUG ("CsmaNetDevice::SendTo (" << &p << ")"); - NS_DEBUG ("CsmaNetDevice::SendTo (): UID is " << p.GetUid () << ")"); + NS_LOG_LOGIC ("p=" << &p); + NS_LOG_LOGIC ("UID is " << p.GetUid () << ")"); NS_ASSERT (IsLinkUp ()); @@ -288,7 +327,7 @@ CsmaNetDevice::SendTo ( if (!IsSendEnabled()) return false; - Eui48Address destination = Eui48Address::ConvertFrom (dest); + Mac48Address destination = Mac48Address::ConvertFrom (dest); AddHeader(p, destination, protocolNumber); // Place the packet to be sent on the send queue @@ -313,9 +352,9 @@ CsmaNetDevice::SendTo ( void CsmaNetDevice::TransmitStart () { - NS_DEBUG ("CsmaNetDevice::TransmitStart (" << &m_currentPkt << ")"); - NS_DEBUG ("CsmaNetDevice::TransmitStart (): UID is " - << m_currentPkt.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("m_currentPkt=" << &m_currentPkt); + NS_LOG_LOGIC ("UID is " << m_currentPkt.GetUid ()); // // This function is called to start the process of transmitting a packet. // We need to tell the channel that we've started wiggling the wire and @@ -342,9 +381,8 @@ CsmaNetDevice::TransmitStart () m_backoff.IncrNumRetries(); Time backoffTime = m_backoff.GetBackoffTime(); - NS_DEBUG ("CsmaNetDevice::TransmitStart (): " - << "Channel busy, backing off for " - << backoffTime.GetSeconds () << "sec"); + NS_LOG_LOGIC ("Channel busy, backing off for " << + backoffTime.GetSeconds () << " sec"); Simulator::Schedule (backoffTime, &CsmaNetDevice::TransmitStart, @@ -357,18 +395,16 @@ CsmaNetDevice::TransmitStart () m_txMachineState = BUSY; Time tEvent = Seconds (m_bps.CalculateTxTime(m_currentPkt.GetSize())); - NS_DEBUG ("CsmaNetDevice::TransmitStart (): " << - "Schedule TransmitCompleteEvent in " << - tEvent.GetSeconds () << "sec"); + NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << + tEvent.GetSeconds () << "sec"); Simulator::Schedule (tEvent, &CsmaNetDevice::TransmitCompleteEvent, this); if (!m_channel->TransmitStart (m_currentPkt, m_deviceId)) { - NS_DEBUG ("CsmaNetDevice::TransmitStart (): " << - "Channel transmit start did not work at " << - tEvent.GetSeconds () << "sec"); + NS_LOG_WARN ("Channel transmit start did not work at " << + tEvent.GetSeconds () << "sec"); m_txMachineState = READY; } else @@ -383,10 +419,8 @@ CsmaNetDevice::TransmitStart () void CsmaNetDevice::TransmitAbort (void) { - NS_DEBUG ("CsmaNetDevice::TransmitAbort ()"); - - NS_DEBUG ("CsmaNetDevice::TransmitAbort (): Pkt UID is " << - m_currentPkt.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt.GetUid () << ")"); // Try to transmit a new packet bool found; @@ -400,7 +434,7 @@ CsmaNetDevice::TransmitAbort (void) void CsmaNetDevice::TransmitCompleteEvent (void) { - NS_DEBUG ("CsmaNetDevice::TransmitCompleteEvent ()"); + NS_LOG_FUNCTION; // // This function is called to finish the process of transmitting a packet. // We need to tell the channel that we've stopped wiggling the wire and @@ -412,13 +446,10 @@ CsmaNetDevice::TransmitCompleteEvent (void) NS_ASSERT(m_channel->GetState() == TRANSMITTING); m_txMachineState = GAP; - NS_DEBUG ("CsmaNetDevice::TransmitCompleteEvent (): Pkt UID is " << - m_currentPkt.GetUid () << ")"); + NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt.GetUid () << ")"); m_channel->TransmitEnd (); - NS_DEBUG ( - "CsmaNetDevice::TransmitCompleteEvent (): " << - "Schedule TransmitReadyEvent in " + NS_LOG_LOGIC ("Schedule TransmitReadyEvent in " << m_tInterframeGap.GetSeconds () << "sec"); Simulator::Schedule (m_tInterframeGap, @@ -429,7 +460,7 @@ CsmaNetDevice::TransmitCompleteEvent (void) void CsmaNetDevice::TransmitReadyEvent (void) { - NS_DEBUG ("CsmaNetDevice::TransmitReadyEvent ()"); + NS_LOG_FUNCTION; // // This function is called to enable the transmitter after the interframe // gap has passed. If there are pending transmissions, we use this opportunity @@ -452,26 +483,31 @@ CsmaNetDevice::TransmitReadyEvent (void) } } -TraceResolver * -CsmaNetDevice::DoCreateTraceResolver (TraceContext const &context) +Ptr +CsmaNetDevice::GetTraceResolver (void) const { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); - resolver->Add ("queue", - MakeCallback (&Queue::CreateTraceResolver, - PeekPointer (m_queue))); - resolver->Add ("rx", - m_rxTrace, - CsmaTraceType (CsmaTraceType::RX)); - resolver->Add ("drop", - m_dropTrace, - CsmaTraceType (CsmaTraceType::DROP)); - return resolver; + NS_LOG_FUNCTION; + Ptr resolver = Create (); + resolver->AddComposite ("queue", m_queue); + resolver->AddSource ("rx", + TraceDoc ("receive MAC packet", + "const Packet &", "packet received"), + m_rxTrace, + CsmaTraceType (CsmaTraceType::RX)); + resolver->AddSource ("drop", + TraceDoc ("drop MAC packet", + "const Packet &", "packet dropped"), + m_dropTrace, + CsmaTraceType (CsmaTraceType::DROP)); + resolver->SetParentResolver (NetDevice::GetTraceResolver ()); + return resolver; } bool CsmaNetDevice::Attach (Ptr ch) { - NS_DEBUG ("CsmaNetDevice::Attach (" << &ch << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &ch << ")"); m_channel = ch; @@ -489,7 +525,8 @@ CsmaNetDevice::Attach (Ptr ch) void CsmaNetDevice::AddQueue (Ptr q) { - NS_DEBUG ("CsmaNetDevice::AddQueue (" << q << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << q << ")"); m_queue = q; } @@ -497,13 +534,16 @@ CsmaNetDevice::AddQueue (Ptr q) void CsmaNetDevice::Receive (const Packet& packet) { + NS_LOG_FUNCTION; + EthernetHeader header (false); EthernetTrailer trailer; - Eui48Address broadcast; - Eui48Address destination; + Mac48Address broadcast; + Mac48Address multicast; + Mac48Address destination; Packet p = packet; - NS_DEBUG ("CsmaNetDevice::Receive UID is (" << p.GetUid() << ")"); + NS_LOG_LOGIC ("UID is " << p.GetUid()); // Only receive if send side of net device is enabled if (!IsReceiveEnabled()) @@ -522,12 +562,33 @@ CsmaNetDevice::Receive (const Packet& packet) trailer.CheckFcs(p); p.RemoveHeader(header); - broadcast = Eui48Address::ConvertFrom (GetBroadcast ()); - destination = Eui48Address::ConvertFrom (GetAddress ()); - if ((header.GetDestination() != broadcast) && - (header.GetDestination() != destination)) + NS_LOG_LOGIC ("Pkt destination is " << header.GetDestination ()); +// +// An IP host group address is mapped to an Ethernet multicast address +// by placing the low-order 23-bits of the IP address into the low-order +// 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). +// +// We are going to receive all packets destined to any multicast address, +// which means clearing the low-order 23 bits the header destination +// + Mac48Address mcDest; + uint8_t mcBuf[6]; + + header.GetDestination ().CopyTo (mcBuf); + mcBuf[3] &= 0x80; + mcBuf[4] = 0; + mcBuf[5] = 0; + mcDest.CopyFrom (mcBuf); + + multicast = Mac48Address::ConvertFrom (GetMulticast ()); + broadcast = Mac48Address::ConvertFrom (GetBroadcast ()); + destination = Mac48Address::ConvertFrom (GetAddress ()); + + if ((header.GetDestination () != broadcast) && + (mcDest != multicast) && + (header.GetDestination () != destination)) { - // not for us. + NS_LOG_LOGIC ("Dropping pkt "); m_dropTrace (p); return; } @@ -559,16 +620,71 @@ CsmaNetDevice::Receive (const Packet& packet) return; } +Address +CsmaNetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << multicastGroup << ")"); +// +// First, get the generic multicast address. +// + Address hardwareDestination = GetMulticast (); + + NS_LOG_LOGIC ("Device multicast address: " << hardwareDestination); +// +// It's our address, and we know we're playing with an EUI-48 address here +// primarily since we know that by construction, but also since the parameter +// is an Ipv4Address. +// + Mac48Address etherAddr = Mac48Address::ConvertFrom (hardwareDestination); +// +// We now have the multicast address in an abstract 48-bit container. We +// need to pull it out so we can play with it. When we're done, we have the +// high order bits in etherBuffer[0], etc. +// + uint8_t etherBuffer[6]; + etherAddr.CopyTo (etherBuffer); +// +// Now we need to pull the raw bits out of the Ipv4 destination address. +// + uint8_t ipBuffer[4]; + multicastGroup.Serialize (ipBuffer); +// +// RFC 1112 says that an Ipv4 host group address is mapped to an EUI-48 +// multicast address by placing the low-order 23-bits of the IP address into +// the low-order 23 bits of the Ethernet multicast address +// 01-00-5E-00-00-00 (hex). +// + etherBuffer[3] |= ipBuffer[1] & 0x7f; + etherBuffer[4] = ipBuffer[2]; + etherBuffer[5] = ipBuffer[3]; +// +// Now, etherBuffer has the desired ethernet multicast address. We have to +// suck these bits back into the Mac48Address, +// + etherAddr.CopyFrom (etherBuffer); +// +// Implicit conversion (operator Address ()) is defined for Mac48Address, so +// use it by just returning the EUI-48 address which is automagically converted +// to an Address. +// + NS_LOG_LOGIC ("multicast address is " << etherAddr); + + return etherAddr; +} + Ptr CsmaNetDevice::GetQueue(void) const { - return m_queue; + NS_LOG_FUNCTION; + return m_queue; } Ptr CsmaNetDevice::DoGetChannel(void) const { - return m_channel; + NS_LOG_FUNCTION; + return m_channel; } } // namespace ns3 diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 441ea04cd..bbe5259ed 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -34,13 +34,16 @@ #include "ns3/data-rate.h" #include "ns3/ptr.h" #include "ns3/random-variable.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" namespace ns3 { class Queue; class CsmaChannel; +/** + * \brief hold in a TraceContext the type of trace source from a CsmaNetDevice + */ class CsmaTraceType : public TraceContextElement { public: @@ -52,6 +55,11 @@ public: CsmaTraceType (); void Print (std::ostream &os) const; static uint16_t GetUid (void); + std::string GetTypeName (void) const; + /** + * \returns the type of the trace source which generated an event. + */ + enum Type Get (void) const; private: enum Type m_type; }; @@ -101,7 +109,7 @@ enum CsmaEncapsulationMode { * \param addr The source MAC address of the net device. * \param pktType the type of encapsulation */ - CsmaNetDevice (Ptr node, Eui48Address addr, CsmaEncapsulationMode pktType); + CsmaNetDevice (Ptr node, Mac48Address addr, CsmaEncapsulationMode pktType); /** * Construct a CsmaNetDevice @@ -116,7 +124,7 @@ enum CsmaEncapsulationMode { * \param sendEnable whether this device is able to send * \param receiveEnable whether this device is able to receive */ - CsmaNetDevice (Ptr node, Eui48Address addr, + CsmaNetDevice (Ptr node, Mac48Address addr, CsmaEncapsulationMode pktType, bool sendEnable, bool receiveEnable); /** @@ -197,6 +205,37 @@ enum CsmaEncapsulationMode { */ void Receive (const Packet& p); + /** + * @brief Make and return a MAC multicast address using the provided + * multicast group + * + * RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet + * multicast address by placing the low-order 23-bits of the IP address into + * the low-order 23 bits of the Ethernet multicast address + * 01-00-5E-00-00-00 (hex). + * + * This method performs the multicast address creation function appropriate + * to an EUI-48-based CSMA device. This MAC address is encapsulated in an + * abstract Address to avoid dependencies on the exact address format. + * + * A default imlementation of MakeMulticastAddress is provided, but this + * method simply NS_ASSERTS. In the case of net devices that do not support + * multicast, clients are expected to test NetDevice::IsMulticast and avoid + * attempting to map multicast packets. Subclasses of NetDevice that do + * support multicasting are expected to override this method and provide an + * implementation appropriate to the particular device. + * + * @param multicastGroup The IP address for the multicast group destination + * of the packet. + * @return The MAC multicast Address used to send packets to the provided + * multicast group. + * + * @see Ipv4Address + * @see Mac48Address + * @see Address + */ + Address MakeMulticastAddress (Ipv4Address multicastGroup) const; + bool IsSendEnabled (void); bool IsReceiveEnabled (void); @@ -206,6 +245,13 @@ enum CsmaEncapsulationMode { protected: virtual bool DoNeedsArp (void) const; virtual void DoDispose (void); + /** + * Create a Trace Resolver for events in the net device. + * (NOT TESTED) + * @see class TraceResolver + */ + virtual Ptr GetTraceResolver (void) const; + /** * Get a copy of the attached Queue. * @@ -233,7 +279,7 @@ protected: * \param protocolNumber In some protocols, identifies the type of * payload contained in this packet. */ - void AddHeader (Packet& p, Eui48Address dest, + void AddHeader (Packet& p, Mac48Address dest, uint16_t protocolNumber); /** * Removes, from a packet of data, all headers and trailers that @@ -321,12 +367,6 @@ private: * @see TransmitStart () */ void TransmitReadyEvent (void); - /** - * Create a Trace Resolver for events in the net device. - * (NOT TESTED) - * @see class TraceResolver - */ - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); /** * Aborts the transmission of the current packet @@ -421,8 +461,8 @@ private: * @see class CallBackTraceSource * @see class TraceResolver */ - CallbackTraceSource m_rxTrace; - CallbackTraceSource m_dropTrace; + CallbackTraceSource m_rxTrace; + CallbackTraceSource m_dropTrace; }; diff --git a/src/devices/csma/csma-topology.cc b/src/devices/csma/csma-topology.cc index 27e4e9e29..48a96ec2a 100644 --- a/src/devices/csma/csma-topology.cc +++ b/src/devices/csma/csma-topology.cc @@ -22,7 +22,6 @@ // Topology helper for Csma channels in ns3. #include "ns3/assert.h" -#include "ns3/debug.h" #include "ns3/queue.h" #include "csma-channel.h" diff --git a/src/devices/csma/waf b/src/devices/csma/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/devices/csma/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/devices/point-to-point/point-to-point-channel.cc b/src/devices/point-to-point/point-to-point-channel.cc index ae78010cf..858338fa2 100644 --- a/src/devices/point-to-point/point-to-point-channel.cc +++ b/src/devices/point-to-point/point-to-point-channel.cc @@ -23,9 +23,9 @@ #include "point-to-point-net-device.h" #include "ns3/packet.h" #include "ns3/simulator.h" -#include "ns3/debug.h" +#include "ns3/log.h" -NS_DEBUG_COMPONENT_DEFINE ("PointToPointChannel"); +NS_LOG_COMPONENT_DEFINE ("PointToPointChannel"); namespace ns3 { @@ -39,7 +39,7 @@ PointToPointChannel::PointToPointChannel() m_delay (Seconds(0)), m_nDevices(0) { - NS_DEBUG("PointToPointChannel::PointToPointChannel ()"); + NS_LOG_FUNCTION; } PointToPointChannel::PointToPointChannel( @@ -51,8 +51,9 @@ PointToPointChannel::PointToPointChannel( m_delay (delay), m_nDevices(0) { - NS_DEBUG("PointToPointChannel::PointToPointChannel (" << Channel::GetName() - << ", " << bps.GetBitRate() << ", " << delay << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << Channel::GetName() << ", " << bps.GetBitRate() << + ", " << delay << ")"); } PointToPointChannel::PointToPointChannel( @@ -65,14 +66,16 @@ PointToPointChannel::PointToPointChannel( m_delay (delay), m_nDevices(0) { - NS_DEBUG("PointToPointChannel::PointToPointChannel (" << name << ", " << - bps.GetBitRate() << ", " << delay << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << name << ", " << bps.GetBitRate() << ", " << + delay << ")"); } - void +void PointToPointChannel::Attach(Ptr device) { - NS_DEBUG("PointToPointChannel::Attach (" << device << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << device << ")"); NS_ASSERT(m_nDevices < N_DEVICES && "Only two devices permitted"); NS_ASSERT(device != 0); @@ -90,14 +93,14 @@ PointToPointChannel::Attach(Ptr device) } } -bool PointToPointChannel::TransmitStart(Packet& p, +bool +PointToPointChannel::TransmitStart(Packet& p, Ptr src, const Time& txTime) { - NS_DEBUG ("PointToPointChannel::TransmitStart (" << &p << ", " << src << - ")"); - NS_DEBUG ("PointToPointChannel::TransmitStart (): UID is " << - p.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << src << ")"); + NS_LOG_LOGIC ("UID is " << p.GetUid () << ")"); NS_ASSERT(m_link[0].m_state != INITIALIZING); NS_ASSERT(m_link[1].m_state != INITIALIZING); @@ -116,12 +119,14 @@ bool PointToPointChannel::TransmitStart(Packet& p, uint32_t PointToPointChannel::GetNDevices (void) const { + NS_LOG_FUNCTION; return m_nDevices; } Ptr PointToPointChannel::GetDevice (uint32_t i) const { + NS_LOG_FUNCTION; NS_ASSERT(i < 2); return m_link[i].m_src; } @@ -129,12 +134,14 @@ PointToPointChannel::GetDevice (uint32_t i) const const DataRate& PointToPointChannel::GetDataRate (void) { + NS_LOG_FUNCTION; return m_bps; } const Time& PointToPointChannel::GetDelay (void) { + NS_LOG_FUNCTION; return m_delay; } diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index a071f9246..ce3a253eb 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -20,18 +20,16 @@ * Revised: George Riley */ -#include -#include -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/queue.h" #include "ns3/simulator.h" #include "ns3/composite-trace-resolver.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ns3/llc-snap-header.h" #include "point-to-point-net-device.h" #include "point-to-point-channel.h" -NS_DEBUG_COMPONENT_DEFINE ("PointToPointNetDevice"); +NS_LOG_COMPONENT_DEFINE ("PointToPointNetDevice"); namespace ns3 { @@ -41,24 +39,35 @@ DataRateDefaultValue PointToPointNetDevice::g_defaultRate( DataRate ("10Mb/s")); PointToPointTraceType::PointToPointTraceType () -{} +{ + NS_LOG_FUNCTION; +} void PointToPointTraceType::Print (std::ostream &os) const { os << "dev-rx"; } + uint16_t PointToPointTraceType::GetUid (void) { + NS_LOG_FUNCTION; static uint16_t uid = AllocateUid ("PointToPointTraceType"); return uid; } +std::string +PointToPointTraceType::GetTypeName (void) const +{ + NS_LOG_FUNCTION; + return "ns3::PointToPointTraceType"; +} + PointToPointNetDevice::PointToPointNetDevice (Ptr node, const DataRate& rate) : - NetDevice(node, Eui48Address::Allocate ()), + NetDevice(node, Mac48Address::Allocate ()), m_txMachineState (READY), m_bps (rate), m_tInterframeGap (Seconds(0)), @@ -66,25 +75,31 @@ PointToPointNetDevice::PointToPointNetDevice (Ptr node, m_queue (0), m_rxTrace () { - NS_DEBUG ("PointToPointNetDevice::PointToPointNetDevice (" << node << ")"); - - // BUGBUG FIXME - // - // You _must_ support broadcast to get any sort of packet from the ARP layer. - EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff")); - EnableMulticast(); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << node << ")"); +// +// XXX BUGBUG +// +// You _must_ support broadcast to get any sort of packet from the ARP layer. +// + EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff")); +// +// We want to allow multicast packets to flow across this link +// + EnableMulticast (Mac48Address ("01:00:5e:00:00:00")); EnablePointToPoint(); } PointToPointNetDevice::~PointToPointNetDevice() { - NS_DEBUG ("PointToPointNetDevice::~PointToPointNetDevice ()"); + NS_LOG_FUNCTION; m_queue = 0; } void PointToPointNetDevice::AddHeader(Packet& p, uint16_t protocolNumber) { + NS_LOG_FUNCTION; LlcSnapHeader llc; llc.SetType (protocolNumber); p.AddHeader (llc); @@ -93,6 +108,7 @@ PointToPointNetDevice::AddHeader(Packet& p, uint16_t protocolNumber) bool PointToPointNetDevice::ProcessHeader(Packet& p, uint16_t& param) { + NS_LOG_FUNCTION; LlcSnapHeader llc; p.RemoveHeader (llc); @@ -103,26 +119,30 @@ PointToPointNetDevice::ProcessHeader(Packet& p, uint16_t& param) void PointToPointNetDevice::DoDispose() { + NS_LOG_FUNCTION; m_channel = 0; NetDevice::DoDispose (); } void PointToPointNetDevice::SetDataRate(const DataRate& bps) { + NS_LOG_FUNCTION; m_bps = bps; } void PointToPointNetDevice::SetInterframeGap(const Time& t) { + NS_LOG_FUNCTION; m_tInterframeGap = t; } bool PointToPointNetDevice::SendTo (const Packet& packet, const Address& dest, uint16_t protocolNumber) { + NS_LOG_FUNCTION; Packet p = packet; - NS_DEBUG ("PointToPointNetDevice::SendTo (" << &p << ", " << &dest << ")"); - NS_DEBUG ("PointToPointNetDevice::SendTo (): UID is " << p.GetUid () << ")"); + NS_LOG_LOGIC ("p=" << &p << ", dest=" << &dest); + NS_LOG_LOGIC ("UID is " << p.GetUid ()); // GFR Comment. Why is this an assertion? Can't a link legitimately // "go down" during the simulation? Shouldn't we just wait for it @@ -136,9 +156,12 @@ bool PointToPointNetDevice::SendTo (const Packet& packet, const Address& dest, // // // If there's a transmission in progress, we enque the packet for later -// trnsmission; otherwise we send it now. +// transmission; otherwise we send it now. if (m_txMachineState == READY) { +// We still enqueue and dequeue it to hit the tracing hooks + m_queue->Enqueue (p); + m_queue->Dequeue (p); return TransmitStart (p); } else @@ -150,9 +173,9 @@ bool PointToPointNetDevice::SendTo (const Packet& packet, const Address& dest, bool PointToPointNetDevice::TransmitStart (Packet &p) { - NS_DEBUG ("PointToPointNetDevice::TransmitStart (" << &p << ")"); - NS_DEBUG ( - "PointToPointNetDevice::TransmitStart (): UID is " << p.GetUid () << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); + NS_LOG_LOGIC ("UID is " << p.GetUid () << ")"); // // This function is called to start the process of transmitting a packet. // We need to tell the channel that we've started wiggling the wire and @@ -163,8 +186,7 @@ PointToPointNetDevice::TransmitStart (Packet &p) Time txTime = Seconds (m_bps.CalculateTxTime(p.GetSize())); Time txCompleteTime = txTime + m_tInterframeGap; - NS_DEBUG ("PointToPointNetDevice::TransmitStart (): " << - "Schedule TransmitCompleteEvent in " << + NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << txCompleteTime.GetSeconds () << "sec"); // Schedule the tx complete event Simulator::Schedule (txCompleteTime, @@ -175,7 +197,7 @@ PointToPointNetDevice::TransmitStart (Packet &p) void PointToPointNetDevice::TransmitComplete (void) { - NS_DEBUG ("PointToPointNetDevice::TransmitCompleteEvent ()"); + NS_LOG_FUNCTION; // // This function is called to finish the process of transmitting a packet. // We need to tell the channel that we've stopped wiggling the wire and @@ -189,21 +211,26 @@ void PointToPointNetDevice::TransmitComplete (void) TransmitStart(p); } -TraceResolver* PointToPointNetDevice::DoCreateTraceResolver ( - TraceContext const &context) +Ptr +PointToPointNetDevice::GetTraceResolver (void) const { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); - resolver->Add ("queue", - MakeCallback (&Queue::CreateTraceResolver, PeekPointer (m_queue))); - resolver->Add ("rx", - m_rxTrace, - PointToPointTraceType ()); + NS_LOG_FUNCTION; + Ptr resolver = Create (); + resolver->AddComposite ("queue", m_queue); + resolver->AddSource ("rx", + TraceDoc ("receive MAC packet", + "const Packet &", "packet received"), + m_rxTrace, + PointToPointTraceType ()); + resolver->SetParentResolver (NetDevice::GetTraceResolver ()); return resolver; } -bool PointToPointNetDevice::Attach (Ptr ch) +bool +PointToPointNetDevice::Attach (Ptr ch) { - NS_DEBUG ("PointToPointNetDevice::Attach (" << &ch << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &ch << ")"); m_channel = ch; @@ -211,6 +238,8 @@ bool PointToPointNetDevice::Attach (Ptr ch) m_bps = m_channel->GetDataRate (); // GFR Comment. Below is definitely wrong. Interframe gap // is unrelated to channel delay. + // -- unlesss you want to introduce a default gap which is there to avoid + // parts of multiple packets flowing on the "wire" at the same time. //m_tInterframeGap = m_channel->GetDelay (); /* @@ -227,14 +256,16 @@ bool PointToPointNetDevice::Attach (Ptr ch) void PointToPointNetDevice::AddQueue (Ptr q) { - NS_DEBUG ("PointToPointNetDevice::AddQueue (" << q << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << q << ")"); m_queue = q; } void PointToPointNetDevice::Receive (Packet& p) { - NS_DEBUG ("PointToPointNetDevice::Receive (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); uint16_t protocol = 0; Packet packet = p; @@ -245,16 +276,19 @@ void PointToPointNetDevice::Receive (Packet& p) Ptr PointToPointNetDevice::GetQueue(void) const { - return m_queue; + NS_LOG_FUNCTION; + return m_queue; } Ptr PointToPointNetDevice::DoGetChannel(void) const { - return m_channel; + NS_LOG_FUNCTION; + return m_channel; } bool PointToPointNetDevice::DoNeedsArp (void) const { + NS_LOG_FUNCTION; return false; } diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index d8d8d3242..a5868bea4 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -38,12 +38,16 @@ namespace ns3 { class Queue; class PointToPointChannel; +/** + * \brief hold in a TraceContext the type of trace source from a PointToPointNetDevice + */ class PointToPointTraceType : public TraceContextElement { public: PointToPointTraceType (); void Print (std::ostream &os) const; static uint16_t GetUid (void); + std::string GetTypeName (void) const; }; /** @@ -152,6 +156,12 @@ public: */ void Receive (Packet& p); protected: + /** + * Create a Trace Resolver for events in the net device. + * + * @see class TraceResolver + */ + virtual Ptr GetTraceResolver (void) const; virtual void DoDispose (void); /** * Get a copy of the attached Queue. @@ -237,12 +247,6 @@ private: * */ void TransmitComplete(void); - /** - * Create a Trace Resolver for events in the net device. - * - * @see class TraceResolver - */ - virtual TraceResolver* DoCreateTraceResolver (TraceContext const &context); virtual bool DoNeedsArp (void) const; /** * Enumeration of the states of the transmit machine of the net device. @@ -290,7 +294,7 @@ private: * @see class CallBackTraceSource * @see class TraceResolver */ - CallbackTraceSource m_rxTrace; + CallbackTraceSource m_rxTrace; /** * Default data rate. Used for all newly created p2p net devices */ diff --git a/src/devices/point-to-point/point-to-point-topology.cc b/src/devices/point-to-point/point-to-point-topology.cc index 5a9558419..4c99eaf88 100644 --- a/src/devices/point-to-point/point-to-point-topology.cc +++ b/src/devices/point-to-point/point-to-point-topology.cc @@ -24,7 +24,7 @@ #include #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/fatal-error.h" #include "ns3/nstime.h" #include "ns3/internet-node.h" diff --git a/src/devices/point-to-point/waf b/src/devices/point-to-point/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/devices/point-to-point/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/internet-node/arp-cache.cc b/src/internet-node/arp-cache.cc index b4987daef..15a1d9316 100644 --- a/src/internet-node/arp-cache.cc +++ b/src/internet-node/arp-cache.cc @@ -19,16 +19,16 @@ * Author: Mathieu Lacage */ #include "ns3/assert.h" - #include "ns3/packet.h" #include "ns3/simulator.h" #include "arp-cache.h" #include "arp-header.h" +#include "ipv4-interface.h" namespace ns3 { -ArpCache::ArpCache (Ptr device, Ipv4Interface *interface) +ArpCache::ArpCache (Ptr device, Ptr interface) : m_device (device), m_interface (interface), m_aliveTimeout (Seconds (120)), @@ -47,7 +47,7 @@ ArpCache::GetDevice (void) const return m_device; } -Ipv4Interface * +Ptr ArpCache::GetInterface (void) const { return m_interface; diff --git a/src/internet-node/arp-cache.h b/src/internet-node/arp-cache.h index 2cd88c85f..adf106009 100644 --- a/src/internet-node/arp-cache.h +++ b/src/internet-node/arp-cache.h @@ -48,7 +48,7 @@ public: * \param device The hardware NetDevice associated with this ARP chache * \param interface the Ipv4Interface associated with this ARP chache */ - ArpCache (Ptr device, Ipv4Interface *interface); + ArpCache (Ptr device, Ptr interface); ~ArpCache (); /** * \return The NetDevice that this ARP cache is associated with @@ -57,7 +57,7 @@ public: /** * \return the Ipv4Interface that this ARP cache is associated with */ - Ipv4Interface *GetInterface (void) const; + Ptr GetInterface (void) const; void SetAliveTimeout (Time aliveTimeout); void SetDeadTimeout (Time deadTimeout); @@ -152,7 +152,7 @@ private: typedef sgi::hash_map::iterator CacheI; Ptr m_device; - Ipv4Interface *m_interface; + Ptr m_interface; Time m_aliveTimeout; Time m_deadTimeout; Time m_waitReplyTimeout; diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index efe767531..8d80c5711 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -21,7 +21,7 @@ */ #include "ns3/packet.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/composite-trace-resolver.h" #include "ns3/node.h" #include "ns3/net-device.h" @@ -31,56 +31,85 @@ #include "ipv4-l3-protocol.h" #include "arp-l3-protocol.h" +NS_LOG_COMPONENT_DEFINE ("ArpIpv4Interface"); + namespace ns3 { ArpIpv4Interface::ArpIpv4Interface (Ptr node, Ptr device) : Ipv4Interface (device), m_node (node) -{} -ArpIpv4Interface::~ArpIpv4Interface () -{} - -TraceResolver * -ArpIpv4Interface::DoCreateTraceResolver (TraceContext const &context) { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + NS_LOG_FUNCTION; +} + +ArpIpv4Interface::~ArpIpv4Interface () +{ + NS_LOG_FUNCTION; +} + +Ptr +ArpIpv4Interface::GetTraceResolver (void) const +{ + NS_LOG_FUNCTION; + Ptr resolver = Create (); if (GetDevice () != 0) { - resolver->Add ("netdevice", - MakeCallback (&NetDevice::CreateTraceResolver, PeekPointer (GetDevice ()))); + resolver->AddComposite ("netdevice", GetDevice ()); } - + resolver->SetParentResolver (Ipv4Interface::GetTraceResolver ()); return resolver; } void ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << dest << ")"); + NS_ASSERT (GetDevice () != 0); if (GetDevice ()->NeedsArp ()) { - Ptr arp = m_node->QueryInterface (ArpL3Protocol::iid); + NS_LOG_LOGIC ("Needs ARP"); + Ptr arp = + m_node->QueryInterface (ArpL3Protocol::iid); Address hardwareDestination; bool found; - - if (dest.IsBroadcast ()) + + if (dest.IsBroadcast () || + dest.IsSubnetDirectedBroadcast (GetNetworkMask ()) ) { + NS_LOG_LOGIC ("IsBroadcast"); hardwareDestination = GetDevice ()->GetBroadcast (); found = true; } + else if (dest.IsMulticast ()) + { + NS_LOG_LOGIC ("IsMulticast"); + NS_ASSERT_MSG(GetDevice ()->IsMulticast (), + "ArpIpv4Interface::SendTo (): Sending multicast packet over " + "non-multicast device"); + + hardwareDestination = GetDevice ()->MakeMulticastAddress(dest); + found = true; + } else { + NS_LOG_LOGIC ("ARP Lookup"); found = arp->Lookup (p, dest, GetDevice (), &hardwareDestination); } if (found) { - GetDevice ()->Send (p, hardwareDestination, Ipv4L3Protocol::PROT_NUMBER); + NS_LOG_LOGIC ("Address Resolved. Send."); + GetDevice ()->Send (p, hardwareDestination, + Ipv4L3Protocol::PROT_NUMBER); } } else { - GetDevice ()->Send (p, GetDevice ()->GetBroadcast (), Ipv4L3Protocol::PROT_NUMBER); + NS_LOG_LOGIC ("Doesn't need ARP"); + GetDevice ()->Send (p, GetDevice ()->GetBroadcast (), + Ipv4L3Protocol::PROT_NUMBER); } } diff --git a/src/internet-node/arp-ipv4-interface.h b/src/internet-node/arp-ipv4-interface.h index 7df522e01..c5d36a29f 100644 --- a/src/internet-node/arp-ipv4-interface.h +++ b/src/internet-node/arp-ipv4-interface.h @@ -42,9 +42,10 @@ class ArpIpv4Interface : public Ipv4Interface ArpIpv4Interface (Ptr node, Ptr device); virtual ~ArpIpv4Interface (); - private: +protected: + virtual Ptr GetTraceResolver (void) const; +private: virtual void SendTo (Packet p, Ipv4Address dest); - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); Ptr m_node; }; diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index 100f1df88..e32e07fde 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -19,8 +19,7 @@ * Author: Mathieu Lacage */ #include "ns3/packet.h" -#include "ns3/debug.h" -#include "ns3/empty-trace-resolver.h" +#include "ns3/log.h" #include "ns3/node.h" #include "ns3/net-device.h" @@ -30,7 +29,7 @@ #include "arp-cache.h" #include "ipv4-interface.h" -NS_DEBUG_COMPONENT_DEFINE ("ArpL3Protocol"); +NS_LOG_COMPONENT_DEFINE ("ArpL3Protocol"); namespace ns3 { @@ -40,15 +39,19 @@ const uint16_t ArpL3Protocol::PROT_NUMBER = 0x0806; ArpL3Protocol::ArpL3Protocol (Ptr node) : m_node (node) { + NS_LOG_FUNCTION; SetInterfaceId (ArpL3Protocol::iid); } ArpL3Protocol::~ArpL3Protocol () -{} +{ + NS_LOG_FUNCTION; +} void ArpL3Protocol::DoDispose (void) { + NS_LOG_FUNCTION; for (CacheList::const_iterator i = m_cacheList.begin (); i != m_cacheList.end (); i++) { delete *i; @@ -58,15 +61,10 @@ ArpL3Protocol::DoDispose (void) Object::DoDispose (); } -TraceResolver * -ArpL3Protocol::CreateTraceResolver (TraceContext const &context) -{ - return new EmptyTraceResolver (context); -} - ArpCache * ArpL3Protocol::FindCache (Ptr device) { + NS_LOG_FUNCTION; for (CacheList::const_iterator i = m_cacheList.begin (); i != m_cacheList.end (); i++) { if ((*i)->GetDevice () == device) @@ -75,7 +73,7 @@ ArpL3Protocol::FindCache (Ptr device) } } Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); - Ipv4Interface *interface = ipv4->FindInterfaceForDevice (device); + Ptr interface = ipv4->FindInterfaceForDevice (device); ArpCache * cache = new ArpCache (device, interface); NS_ASSERT (device->IsBroadcast ()); device->SetLinkChangeCallback (MakeCallback (&ArpCache::Flush, cache)); @@ -86,12 +84,13 @@ ArpL3Protocol::FindCache (Ptr device) void ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol, const Address &from) { + NS_LOG_FUNCTION; ArpCache *cache = FindCache (device); ArpHeader arp; Packet packet = p; packet.RemoveHeader (arp); - NS_DEBUG ("ARP: received "<< (arp.IsRequest ()? "request" : "reply") << + NS_LOG_LOGIC ("ARP: received "<< (arp.IsRequest ()? "request" : "reply") << " node="<GetId ()<<", got request from " << arp.GetSourceIpv4Address () << " for address " << arp.GetDestinationIpv4Address () << "; we have address " << @@ -100,7 +99,7 @@ ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol if (arp.IsRequest () && arp.GetDestinationIpv4Address () == cache->GetInterface ()->GetAddress ()) { - NS_DEBUG ("node="<GetId () <<", got request from " << + NS_LOG_LOGIC ("node="<GetId () <<", got request from " << arp.GetSourceIpv4Address () << " -- send reply"); SendArpReply (cache, arp.GetSourceIpv4Address (), arp.GetSourceHardwareAddress ()); @@ -115,7 +114,7 @@ ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol { if (entry->IsWaitReply ()) { - NS_DEBUG ("node="<GetId ()<<", got reply from " << + NS_LOG_LOGIC ("node="<GetId ()<<", got reply from " << arp.GetSourceIpv4Address () << " for waiting entry -- flush"); Address from_mac = arp.GetSourceHardwareAddress (); @@ -126,7 +125,7 @@ ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol { // ignore this reply which might well be an attempt // at poisening my arp cache. - NS_DEBUG ("node="<GetId ()<<", got reply from " << + NS_LOG_LOGIC("node="<GetId ()<<", got reply from " << arp.GetSourceIpv4Address () << " for non-waiting entry -- drop"); // XXX report packet as dropped. @@ -134,13 +133,13 @@ ArpL3Protocol::Receive(Ptr device, const Packet& p, uint16_t protocol } else { - NS_DEBUG ("node="<GetId ()<<", got reply for unknown entry -- drop"); + NS_LOG_LOGIC ("node="<GetId ()<<", got reply for unknown entry -- drop"); // XXX report packet as dropped. } } else { - NS_DEBUG ("node="<GetId ()<<", got request from " << + NS_LOG_LOGIC ("node="<GetId ()<<", got request from " << arp.GetSourceIpv4Address () << " for unknown address " << arp.GetDestinationIpv4Address () << " -- drop"); } @@ -150,6 +149,7 @@ ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, Ptr device, Address *hardwareDestination) { + NS_LOG_FUNCTION; ArpCache *cache = FindCache (device); ArpCache::Entry *entry = cache->Lookup (destination); if (entry != 0) @@ -158,21 +158,21 @@ ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, { if (entry->IsDead ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", dead entry for " << destination << " expired -- send arp request"); entry->MarkWaitReply (packet); SendArpRequest (cache, destination); } else if (entry->IsAlive ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", alive entry for " << destination << " expired -- send arp request"); entry->MarkWaitReply (packet); SendArpRequest (cache, destination); } else if (entry->IsWaitReply ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", wait reply for " << destination << " expired -- drop"); entry->MarkDead (); // XXX report packet as 'dropped' @@ -182,20 +182,20 @@ ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, { if (entry->IsDead ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", dead entry for " << destination << " valid -- drop"); // XXX report packet as 'dropped' } else if (entry->IsAlive ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", alive entry for " << destination << " valid -- send"); *hardwareDestination = entry->GetMacAddress (); return true; } else if (entry->IsWaitReply ()) { - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", wait reply for " << destination << " valid -- drop previous"); Packet old = entry->UpdateWaitReply (packet); // XXX report 'old' packet as 'dropped' @@ -206,7 +206,7 @@ ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, else { // This is our first attempt to transmit data to this destination. - NS_DEBUG ("node="<GetId ()<< + NS_LOG_LOGIC ("node="<GetId ()<< ", no entry for " << destination << " -- send arp request"); entry = cache->Add (destination); entry->MarkWaitReply (packet); @@ -218,8 +218,9 @@ ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, void ArpL3Protocol::SendArpRequest (ArpCache const *cache, Ipv4Address to) { + NS_LOG_FUNCTION; ArpHeader arp; - NS_DEBUG ("ARP: sending request from node "<GetId ()<< + NS_LOG_LOGIC ("ARP: sending request from node "<GetId ()<< " || src: " << cache->GetDevice ()->GetAddress () << " / " << cache->GetInterface ()->GetAddress () << " || dst: " << cache->GetDevice ()->GetBroadcast () << @@ -236,8 +237,9 @@ ArpL3Protocol::SendArpRequest (ArpCache const *cache, Ipv4Address to) void ArpL3Protocol::SendArpReply (ArpCache const *cache, Ipv4Address toIp, Address toMac) { + NS_LOG_FUNCTION; ArpHeader arp; - NS_DEBUG ("ARP: sending reply from node "<GetId ()<< + NS_LOG_LOGIC ("ARP: sending reply from node "<GetId ()<< "|| src: " << cache->GetDevice ()->GetAddress () << " / " << cache->GetInterface ()->GetAddress () << " || dst: " << toMac << " / " << toIp); diff --git a/src/internet-node/arp-l3-protocol.h b/src/internet-node/arp-l3-protocol.h index a2ea8227e..5f6819df6 100644 --- a/src/internet-node/arp-l3-protocol.h +++ b/src/internet-node/arp-l3-protocol.h @@ -48,8 +48,6 @@ public: */ ArpL3Protocol (Ptr node); virtual ~ArpL3Protocol (); - - virtual TraceResolver *CreateTraceResolver (TraceContext const &context); /** * \brief Recieve a packet */ diff --git a/src/internet-node/ascii-trace.cc b/src/internet-node/ascii-trace.cc index 0331bb5fd..6c4d11c87 100644 --- a/src/internet-node/ascii-trace.cc +++ b/src/internet-node/ascii-trace.cc @@ -21,9 +21,9 @@ #include "ascii-trace.h" #include "ns3/trace-context.h" -#include "ns3/trace-root.h" #include "ns3/simulator.h" #include "ns3/node.h" +#include "ns3/node-list.h" #include "ns3/packet.h" #include "ns3/queue.h" @@ -41,19 +41,19 @@ void AsciiTrace::TraceAllQueues (void) { Packet::EnableMetadata (); - TraceRoot::Connect ("/nodes/*/devices/*/queue/enqueue", + NodeList::Connect ("/nodes/*/devices/*/queue/enqueue", MakeCallback (&AsciiTrace::LogDevQueueEnqueue, this)); - TraceRoot::Connect ("/nodes/*/devices/*/queue/dequeue", + NodeList::Connect ("/nodes/*/devices/*/queue/dequeue", MakeCallback (&AsciiTrace::LogDevQueueDequeue, this)); - TraceRoot::Connect ("/nodes/*/devices/*/queue/drop", + NodeList::Connect ("/nodes/*/devices/*/queue/drop", MakeCallback (&AsciiTrace::LogDevQueueDrop, this)); } void AsciiTrace::TraceAllNetDeviceRx (void) { Packet::EnableMetadata (); - TraceRoot::Connect ("/nodes/*/devices/*/rx", - MakeCallback (&AsciiTrace::LogDevRx, this)); + NodeList::Connect ("/nodes/*/devices/*/rx", + MakeCallback (&AsciiTrace::LogDevRx, this)); } void @@ -92,7 +92,7 @@ AsciiTrace::LogDevQueueDrop (TraceContext const &context, m_os << std::endl; } void -AsciiTrace::LogDevRx (TraceContext const &context, Packet &p) +AsciiTrace::LogDevRx (TraceContext const &context, const Packet &p) { m_os << "r " << Simulator::Now ().GetSeconds () << " "; context.Print (m_os); diff --git a/src/internet-node/ascii-trace.h b/src/internet-node/ascii-trace.h index e219afc41..084f82830 100644 --- a/src/internet-node/ascii-trace.h +++ b/src/internet-node/ascii-trace.h @@ -40,7 +40,7 @@ private: void LogDevQueueEnqueue (TraceContext const &context, const Packet &p); void LogDevQueueDequeue (TraceContext const &context, const Packet &p); void LogDevQueueDrop (TraceContext const &context, const Packet &p); - void LogDevRx (TraceContext const &context, Packet &p); + void LogDevRx (TraceContext const &context, const Packet &p); std::ofstream m_os; }; diff --git a/src/internet-node/internet-node.cc b/src/internet-node/internet-node.cc index 5c2a3de72..5a927b55f 100644 --- a/src/internet-node/internet-node.cc +++ b/src/internet-node/internet-node.cc @@ -74,13 +74,14 @@ InternetNode::Construct (void) Object::AddInterface (ipv4L4Demux); } -void -InternetNode::DoFillTraceResolver (CompositeTraceResolver &resolver) +Ptr +InternetNode::GetTraceResolver () const { - Node::DoFillTraceResolver (resolver); + Ptr resolver = Create (); Ptr ipv4 = QueryInterface (Ipv4L3Protocol::iid); - resolver.Add ("ipv4", - MakeCallback (&Ipv4L3Protocol::CreateTraceResolver, PeekPointer (ipv4))); + resolver->AddComposite ("ipv4", ipv4); + resolver->SetParentResolver (Node::GetTraceResolver ()); + return resolver; } void diff --git a/src/internet-node/internet-node.h b/src/internet-node/internet-node.h index deabd20eb..0c855029e 100644 --- a/src/internet-node/internet-node.h +++ b/src/internet-node/internet-node.h @@ -42,8 +42,8 @@ public: protected: virtual void DoDispose(void); + virtual Ptr GetTraceResolver (void) const; private: - virtual void DoFillTraceResolver (CompositeTraceResolver &resolver); bool ReceiveFromDevice (Ptr device, const Packet &p, uint16_t protocolNumber) const; void Construct (void); }; diff --git a/src/internet-node/ipv4-end-point-demux.cc b/src/internet-node/ipv4-end-point-demux.cc index 6d310e133..8ad8c6a3f 100644 --- a/src/internet-node/ipv4-end-point-demux.cc +++ b/src/internet-node/ipv4-end-point-demux.cc @@ -21,18 +21,21 @@ #include "ipv4-end-point-demux.h" #include "ipv4-end-point.h" -#include "ns3/debug.h" +#include "ns3/log.h" namespace ns3{ -NS_DEBUG_COMPONENT_DEFINE ("Ipv4EndPointDemux"); +NS_LOG_COMPONENT_DEFINE ("Ipv4EndPointDemux"); Ipv4EndPointDemux::Ipv4EndPointDemux () - : m_ephemeral (1025) -{} + : m_ephemeral (49152) +{ + NS_LOG_FUNCTION; +} Ipv4EndPointDemux::~Ipv4EndPointDemux () { + NS_LOG_FUNCTION; for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { Ipv4EndPoint *endPoint = *i; @@ -44,6 +47,7 @@ Ipv4EndPointDemux::~Ipv4EndPointDemux () bool Ipv4EndPointDemux::LookupPortLocal (uint16_t port) { + NS_LOG_FUNCTION; for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { if ((*i)->GetLocalPort () == port) @@ -57,6 +61,7 @@ Ipv4EndPointDemux::LookupPortLocal (uint16_t port) bool Ipv4EndPointDemux::LookupLocal (Ipv4Address addr, uint16_t port) { + NS_LOG_FUNCTION; for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { if ((*i)->GetLocalPort () == port && @@ -71,48 +76,56 @@ Ipv4EndPointDemux::LookupLocal (Ipv4Address addr, uint16_t port) Ipv4EndPoint * Ipv4EndPointDemux::Allocate (void) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate ()"); + NS_LOG_FUNCTION; uint16_t port = AllocateEphemeralPort (); if (port == 0) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate ephemeral port allocation failed."); + NS_LOG_WARN ("Ephemeral port allocation failed."); return 0; } Ipv4EndPoint *endPoint = new Ipv4EndPoint (Ipv4Address::GetAny (), port); m_endPoints.push_back (endPoint); + NS_LOG_DEBUG ("Now have >>" << m_endPoints.size () << "<< endpoints."); return endPoint; } + Ipv4EndPoint * Ipv4EndPointDemux::Allocate (Ipv4Address address) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate (address=" << address << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << this << ", " << address << ")"); uint16_t port = AllocateEphemeralPort (); if (port == 0) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate ephemeral port allocation failed."); + NS_LOG_WARN ("Ephemeral port allocation failed."); return 0; } Ipv4EndPoint *endPoint = new Ipv4EndPoint (address, port); m_endPoints.push_back (endPoint); + NS_LOG_DEBUG ("Now have >>" << m_endPoints.size () << "<< endpoints."); return endPoint; } + Ipv4EndPoint * Ipv4EndPointDemux::Allocate (uint16_t port) { + NS_LOG_FUNCTION; return Allocate (Ipv4Address::GetAny (), port); } + Ipv4EndPoint * Ipv4EndPointDemux::Allocate (Ipv4Address address, uint16_t port) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate (address=" << address - << ", port=" << port << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << this << ", " << address << ", " << port << ")"); if (LookupLocal (address, port)) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate duplicate address/port; failing."); + NS_LOG_WARN ("Duplicate address/port; failing."); return 0; } Ipv4EndPoint *endPoint = new Ipv4EndPoint (address, port); m_endPoints.push_back (endPoint); + NS_LOG_DEBUG ("Now have >>" << m_endPoints.size () << "<< endpoints."); return endPoint; } @@ -120,10 +133,11 @@ Ipv4EndPoint * Ipv4EndPointDemux::Allocate (Ipv4Address localAddress, uint16_t localPort, Ipv4Address peerAddress, uint16_t peerPort) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate (localAddress=" << localAddress - << ", localPort=" << localPort - << ", peerAddress=" << peerAddress - << ", peerPort=" << peerPort << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(localAddress=" << localAddress + << ", localPort=" << localPort + << ", peerAddress=" << peerAddress + << ", peerPort=" << peerPort << ")"); for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { if ((*i)->GetLocalPort () == localPort && @@ -131,7 +145,7 @@ Ipv4EndPointDemux::Allocate (Ipv4Address localAddress, uint16_t localPort, (*i)->GetPeerPort () == peerPort && (*i)->GetPeerAddress () == peerAddress) { - NS_DEBUG ("Ipv4EndPointDemux::Allocate: no way we can allocate this end-point."); + NS_LOG_WARN ("No way we can allocate this end-point."); /* no way we can allocate this end-point. */ return 0; } @@ -139,12 +153,16 @@ Ipv4EndPointDemux::Allocate (Ipv4Address localAddress, uint16_t localPort, Ipv4EndPoint *endPoint = new Ipv4EndPoint (localAddress, localPort); endPoint->SetPeer (peerAddress, peerPort); m_endPoints.push_back (endPoint); + + NS_LOG_DEBUG ("Now have >>" << m_endPoints.size () << "<< endpoints."); + return endPoint; } void Ipv4EndPointDemux::DeAllocate (Ipv4EndPoint *endPoint) { + NS_LOG_FUNCTION; for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { if (*i == endPoint) @@ -156,7 +174,6 @@ Ipv4EndPointDemux::DeAllocate (Ipv4EndPoint *endPoint) } } - /* * If we have an exact match, we return it. * Otherwise, if we find a generic match, we return it. @@ -164,42 +181,49 @@ Ipv4EndPointDemux::DeAllocate (Ipv4EndPoint *endPoint) */ Ipv4EndPointDemux::EndPoints Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, - Ipv4Address saddr, uint16_t sport) + Ipv4Address saddr, uint16_t sport, + Ptr incomingInterface) { + NS_LOG_FUNCTION; uint32_t genericity = 3; Ipv4EndPoint *generic = 0; EndPoints retval; - NS_DEBUG ("Ipv4EndPointDemux::Lookup (daddr=" << daddr << ", dport=" << dport - << ", saddr=" << saddr << ", sport=" << sport - << ")"); + NS_LOG_PARAM ("(daddr=" << daddr << ", dport=" << dport + << ", saddr=" << saddr << ", sport=" << sport << ")"); + for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { - NS_DEBUG ("Ipv4EndPointDemux::Lookup against " << - (*i)->GetLocalAddress () - << ":" << - (*i)->GetLocalPort () - << " " << - (*i)->GetPeerAddress () - << ":" - << (*i)->GetPeerPort ()); + NS_LOG_DEBUG ("Looking at endpoint dport=" << (*i)->GetLocalPort () + << " daddr=" << (*i)->GetLocalAddress () + << " sport=" << (*i)->GetPeerPort () + << " saddr=" << (*i)->GetPeerAddress ()); if ((*i)->GetLocalPort () != dport) { + NS_LOG_LOGIC ("Skipping endpoint " << &(*i) + << " because endpoint dport " + << (*i)->GetLocalPort () + << " does not match packet dport " << dport); continue; } - NS_DEBUG ("Ipv4EndPointDemux::Lookup local address matches: " - << bool ((*i)->GetLocalAddress () == daddr || daddr.IsBroadcast ())); - NS_DEBUG ("Ipv4EndPointDemux::Lookup peer port matches: " - << bool ((*i)->GetPeerPort () == sport || sport == 0)); - NS_DEBUG ("Ipv4EndPointDemux::Lookup peer address matches: " - << bool ((*i)->GetPeerAddress () == saddr || - (*i)->GetPeerAddress () == Ipv4Address::GetAny ())); + bool isBroadcast = + (daddr.IsBroadcast () || + daddr.IsSubnetDirectedBroadcast (incomingInterface->GetNetworkMask ())); + NS_LOG_DEBUG ("dest addr " << daddr << " broadcast? " << isBroadcast); + + NS_LOG_LOGIC ("Local address matches: " << + bool ((*i)->GetLocalAddress () == daddr || isBroadcast)); + NS_LOG_LOGIC ("Peer port matches: " << + bool ((*i)->GetPeerPort () == sport || (*i)->GetPeerPort () == 0)); + NS_LOG_LOGIC ("Peer address matches: " << + bool ((*i)->GetPeerAddress () == saddr || + (*i)->GetPeerAddress () == Ipv4Address::GetAny ())); - if ( ((*i)->GetLocalAddress () == daddr || daddr.IsBroadcast ()) + if ( ((*i)->GetLocalAddress () == daddr || isBroadcast) && ((*i)->GetPeerPort () == sport || (*i)->GetPeerPort () == 0) && ((*i)->GetPeerAddress () == saddr || (*i)->GetPeerAddress () == Ipv4Address::GetAny ())) { - NS_DEBUG ("Ipv4EndPointDemux::Lookup MATCH"); + NS_LOG_LOGIC ("MATCH"); /* this is an exact match. */ retval.push_back (*i); } @@ -228,13 +252,14 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, uint16_t Ipv4EndPointDemux::AllocateEphemeralPort (void) { + NS_LOG_FUNCTION; uint16_t port = m_ephemeral; do { port++; - if (port > 5000) + if (port == 65535) { - port = 1024; + port = 49152; } if (!LookupPortLocal (port)) { diff --git a/src/internet-node/ipv4-end-point-demux.h b/src/internet-node/ipv4-end-point-demux.h index e45a6267b..5ffff86bd 100644 --- a/src/internet-node/ipv4-end-point-demux.h +++ b/src/internet-node/ipv4-end-point-demux.h @@ -25,6 +25,7 @@ #include #include #include "ns3/ipv4-address.h" +#include "ipv4-interface.h" namespace ns3 { @@ -43,7 +44,8 @@ public: EndPoints Lookup (Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, - uint16_t sport); + uint16_t sport, + Ptr incomingInterface); Ipv4EndPoint *Allocate (void); Ipv4EndPoint *Allocate (Ipv4Address address); diff --git a/src/internet-node/ipv4-end-point.cc b/src/internet-node/ipv4-end-point.cc index 69faf523e..42cb45e37 100644 --- a/src/internet-node/ipv4-end-point.cc +++ b/src/internet-node/ipv4-end-point.cc @@ -42,6 +42,13 @@ Ipv4EndPoint::GetLocalAddress (void) { return m_localAddr; } + +void +Ipv4EndPoint::SetLocalAddress (Ipv4Address address) +{ + m_localAddr = address; +} + uint16_t Ipv4EndPoint::GetLocalPort (void) { diff --git a/src/internet-node/ipv4-end-point.h b/src/internet-node/ipv4-end-point.h index f606aa63b..dfd0e6c57 100644 --- a/src/internet-node/ipv4-end-point.h +++ b/src/internet-node/ipv4-end-point.h @@ -37,6 +37,7 @@ public: ~Ipv4EndPoint (); Ipv4Address GetLocalAddress (void); + void SetLocalAddress (Ipv4Address address); uint16_t GetLocalPort (void); Ipv4Address GetPeerAddress (void); uint16_t GetPeerPort (void); diff --git a/src/internet-node/ipv4-header.cc b/src/internet-node/ipv4-header.cc index 83750632d..2fd8fc059 100644 --- a/src/internet-node/ipv4-header.cc +++ b/src/internet-node/ipv4-header.cc @@ -20,11 +20,11 @@ */ #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/header.h" #include "ipv4-header.h" -NS_DEBUG_COMPONENT_DEFINE ("Ipv4Header"); +NS_LOG_COMPONENT_DEFINE ("Ipv4Header"); namespace ns3 { @@ -271,7 +271,7 @@ Ipv4Header::Serialize (Buffer::Iterator start) const uint8_t *data = start.PeekData (); uint16_t checksum = UtilsChecksumCalculate (0, data, GetSize ()); checksum = UtilsChecksumComplete (checksum); - NS_DEBUG ("checksum=" < nd) : m_netdevice (nd), m_ifup(false) -{} +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &nd << ")"); +} Ipv4Interface::~Ipv4Interface () -{} +{ + NS_LOG_FUNCTION; +} + +void +Ipv4Interface::DoDispose (void) +{ + NS_LOG_FUNCTION; + m_netdevice = 0; + Object::DoDispose (); +} Ptr Ipv4Interface::GetDevice (void) const { + NS_LOG_FUNCTION; return m_netdevice; } -TraceResolver * -Ipv4Interface::CreateTraceResolver (TraceContext const &context) -{ - return DoCreateTraceResolver (context); -} - void Ipv4Interface::SetAddress (Ipv4Address a) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << a << ")"); m_address = a; } + void Ipv4Interface::SetNetworkMask (Ipv4Mask mask) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << mask << ")"); m_netmask = mask; } Ipv4Address Ipv4Interface::GetBroadcast (void) const { + NS_LOG_FUNCTION; uint32_t mask = m_netmask.GetHostOrder (); uint32_t address = m_address.GetHostOrder (); Ipv4Address broadcast = Ipv4Address (address | (~mask)); return broadcast; } + Ipv4Mask Ipv4Interface::GetNetworkMask (void) const { + NS_LOG_FUNCTION; return m_netmask; } + Ipv4Address Ipv4Interface::GetAddress (void) const { + NS_LOG_FUNCTION; return m_address; } uint16_t Ipv4Interface::GetMtu (void) const { + NS_LOG_FUNCTION; if (m_netdevice == 0) { uint32_t mtu = (1<<16) - 1; @@ -92,32 +115,36 @@ Ipv4Interface::GetMtu (void) const return m_netdevice->GetMtu (); } - /** - * These are IP interface states and may be distinct from - * NetDevice states, such as found in real implementations - * (where the device may be down but IP interface state is still up). - */ +/** + * These are IP interface states and may be distinct from + * NetDevice states, such as found in real implementations + * (where the device may be down but IP interface state is still up). + */ bool Ipv4Interface::IsUp (void) const { + NS_LOG_FUNCTION; return m_ifup; } bool Ipv4Interface::IsDown (void) const { + NS_LOG_FUNCTION; return !m_ifup; } void Ipv4Interface::SetUp (void) { + NS_LOG_FUNCTION; m_ifup = true; } void Ipv4Interface::SetDown (void) { + NS_LOG_FUNCTION; m_ifup = false; } @@ -125,7 +152,9 @@ Ipv4Interface::SetDown (void) void Ipv4Interface::Send(Packet p, Ipv4Address dest) { + NS_LOG_FUNCTION; if (IsUp()) { + NS_LOG_LOGIC ("SendTo"); SendTo(p, dest); } } diff --git a/src/internet-node/ipv4-interface.h b/src/internet-node/ipv4-interface.h index 1098c567c..1836aa3b7 100644 --- a/src/internet-node/ipv4-interface.h +++ b/src/internet-node/ipv4-interface.h @@ -26,6 +26,7 @@ #include #include "ns3/ipv4-address.h" #include "ns3/ptr.h" +#include "ns3/object.h" namespace ns3 { @@ -60,9 +61,8 @@ class TraceContext; * * Subclasses must implement the two methods: * - Ipv4Interface::SendTo - * - Ipv4Interface::DoCreateTraceResolver */ -class Ipv4Interface +class Ipv4Interface : public Object { public: /** @@ -73,17 +73,6 @@ public: Ipv4Interface (Ptr nd); virtual ~Ipv4Interface(); - /** - * \param context the trace context to use to construct the - * TraceResolver to return - * \returns a TraceResolver which can resolve all traces - * performed in this object. The caller must - * delete the returned object. - * - * This method will delegate the work to the private DoCreateTraceResolver - * method which is supposed to be implemented by subclasses. - */ - TraceResolver *CreateTraceResolver (TraceContext const &context); /** * \returns the underlying NetDevice. This method can return * zero if this interface has no associated NetDevice. @@ -150,10 +139,10 @@ public: */ void Send(Packet p, Ipv4Address dest); - - private: +protected: + virtual void DoDispose (void); +private: virtual void SendTo (Packet p, Ipv4Address dest) = 0; - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context) = 0; Ptr m_netdevice; bool m_ifup; Ipv4Address m_address; diff --git a/src/internet-node/ipv4-l3-protocol.cc b/src/internet-node/ipv4-l3-protocol.cc index be483dfa0..4691b977a 100644 --- a/src/internet-node/ipv4-l3-protocol.cc +++ b/src/internet-node/ipv4-l3-protocol.cc @@ -20,9 +20,8 @@ // #include "ns3/packet.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/composite-trace-resolver.h" -#include "ns3/array-trace-resolver.h" #include "ns3/callback.h" #include "ns3/ipv4-address.h" #include "ns3/ipv4-route.h" @@ -37,7 +36,7 @@ #include "arp-ipv4-interface.h" #include "ipv4-l4-demux.h" -NS_DEBUG_COMPONENT_DEFINE ("Ipv4L3Protocol"); +NS_LOG_COMPONENT_DEFINE ("Ipv4L3Protocol"); namespace ns3 { @@ -46,28 +45,41 @@ const uint16_t Ipv4L3Protocol::PROT_NUMBER = 0x0800; Ipv4L3ProtocolTraceContextElement::Ipv4L3ProtocolTraceContextElement () : m_type (TX) -{} +{ + NS_LOG_FUNCTION; +} + Ipv4L3ProtocolTraceContextElement::Ipv4L3ProtocolTraceContextElement (enum Type type) : m_type (type) -{} +{ + NS_LOG_FUNCTION; +} + bool Ipv4L3ProtocolTraceContextElement::IsTx (void) const { + NS_LOG_FUNCTION; return m_type == TX; } + bool Ipv4L3ProtocolTraceContextElement::IsRx (void) const { + NS_LOG_FUNCTION; return m_type == RX; } + bool Ipv4L3ProtocolTraceContextElement::IsDrop (void) const { + NS_LOG_FUNCTION; return m_type == DROP; } + void Ipv4L3ProtocolTraceContextElement::Print (std::ostream &os) const { + NS_LOG_FUNCTION; os << "ipv4="; switch (m_type) { @@ -82,37 +94,62 @@ Ipv4L3ProtocolTraceContextElement::Print (std::ostream &os) const break; } } + uint16_t Ipv4L3ProtocolTraceContextElement::GetUid (void) { + NS_LOG_FUNCTION; static uint16_t uid = AllocateUid ("Ipv4L3ProtocolTraceContextElement"); return uid; } - -Ipv4l3ProtocolInterfaceIndex::Ipv4l3ProtocolInterfaceIndex () - : m_index (0) -{} -Ipv4l3ProtocolInterfaceIndex::Ipv4l3ProtocolInterfaceIndex (uint32_t index) - : m_index (index) -{} -uint32_t -Ipv4l3ProtocolInterfaceIndex::Get (void) const +std::string +Ipv4L3ProtocolTraceContextElement::GetTypeName (void) const { + NS_LOG_FUNCTION; + return "ns3::Ipv4L3ProtocolTraceContextElement"; +} + +Ipv4L3ProtocolInterfaceIndex::Ipv4L3ProtocolInterfaceIndex () + : m_index (0) +{ + NS_LOG_FUNCTION; +} + +Ipv4L3ProtocolInterfaceIndex::Ipv4L3ProtocolInterfaceIndex (uint32_t index) + : m_index (index) +{ + NS_LOG_FUNCTION; +} + +uint32_t +Ipv4L3ProtocolInterfaceIndex::Get (void) const +{ + NS_LOG_FUNCTION; return m_index; } + void -Ipv4l3ProtocolInterfaceIndex::Print (std::ostream &os) const +Ipv4L3ProtocolInterfaceIndex::Print (std::ostream &os) const { os << "ipv4-interface=" << m_index; } + uint16_t -Ipv4l3ProtocolInterfaceIndex::GetUid (void) +Ipv4L3ProtocolInterfaceIndex::GetUid (void) { - static uint16_t uid = AllocateUid ("Ipv4l3ProtocolInterfaceIndex"); + NS_LOG_FUNCTION; + static uint16_t uid = AllocateUid ("Ipv4L3ProtocolInterfaceIndex"); return uid; } +std::string +Ipv4L3ProtocolInterfaceIndex::GetTypeName (void) const +{ + NS_LOG_FUNCTION; + return "ns3::Ipv4L3ProtocolInterfaceIndex"; +} + Ipv4L3Protocol::Ipv4L3Protocol(Ptr node) : m_nInterfaces (0), @@ -120,21 +157,22 @@ Ipv4L3Protocol::Ipv4L3Protocol(Ptr node) m_identification (0), m_node (node) { + NS_LOG_FUNCTION; SetInterfaceId (Ipv4L3Protocol::iid); m_staticRouting = Create (); AddRoutingProtocol (m_staticRouting, 0); SetupLoopback (); } + Ipv4L3Protocol::~Ipv4L3Protocol () -{} +{ + NS_LOG_FUNCTION; +} void Ipv4L3Protocol::DoDispose (void) { - for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) - { - delete (*i); - } + NS_LOG_FUNCTION; m_interfaces.clear (); m_node = 0; m_staticRouting->Dispose (); @@ -145,7 +183,9 @@ Ipv4L3Protocol::DoDispose (void) void Ipv4L3Protocol::SetupLoopback (void) { - Ipv4LoopbackInterface * interface = new Ipv4LoopbackInterface (m_node); + NS_LOG_FUNCTION; + + Ptr interface = Create (m_node); interface->SetAddress (Ipv4Address::GetLoopback ()); interface->SetNetworkMask (Ipv4Mask::GetLoopback ()); uint32_t index = AddIpv4Interface (interface); @@ -153,32 +193,36 @@ Ipv4L3Protocol::SetupLoopback (void) interface->SetUp (); } -TraceResolver * -Ipv4L3Protocol::CreateTraceResolver (TraceContext const &context) +Ptr +Ipv4L3Protocol::GetTraceResolver (void) const { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); - resolver->Add ("tx", m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); - resolver->Add ("rx", m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); - resolver->Add ("drop", m_dropTrace, Ipv4L3ProtocolTraceContextElement (Ipv4L3ProtocolTraceContextElement::DROP)); - resolver->Add ("interfaces", - MakeCallback (&Ipv4L3Protocol::InterfacesCreateTraceResolver, this)); - return resolver; -} + NS_LOG_FUNCTION; -TraceResolver * -Ipv4L3Protocol::InterfacesCreateTraceResolver (TraceContext const &context) const -{ - ArrayTraceResolver *resolver = - new ArrayTraceResolver - (context, - MakeCallback (&Ipv4L3Protocol::GetNInterfaces, this), - MakeCallback (&Ipv4L3Protocol::GetInterface, this)); + Ptr resolver = Create (); + resolver->AddSource ("tx", + TraceDoc ("send ipv4 packet to outgoing interface", + "const Packet &", "packet sent", + "uint32_t", "index of output ipv4 interface"), + m_txTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::TX)); + resolver->AddSource ("rx", + TraceDoc ("receive ipv4 packet from incoming interface", + "const Packet &", "packet received", + "uint32_t", "index of input ipv4 interface"), + m_rxTrace, Ipv4L3ProtocolTraceContextElement(Ipv4L3ProtocolTraceContextElement::RX)); + resolver->AddSource ("drop", + TraceDoc ("drop ipv4 packet", + "const Packet &", "packet dropped"), + m_dropTrace, Ipv4L3ProtocolTraceContextElement (Ipv4L3ProtocolTraceContextElement::DROP)); + resolver->AddArray ("interfaces", + m_interfaces.begin (), m_interfaces.end (), + Ipv4L3ProtocolInterfaceIndex ()); return resolver; } void Ipv4L3Protocol::SetDefaultTtl (uint8_t ttl) { + NS_LOG_FUNCTION; m_defaultTtl = ttl; } @@ -188,49 +232,114 @@ Ipv4L3Protocol::AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, uint32_t interface) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << dest << ", " << nextHop << ", " << interface << ")"); m_staticRouting->AddHostRouteTo (dest, nextHop, interface); } + void Ipv4L3Protocol::AddHostRouteTo (Ipv4Address dest, uint32_t interface) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << dest << ", " << interface << ")"); m_staticRouting->AddHostRouteTo (dest, interface); } + void Ipv4L3Protocol::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << network << ", " << networkMask << ", " << nextHop << + ", " << interface << ")"); m_staticRouting->AddNetworkRouteTo (network, networkMask, nextHop, interface); } + void Ipv4L3Protocol::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, uint32_t interface) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << network << ", " << networkMask << ", " << interface << + ")"); m_staticRouting->AddNetworkRouteTo (network, networkMask, interface); } + void Ipv4L3Protocol::SetDefaultRoute (Ipv4Address nextHop, uint32_t interface) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << nextHop << ", " << interface << ")"); m_staticRouting->SetDefaultRoute (nextHop, interface); } +void +Ipv4L3Protocol::Lookup ( + Ipv4Header const &ipHeader, + Packet packet, + Ipv4RoutingProtocol::RouteReplyCallback routeReply) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &ipHeader << ", " << &packet << &routeReply << ")"); + + Lookup (Ipv4RoutingProtocol::IF_INDEX_ANY, ipHeader, packet, routeReply); +} void -Ipv4L3Protocol::Lookup (Ipv4Header const &ipHeader, - Packet packet, - Ipv4RoutingProtocol::RouteReplyCallback routeReply) +Ipv4L3Protocol::Lookup ( + uint32_t ifIndex, + Ipv4Header const &ipHeader, + Packet packet, + Ipv4RoutingProtocol::RouteReplyCallback routeReply) { - for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); - rprotoIter != m_routingProtocols.end (); rprotoIter++) + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << ifIndex << ", " << &ipHeader << ", " << &packet << + &routeReply << ")"); + + for (Ipv4RoutingProtocolList::const_iterator rprotoIter = + m_routingProtocols.begin (); + rprotoIter != m_routingProtocols.end (); + rprotoIter++) { - if ((*rprotoIter).second->RequestRoute (ipHeader, packet, routeReply)) + NS_LOG_LOGIC ("Requesting route"); + if ((*rprotoIter).second->RequestRoute (ifIndex, ipHeader, packet, + routeReply)) return; } - // No route found + + if (ipHeader.GetDestination ().IsMulticast () && + ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY) + { + NS_LOG_LOGIC ("Multicast destination with local source"); +// +// We have a multicast packet originating from the current node and were not +// able to send it using the usual RequestRoute process. Since the usual +// process includes trying to use a default multicast route, this means that +// there was no specific route out of the node found, and there was no default +// multicast route set. +// +// The fallback position is to look for a default unicast route and use that +// to get the packet off the node if we have one. +// + Ipv4Route *route = m_staticRouting->GetDefaultRoute (); + + if (route) + { + NS_LOG_LOGIC ("Local source. Using unicast default route for " + "multicast packet"); + + routeReply (true, *route, packet, ipHeader); + return; + } + } +// +// No route found +// routeReply (false, Ipv4Route (), packet, ipHeader); } @@ -238,6 +347,8 @@ void Ipv4L3Protocol::AddRoutingProtocol (Ptr routingProtocol, int priority) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &routingProtocol << ", " << priority << ")"); m_routingProtocols.push_back (std::pair > (-priority, routingProtocol)); m_routingProtocols.sort (); @@ -246,39 +357,107 @@ Ipv4L3Protocol::AddRoutingProtocol (Ptr routingProtocol, uint32_t Ipv4L3Protocol::GetNRoutes (void) { + NS_LOG_FUNCTION; return m_staticRouting->GetNRoutes (); } Ipv4Route * Ipv4L3Protocol::GetRoute (uint32_t index) { + NS_LOG_FUNCTION; return m_staticRouting->GetRoute (index); } void Ipv4L3Protocol::RemoveRoute (uint32_t index) { + NS_LOG_FUNCTION; + NS_LOG_PARAM("(" << index << ")"); m_staticRouting->RemoveRoute (index); } +void +Ipv4L3Protocol::AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << origin << ", " << group << ", " << inputInterface << + ", " << &outputInterfaces << ")"); + + m_staticRouting->AddMulticastRoute (origin, group, inputInterface, + outputInterfaces); +} + +void +Ipv4L3Protocol::SetDefaultMulticastRoute (uint32_t outputInterface) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << outputInterface << ")"); + + m_staticRouting->SetDefaultMulticastRoute (outputInterface); +} + +uint32_t +Ipv4L3Protocol::GetNMulticastRoutes (void) const +{ + NS_LOG_FUNCTION; + return m_staticRouting->GetNMulticastRoutes (); +} + +Ipv4MulticastRoute * +Ipv4L3Protocol::GetMulticastRoute (uint32_t index) const +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << index << ")"); + return m_staticRouting->GetMulticastRoute (index); +} + +void +Ipv4L3Protocol::RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << origin << ", " << group << ", " << inputInterface << + ")"); + m_staticRouting->RemoveMulticastRoute (origin, group, inputInterface); +} + +void +Ipv4L3Protocol::RemoveMulticastRoute (uint32_t index) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << index << ")"); + m_staticRouting->RemoveMulticastRoute (index); +} uint32_t Ipv4L3Protocol::AddInterface (Ptr device) { - Ipv4Interface *interface = new ArpIpv4Interface (m_node, device); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &device << ")"); + Ptr interface = Create (m_node, device); return AddIpv4Interface (interface); } + uint32_t -Ipv4L3Protocol::AddIpv4Interface (Ipv4Interface *interface) +Ipv4L3Protocol::AddIpv4Interface (Ptrinterface) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << interface << ")"); uint32_t index = m_nInterfaces; m_interfaces.push_back (interface); m_nInterfaces++; return index; } -Ipv4Interface * + +Ptr Ipv4L3Protocol::GetInterface (uint32_t index) const { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << index << ")"); uint32_t tmp = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { @@ -290,15 +469,63 @@ Ipv4L3Protocol::GetInterface (uint32_t index) const } return 0; } + uint32_t Ipv4L3Protocol::GetNInterfaces (void) const { + NS_LOG_FUNCTION; return m_nInterfaces; } -Ipv4Interface * +uint32_t +Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr) const +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << addr << ")"); + + uint32_t ifIndex = 0; + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); + i != m_interfaces.end (); + i++, ifIndex++) + { + if ((*i)->GetAddress () == addr) + { + return ifIndex; + } + } + + NS_ASSERT_MSG(false, "Ipv4L3Protocol::FindInterfaceForAddr (): " + "Interface not found for IP address"); + return 0; +} + +uint32_t +Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << addr << ", " << mask << ")"); + + uint32_t ifIndex = 0; + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); + i != m_interfaces.end (); + i++, ifIndex++) + { + if ((*i)->GetAddress ().CombineMask (mask) == addr.CombineMask (mask)) + { + return ifIndex; + } + } + + NS_ASSERT_MSG(false, "Ipv4L3Protocol::FindInterfaceForAddr (): " + "Interface not found for masked IP address"); + return 0; +} + +Ptr Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &device << ")"); for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { if ((*i)->GetDevice () == device) @@ -312,10 +539,20 @@ Ipv4L3Protocol::FindInterfaceForDevice (Ptr device) void Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protocol, const Address &from) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &device << ", " << &p << ", " << protocol << ", " << + from << ")"); + + NS_LOG_LOGIC ("Packet from " << from); + uint32_t index = 0; - for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) + Ptr ipv4Interface; + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); + i != m_interfaces.end (); + i++) { - if ((*i)->GetDevice () == device) + ipv4Interface = *i; + if (ipv4Interface->GetDevice () == device) { m_rxTrace (p, index); break; @@ -331,12 +568,13 @@ Ipv4L3Protocol::Receive( Ptr device, const Packet& p, uint16_t protoc return; } - if (Forwarding (packet, ipHeader, device)) + if (Forwarding (index, packet, ipHeader, device)) { return; } - ForwardUp (packet, ipHeader); + NS_LOG_LOGIC ("Forward up"); + ForwardUp (packet, ipHeader, ipv4Interface); } @@ -346,6 +584,10 @@ Ipv4L3Protocol::Send (Packet const &packet, Ipv4Address destination, uint8_t protocol) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &packet << ", " << source << ", " << ", " << + destination << ", " << protocol << ")"); + Ipv4Header ipHeader; ipHeader.SetSource (source); @@ -364,7 +606,7 @@ Ipv4L3Protocol::Send (Packet const &packet, for (Ipv4InterfaceList::iterator ifaceIter = m_interfaces.begin (); ifaceIter != m_interfaces.end (); ifaceIter++, ifaceIndex++) { - Ipv4Interface *outInterface = *ifaceIter; + Ptr outInterface = *ifaceIter; Packet packetCopy = packet; NS_ASSERT (packetCopy.GetSize () <= outInterface->GetMtu ()); @@ -394,36 +636,52 @@ Ipv4L3Protocol::SendRealOut (bool found, Packet packet, Ipv4Header const &ipHeader) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << found << ", " << &route << ", " << &packet << + &ipHeader << ")"); + if (!found) { - NS_DEBUG ("no route to host. drop."); + NS_LOG_WARN ("No route to host. Drop."); m_dropTrace (packet); return; } + + NS_LOG_LOGIC ("Send via interface " << route.GetInterface ()); + packet.AddHeader (ipHeader); - Ipv4Interface *outInterface = GetInterface (route.GetInterface ()); + Ptr outInterface = GetInterface (route.GetInterface ()); NS_ASSERT (packet.GetSize () <= outInterface->GetMtu ()); m_txTrace (packet, route.GetInterface ()); if (route.IsGateway ()) { + NS_LOG_LOGIC ("Send to gateway " << route.GetGateway ()); outInterface->Send (packet, route.GetGateway ()); } else { + NS_LOG_LOGIC ("Send to destination " << ipHeader.GetDestination ()); outInterface->Send (packet, ipHeader.GetDestination ()); } } - bool -Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device) +Ipv4L3Protocol::Forwarding ( + uint32_t ifIndex, + Packet const &packet, + Ipv4Header &ipHeader, + Ptr device) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << ifIndex << ", " << &packet << ", " << &ipHeader << + ", " << device << ")"); + for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { if ((*i)->GetAddress ().IsEqual (ipHeader.GetDestination ())) { - NS_DEBUG ("for me 1"); + NS_LOG_LOGIC ("For me (destination match)"); return false; } } @@ -431,12 +689,12 @@ Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr interface = *i; if (interface->GetDevice () == device) { if (ipHeader.GetDestination ().IsEqual (interface->GetBroadcast ())) { - NS_DEBUG ("for me 2"); + NS_LOG_LOGIC ("For me (interface broadcast address)"); return false; } break; @@ -445,79 +703,216 @@ Ipv4L3Protocol::Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr incomingInterface) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << &ip << ")"); + Ptr demux = m_node->QueryInterface (Ipv4L4Demux::iid); Ptr protocol = demux->GetProtocol (ip.GetProtocol ()); - protocol->Receive (p, ip.GetSource (), ip.GetDestination ()); + protocol->Receive (p, ip.GetSource (), ip.GetDestination (), incomingInterface); +} + +void +Ipv4L3Protocol::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << origin << ", " << group << ")"); + m_multicastGroups.push_back( + std::pair (origin, group)); +} + +void +Ipv4L3Protocol::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << origin << ", " << group << ")"); + + for (Ipv4MulticastGroupList::iterator i = m_multicastGroups.begin (); + i != m_multicastGroups.end (); + i++) + { + if ((*i).first.IsEqual(origin) && (*i).second.IsEqual(group)) + { + m_multicastGroups.erase (i); + return; + } + } } void Ipv4L3Protocol::SetAddress (uint32_t i, Ipv4Address address) { - Ipv4Interface *interface = GetInterface (i); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ", " << address << ")"); + Ptr interface = GetInterface (i); interface->SetAddress (address); } + void Ipv4L3Protocol::SetNetworkMask (uint32_t i, Ipv4Mask mask) { - Ipv4Interface *interface = GetInterface (i); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ", " << mask << ")"); + Ptr interface = GetInterface (i); interface->SetNetworkMask (mask); } + Ipv4Mask Ipv4L3Protocol::GetNetworkMask (uint32_t i) const { - Ipv4Interface *interface = GetInterface (i); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ")"); + Ptr interface = GetInterface (i); return interface->GetNetworkMask (); } + Ipv4Address Ipv4L3Protocol::GetAddress (uint32_t i) const { - Ipv4Interface *interface = GetInterface (i); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ")"); + Ptr interface = GetInterface (i); return interface->GetAddress (); } + +bool +Ipv4L3Protocol::GetIfIndexForDestination ( + Ipv4Address destination, uint32_t& ifIndex) const +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << destination << ", " << &ifIndex << ")"); +// +// The first thing we do in trying to determine a source address is to +// consult the routing protocols. These will also check for a default route +// if one has been set. +// + for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin (); + i != m_routingProtocols.end (); + i++) + { + NS_LOG_LOGIC ("Requesting Source Address"); + uint32_t ifIndexTmp; + + if ((*i).second->RequestIfIndex (destination, ifIndexTmp)) + { + NS_LOG_LOGIC ("Found ifIndex " << ifIndexTmp); + ifIndex = ifIndexTmp; + return true; + } + } +// +// If there's no routing table entry telling us what *single* interface will +// be used to send a packet to this destination, we'll have to just pick one. +// If there's only one interface on this node, a good answer isn't very hard +// to come up with. Before jumping to any conclusions, remember that the +// zeroth interface is the loopback interface, so what we actually want is +// a situation where there are exactly two interfaces on the node, in which +// case interface one is the "single" interface connected to the outside world. +// + if (GetNInterfaces () == 2) + { + NS_LOG_LOGIC ("One Interface. Using interface 1."); + ifIndex = 1; + return true; + } +// +// If we fall through to here, we have a node with multiple interfaces and +// no routes to guide us in determining what interface to choose. Either +// no default route was found (for unicast or multicast), or in the case of a +// multicast, the default route contained multiple outbound interfaces. +// +// The fallback position is to just get the unicast default route and use +// the outgoing interface specified there. We don't want to leave the source +// address unset, so we just assert here. +// +// N.B. that in the case of a multicast with a route containing multiple +// outgoing interfaces, the source address of packets from that node will be +// set to the IP address of the interface set in the default unicast route. +// Also, in the case of a broadcast, the same will be true. +// + NS_LOG_LOGIC ("Using default unicast route"); + Ipv4Route *route = m_staticRouting->GetDefaultRoute (); + + NS_ASSERT_MSG(route, + "Ipv4L3Protocol::GetIfIndexForDestination (): " + "Unable to determine outbound interface. No default route set"); + + ifIndex = route->GetInterface (); + + NS_LOG_LOGIC ("Default route specifies interface " << ifIndex); + return true; +} + uint16_t Ipv4L3Protocol::GetMtu (uint32_t i) const { - Ipv4Interface *interface = GetInterface (i); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ")"); + Ptr interface = GetInterface (i); return interface->GetMtu (); } + bool Ipv4L3Protocol::IsUp (uint32_t i) const { - Ipv4Interface *interface = GetInterface (i); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ")"); + Ptr interface = GetInterface (i); return interface->IsUp (); } + void Ipv4L3Protocol::SetUp (uint32_t i) { - Ipv4Interface *interface = GetInterface (i); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << i << ")"); + Ptr interface = GetInterface (i); interface->SetUp (); // If interface address and network mask have been set, add a route @@ -530,10 +925,13 @@ Ipv4L3Protocol::SetUp (uint32_t i) interface->GetNetworkMask (), i); } } + void Ipv4L3Protocol::SetDown (uint32_t ifaceIndex) { - Ipv4Interface *interface = GetInterface (ifaceIndex); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << ifaceIndex << ")"); + Ptr interface = GetInterface (ifaceIndex); interface->SetDown (); // Remove all routes that are going through this interface @@ -554,5 +952,4 @@ Ipv4L3Protocol::SetDown (uint32_t ifaceIndex) } } - }//namespace ns3 diff --git a/src/internet-node/ipv4-l3-protocol.h b/src/internet-node/ipv4-l3-protocol.h index 2cce3efa3..bea82707e 100644 --- a/src/internet-node/ipv4-l3-protocol.h +++ b/src/internet-node/ipv4-l3-protocol.h @@ -44,6 +44,9 @@ class Node; class TraceResolver; class TraceContext; +/** + * \brief hold in a TraceContext the type of trace source used by this Ipv4L3Protocol + */ class Ipv4L3ProtocolTraceContextElement : public TraceContextElement { public: @@ -54,23 +57,40 @@ public: }; Ipv4L3ProtocolTraceContextElement (); Ipv4L3ProtocolTraceContextElement (enum Type type); + /** + * \returns true if this is a tx event, false otherwise. + */ bool IsTx (void) const; + /** + * \returns true if this is a rx event, false otherwise. + */ bool IsRx (void) const; + /** + * \returns true if this is a drop event, false otherwise. + */ bool IsDrop (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); + std::string GetTypeName (void) const; private: enum Type m_type; }; -class Ipv4l3ProtocolInterfaceIndex : public TraceContextElement +/** + * \brief hold in a TraceContext the index of an Ipv4Interface within the ipv4 stack of a Node + */ +class Ipv4L3ProtocolInterfaceIndex : public TraceContextElement { public: - Ipv4l3ProtocolInterfaceIndex (); - Ipv4l3ProtocolInterfaceIndex (uint32_t index); + Ipv4L3ProtocolInterfaceIndex (); + Ipv4L3ProtocolInterfaceIndex (uint32_t index); + /** + * \returns the index of the Ipv4Interface within a Node. + */ uint32_t Get (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); + std::string GetTypeName (void) const; private: uint32_t m_index; }; @@ -85,15 +105,6 @@ public: Ipv4L3Protocol(Ptr node); virtual ~Ipv4L3Protocol (); - /** - * \param context the trace context to use to construct the - * TraceResolver to return - * \returns a TraceResolver which can resolve all traces - * performed in this object. The caller must - * delete the returned object. - */ - virtual TraceResolver *CreateTraceResolver (TraceContext const &context); - /** * \param ttl default ttl to use * @@ -109,7 +120,7 @@ public: * Try to find an Ipv4Interface whose NetDevice is equal to * the input NetDevice. */ - Ipv4Interface *FindInterfaceForDevice (Ptr device); + Ptr FindInterfaceForDevice (Ptr device); /** * Lower layer calls this method after calling L3Demux::Lookup @@ -158,15 +169,37 @@ public: Ipv4Route *GetRoute (uint32_t i); void RemoveRoute (uint32_t i); + void AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces); + + void SetDefaultMulticastRoute (uint32_t onputInterface); + + uint32_t GetNMulticastRoutes (void) const; + Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; + + void RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface); + void RemoveMulticastRoute (uint32_t i); + uint32_t AddInterface (Ptr device); - Ipv4Interface * GetInterface (uint32_t i) const; + Ptr GetInterface (uint32_t i) const; uint32_t GetNInterfaces (void) const; + uint32_t FindInterfaceForAddr (Ipv4Address addr) const; + uint32_t FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const; + void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group); + void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group); + void SetAddress (uint32_t i, Ipv4Address address); void SetNetworkMask (uint32_t i, Ipv4Mask mask); Ipv4Mask GetNetworkMask (uint32_t t) const; Ipv4Address GetAddress (uint32_t i) const; + bool GetIfIndexForDestination (Ipv4Address destination, + uint32_t& ifIndex) const; uint16_t GetMtu (uint32_t i) const; bool IsUp (uint32_t i) const; void SetUp (uint32_t i); @@ -178,20 +211,29 @@ public: protected: virtual void DoDispose (void); + virtual Ptr GetTraceResolver (void) const; private: + void Lookup (uint32_t ifIndex, + Ipv4Header const &ipHeader, + Packet packet, + Ipv4RoutingProtocol::RouteReplyCallback routeReply); void SendRealOut (bool found, Ipv4Route const &route, Packet packet, Ipv4Header const &ipHeader); - bool Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr device); - void ForwardUp (Packet p, Ipv4Header const&ip); - uint32_t AddIpv4Interface (Ipv4Interface *interface); + bool Forwarding (uint32_t ifIndex, + Packet const &packet, + Ipv4Header &ipHeader, + Ptr device); + void ForwardUp (Packet p, Ipv4Header const&ip, Ptr incomingInterface); + uint32_t AddIpv4Interface (Ptr interface); void SetupLoopback (void); - TraceResolver *InterfacesCreateTraceResolver (TraceContext const &context) const; - typedef std::list Ipv4InterfaceList; + typedef std::list > Ipv4InterfaceList; + typedef std::list > + Ipv4MulticastGroupList; typedef std::list< std::pair< int, Ptr > > Ipv4RoutingProtocolList; Ipv4InterfaceList m_interfaces; @@ -206,6 +248,7 @@ private: Ipv4RoutingProtocolList m_routingProtocols; Ptr m_staticRouting; + Ipv4MulticastGroupList m_multicastGroups; }; } // Namespace ns3 diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index 977b802ba..ae4a09e42 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -54,6 +54,11 @@ Ipv4L4ProtocolTraceContextElement::GetUid (void) static uint16_t uid = AllocateUid ("Ipv4L4ProtocolTraceContextElement"); return uid; } +std::string +Ipv4L4ProtocolTraceContextElement::GetTypeName (void) const +{ + return "ns3::Ipv4L4ProtocolTraceContextElement"; +} Ipv4L4Demux::Ipv4L4Demux (Ptr node) @@ -78,21 +83,19 @@ Ipv4L4Demux::DoDispose (void) Object::DoDispose (); } -TraceResolver * -Ipv4L4Demux::CreateTraceResolver (TraceContext const &context) +Ptr +Ipv4L4Demux::GetTraceResolver (void) const { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); + Ptr resolver = Create (); for (L4List_t::const_iterator i = m_protocols.begin(); i != m_protocols.end(); ++i) { Ptr protocol = *i; - std::string protValue; - std::ostringstream oss (protValue); - oss << (*i)->GetProtocolNumber (); + std::ostringstream oss; + oss << (unsigned int) (*i)->GetProtocolNumber (); Ipv4L4ProtocolTraceContextElement protocolNumber = (*i)->GetProtocolNumber (); - resolver->Add (protValue, - MakeCallback (&Ipv4L4Protocol::CreateTraceResolver, PeekPointer (protocol)), - protocolNumber); + resolver->AddComposite (oss.str (), protocol, protocolNumber); } + resolver->SetParentResolver (Object::GetTraceResolver ()); return resolver; } void diff --git a/src/internet-node/ipv4-l4-demux.h b/src/internet-node/ipv4-l4-demux.h index 7e7fba62e..6e1208c13 100644 --- a/src/internet-node/ipv4-l4-demux.h +++ b/src/internet-node/ipv4-l4-demux.h @@ -37,14 +37,21 @@ class Node; class TraceResolver; class TraceContext; +/** + * \brief hold in a TraceContext the protocol number of a L4 Protocol + */ class Ipv4L4ProtocolTraceContextElement : public TraceContextElement { public: Ipv4L4ProtocolTraceContextElement (); Ipv4L4ProtocolTraceContextElement (int protocolNumber); + /** + * \returns the protocol number as registered in the Ipv4L4Demux. + */ int Get (void) const; void Print (std::ostream &os) const; static uint16_t GetUid (void); + std::string GetTypeName (void) const; private: int m_protocolNumber; }; @@ -59,14 +66,6 @@ public: Ipv4L4Demux (Ptr node); virtual ~Ipv4L4Demux(); - /** - * \param context the trace context to use to construct the - * TraceResolver to return - * \returns a TraceResolver which can resolve all traces - * performed in this object. The caller must - * delete the returned object. - */ - TraceResolver *CreateTraceResolver (TraceContext const &context); /** * \param protocol a template for the protocol to add to this L4 Demux. * \returns the L4Protocol effectively added. @@ -95,8 +94,10 @@ public: * returned from the Ipv4L4Protocol::Insert method. */ void Remove (Ptr protocol); -private: +protected: + Ptr GetTraceResolver (void) const; virtual void DoDispose (void); +private: typedef std::list > L4List_t; L4List_t m_protocols; Ptr m_node; diff --git a/src/internet-node/ipv4-l4-protocol.h b/src/internet-node/ipv4-l4-protocol.h index f23aa510b..6f1dad714 100644 --- a/src/internet-node/ipv4-l4-protocol.h +++ b/src/internet-node/ipv4-l4-protocol.h @@ -26,6 +26,7 @@ #define IPV4_L4_PROTOCOL_H #include "ns3/object.h" +#include "ipv4-interface.h" namespace ns3 { @@ -37,10 +38,6 @@ class TraceContext; /** * \brief L4 Protocol base class * - * All subclasses must implement: - * - Ipv4L4Protocol::Copy - * - Ipv4L4Protocol::CreateTraceResolver - * * If you want to implement a new L4 protocol, all you have to do is * implement a subclass of this base class and add it to an L4Demux. */ @@ -59,19 +56,19 @@ public: */ int GetVersion() const; - virtual TraceResolver *CreateTraceResolver (TraceContext const &context) = 0; - /** * \param p packet to forward up * \param source source address of packet received * \param destination address of packet received + * \param incomingInterface the Ipv4Interface on which the packet arrived * * Called from lower-level layers to send the packet up * in the stack. */ virtual void Receive(Packet& p, Ipv4Address const &source, - Ipv4Address const &destination) = 0; + Ipv4Address const &destination, + Ptr incomingInterface) = 0; protected: virtual void DoDispose (void); private: diff --git a/src/internet-node/ipv4-loopback-interface.cc b/src/internet-node/ipv4-loopback-interface.cc index be680a022..eb59a662d 100644 --- a/src/internet-node/ipv4-loopback-interface.cc +++ b/src/internet-node/ipv4-loopback-interface.cc @@ -19,33 +19,41 @@ * Authors: * Mathieu Lacage , */ -#include "ns3/empty-trace-resolver.h" + +#include "ns3/log.h" #include "ns3/net-device.h" #include "ns3/node.h" -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" #include "ipv4-loopback-interface.h" #include "ipv4-l3-protocol.h" +NS_LOG_COMPONENT_DEFINE ("Ipv4LoopbackInterface"); + namespace ns3 { Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr node) : Ipv4Interface (0), m_node (node) -{} -Ipv4LoopbackInterface::~Ipv4LoopbackInterface () -{} - -TraceResolver * -Ipv4LoopbackInterface::DoCreateTraceResolver (TraceContext const &context) { - return new EmptyTraceResolver (context); + NS_LOG_FUNCTION; +} + +Ipv4LoopbackInterface::~Ipv4LoopbackInterface () +{ + NS_LOG_FUNCTION; } void Ipv4LoopbackInterface::SendTo (Packet packet, Ipv4Address dest) { - Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); - ipv4->Receive (GetDevice (), packet, Ipv4L3Protocol::PROT_NUMBER, Eui48Address ("ff:ff:ff:ff:ff:ff")); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &packet << ", " << dest << ")"); + + Ptr ipv4 = + m_node->QueryInterface (Ipv4L3Protocol::iid); + + ipv4->Receive (0, packet, Ipv4L3Protocol::PROT_NUMBER, + Mac48Address ("ff:ff:ff:ff:ff:ff")); } }//namespace ns3 diff --git a/src/internet-node/ipv4-loopback-interface.h b/src/internet-node/ipv4-loopback-interface.h index 3eead3a01..8e33f81d7 100644 --- a/src/internet-node/ipv4-loopback-interface.h +++ b/src/internet-node/ipv4-loopback-interface.h @@ -43,7 +43,6 @@ class Ipv4LoopbackInterface : public Ipv4Interface private: virtual void SendTo (Packet p, Ipv4Address dest); - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); Ptr m_node; }; diff --git a/src/internet-node/ipv4-static-routing.cc b/src/internet-node/ipv4-static-routing.cc index b70c1c1af..6b7d8671d 100644 --- a/src/internet-node/ipv4-static-routing.cc +++ b/src/internet-node/ipv4-static-routing.cc @@ -19,36 +19,48 @@ // Author: George F. Riley // Gustavo Carneiro +#include "ns3/log.h" #include "ipv4-static-routing.h" #include "ns3/packet.h" +NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRouting"); namespace ns3 { +Ipv4StaticRouting::Ipv4StaticRouting () +: m_defaultRoute (0), m_defaultMulticastRoute (0) +{ + NS_LOG_FUNCTION; +} void Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, uint32_t interface) { + NS_LOG_FUNCTION; Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateHostRouteTo (dest, nextHop, interface); m_hostRoutes.push_back (route); } + void Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, uint32_t interface) { + NS_LOG_FUNCTION; Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateHostRouteTo (dest, interface); m_hostRoutes.push_back (route); } + void Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface) { + NS_LOG_FUNCTION; Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateNetworkRouteTo (network, networkMask, @@ -56,30 +68,201 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, interface); m_networkRoutes.push_back (route); } + void Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, uint32_t interface) { + NS_LOG_FUNCTION; Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateNetworkRouteTo (network, networkMask, interface); m_networkRoutes.push_back (route); } + void Ipv4StaticRouting::SetDefaultRoute (Ipv4Address nextHop, uint32_t interface) { + NS_LOG_FUNCTION; Ipv4Route *route = new Ipv4Route (); *route = Ipv4Route::CreateDefaultRoute (nextHop, interface); delete m_defaultRoute; m_defaultRoute = route; } +void +Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + NS_LOG_FUNCTION; + Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); + *route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, + inputInterface, outputInterfaces); + m_multicastRoutes.push_back (route); +} + +void +Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) +{ + NS_LOG_FUNCTION; + Ipv4Address origin = Ipv4Address::GetAny (); + Ipv4Address group = Ipv4Address::GetAny (); + uint32_t inputInterface = Ipv4RoutingProtocol::IF_INDEX_ANY; + + std::vector outputInterfaces (1); + outputInterfaces[0] = outputInterface; + + Ipv4MulticastRoute *route = new Ipv4MulticastRoute (); + *route = Ipv4MulticastRoute::CreateMulticastRoute (origin, group, + inputInterface, outputInterfaces); + + delete m_defaultMulticastRoute; + m_defaultMulticastRoute = route; +} + +uint32_t +Ipv4StaticRouting::GetNMulticastRoutes (void) const +{ + NS_LOG_FUNCTION; + return m_multicastRoutes.size () + m_defaultMulticastRoute ? 1 : 0; +} + +Ipv4MulticastRoute * +Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const +{ + NS_LOG_FUNCTION; + NS_ASSERT_MSG(index < m_multicastRoutes.size (), + "Ipv4StaticRouting::GetMulticastRoute (): Index out of range"); +// +// From an external point of view the default route appears to be in slot 0 +// of the routing table. The implementation, however, puts it in a separate +// place. So, if a client asks for index 0 and we have a default multicast +// route, we have to return it from that different place +// (m_defaultMulticastRoute). +// + if (index == 0 && m_defaultMulticastRoute != 0) + { + return m_defaultMulticastRoute; + } +// +// If there is a default multicast route present, a client will just assume +// that it is in slot zero and there is one "extra" zeroth route in the table. +// To return the correct indexed entry in our list, we have to decrement the +// index to take into account the default route not being in the actual list. +// Since we fell through to here, we've taken care of the case where the +// index was zero. +// + if (m_defaultMulticastRoute != 0) + { + NS_ASSERT(index > 0); + index--; + } + + if (index < m_multicastRoutes.size ()) + { + uint32_t tmp = 0; + for (MulticastRoutesCI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + if (tmp == index) + { + return *i; + } + tmp++; + } + } + return 0; +} + +Ipv4MulticastRoute * +Ipv4StaticRouting::GetDefaultMulticastRoute () const +{ + NS_LOG_FUNCTION; + if (m_defaultMulticastRoute != 0) + { + return m_defaultMulticastRoute; + } + return 0; +} + +bool +Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface) +{ + NS_LOG_FUNCTION; + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + Ipv4MulticastRoute *route = *i; + if (origin == route->GetOrigin () && + group == route->GetGroup () && + inputInterface == route->GetInputInterface ()) + { + delete *i; + m_multicastRoutes.erase (i); + return true; + } + } + return false; +} + +void +Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) +{ + NS_LOG_FUNCTION; +// +// From an external point of view the default route appears to be in slot 0 +// of the routing table. The implementation, however, puts it in a separate +// place. So, if a client asks to delete index 0 and we have a default +// multicast route set, we have to delete it from that different place +// (m_defaultMulticastRoute). +// + if (index == 0 && m_defaultMulticastRoute != 0) + { + delete m_defaultMulticastRoute; + m_defaultMulticastRoute = 0; + } +// +// If there is a default multicast route present, a client will just assume +// that it is in slot zero and there is one "extra" zeroth route in the table. +// To return the correct indexed entry in our list, we have to decrement the +// index to take into account the default route not being in the actual list. +// Since we fell through to here, we've taken care of the case where the +// index was zero. +// + if (m_defaultMulticastRoute != 0) + { + NS_ASSERT(index > 0); + index--; + } + + uint32_t tmp = 0; + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + if (tmp == index) + { + delete *i; + m_multicastRoutes.erase (i); + return; + } + tmp++; + } +} + Ipv4Route * Ipv4StaticRouting::LookupStatic (Ipv4Address dest) { + NS_LOG_FUNCTION; for (HostRoutesCI i = m_hostRoutes.begin (); i != m_hostRoutes.end (); i++) @@ -110,9 +293,115 @@ Ipv4StaticRouting::LookupStatic (Ipv4Address dest) return 0; } +Ipv4MulticastRoute * +Ipv4StaticRouting::LookupStatic ( + Ipv4Address origin, + Ipv4Address group, + uint32_t ifIndex) +{ + NS_LOG_FUNCTION; +// +// We treat the "any" address (typically 0.0.0.0) as a wildcard in our matching +// scheme. +// + Ipv4Address wildcard = Ipv4Address::GetAny (); + + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + Ipv4MulticastRoute *route = *i; +// +// We've been passed an origin address, a multicast group address and an +// interface index. We have to decide if the current route in the list is +// a match. +// +// The first case is the restrictive case where the origin, group and index +// matches. This picks up exact routes during forwarded and exact routes from +// the local node (in which case the ifIndex is a wildcard). +// + if (origin == route->GetOrigin () && group == route->GetGroup ()) + { + if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY || + ifIndex == route->GetInputInterface ()) + { + return *i; + } + } + } +// +// If the input interface index is not a wildcard (that means that the packet +// did not originally come from this node), we're done. We don't +// just happily forward packets we don't really know what to do with. +// Multicast storms are not generally considered a good thing. +// + if (ifIndex != Ipv4RoutingProtocol::IF_INDEX_ANY) + { + return 0; + } +// +// Now, we're going to get a litle less restricive. This only applies in the +// case where the packet in question is coming from the local node. In order +// to avoid dependencies on the order in which routes were added, we will +// actually walk the list two more times, the first time looking for routes +// with a single wildcard, and the last time looking for the first route +// with two wildcards. +// + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + Ipv4MulticastRoute *route = *i; +// +// Here we will ignore the origin. We know that a single source address must +// be picked for a packet, but we may want to send multicast packets out +// multiple interfaces. To support this case, a user would need to add +// a Multicast route with the route's origin set to wildcard. N.B As a +// result, packets sourced from a node with multiple interface may have a +// source IP address different from that of the interface actually used to +// send the packet. +// + if (route->GetOrigin () == wildcard && group == route->GetGroup ()) + { + return *i; + } + } +// +// Finally we want to allow users to specify a default route that specifies +// sending all multicast packets out multiple interfaces. The standard +// default multicast route is patterned after other systems and limits the +// number of outputs to one. If, however a client manually adds a multicast +// route with the origin, the multicast group and the input interface index +// all set to wildcard, she has created a default route with multiple output +// interfaces. +// + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i++) + { + Ipv4MulticastRoute *route = *i; + + if (route->GetOrigin () == wildcard && route->GetGroup () == wildcard) + { + return *i; + } + } +// +// We also allow users to specify a typical default multicast route. This +// default route is limited to specifying a single output interface. +// + if (m_defaultMulticastRoute != 0) + { + return m_defaultMulticastRoute; + } + + return 0; +} + uint32_t Ipv4StaticRouting::GetNRoutes (void) { + NS_LOG_FUNCTION; uint32_t n = 0; if (m_defaultRoute != 0) { @@ -122,9 +411,25 @@ Ipv4StaticRouting::GetNRoutes (void) n += m_networkRoutes.size (); return n; } + +Ipv4Route * +Ipv4StaticRouting::GetDefaultRoute () +{ + NS_LOG_FUNCTION; + if (m_defaultRoute != 0) + { + return m_defaultRoute; + } + else + { + return 0; + } +} + Ipv4Route * Ipv4StaticRouting::GetRoute (uint32_t index) { + NS_LOG_FUNCTION; if (index == 0 && m_defaultRoute != 0) { return m_defaultRoute; @@ -166,6 +471,7 @@ Ipv4StaticRouting::GetRoute (uint32_t index) void Ipv4StaticRouting::RemoveRoute (uint32_t index) { + NS_LOG_FUNCTION; if (index == 0 && m_defaultRoute != 0) { delete m_defaultRoute; @@ -209,10 +515,50 @@ Ipv4StaticRouting::RemoveRoute (uint32_t index) } bool -Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, - Packet packet, - RouteReplyCallback routeReply) +Ipv4StaticRouting::RequestRoute ( + uint32_t ifIndex, + Ipv4Header const &ipHeader, + Packet packet, + RouteReplyCallback routeReply) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << ifIndex << &ipHeader << ", " << &packet << ", " << + &routeReply << ")"); + + NS_LOG_LOGIC ("source = " << ipHeader.GetSource ()); + + NS_LOG_LOGIC ("destination = " << ipHeader.GetDestination ()); + + if (ipHeader.GetDestination ().IsMulticast ()) + { + NS_LOG_LOGIC ("Multicast destination"); + + Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (), + ipHeader.GetDestination (), ifIndex); + + if (mRoute) + { + NS_LOG_LOGIC ("Multicast route found"); + + for (uint32_t i = 0; i < mRoute->GetNOutputInterfaces (); ++i) + { + Packet p = packet; + Ipv4Header h = ipHeader; + Ipv4Route route = + Ipv4Route::CreateHostRouteTo(h.GetDestination (), + mRoute->GetOutputInterface(i)); + NS_LOG_LOGIC ( "Send via interface " << + mRoute->GetOutputInterface(i)); + routeReply (true, route, p, h); + } + return true; + } + return false; // Let other routing protocols try to handle this + } +// +// This is a unicast packet. Check to see if we have a route for it. +// + NS_LOG_LOGIC ("Unicast destination"); Ipv4Route *route = LookupStatic (ipHeader.GetDestination ()); if (route != 0) { @@ -226,9 +572,58 @@ Ipv4StaticRouting::RequestRoute (Ipv4Header const &ipHeader, } } +bool +Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex) +{ + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << destination << ", " << &ifIndex << ")"); +// +// First, see if this is a multicast packet we have a route for. If we +// have a route, then send the packet down each of the specified interfaces. +// + if (destination.IsMulticast ()) + { + NS_LOG_LOGIC ("Multicast destination"); + + Ipv4MulticastRoute *mRoute = LookupStatic(Ipv4Address::GetAny (), + destination, Ipv4RoutingProtocol::IF_INDEX_ANY); + + if (mRoute) + { + NS_LOG_LOGIC ("Multicast route found"); + + if (mRoute->GetNOutputInterfaces () != 1) + { + NS_LOG_LOGIC ("Route is to multiple interfaces. Ignoring."); + return false; + } + + ifIndex = mRoute->GetOutputInterface(0); + NS_LOG_LOGIC ("Found ifIndex " << ifIndex); + return true; + } + return false; // Let other routing protocols try to handle this + } +// +// See if this is a unicast packet we have a route for. +// + NS_LOG_LOGIC ("Unicast destination"); + Ipv4Route *route = LookupStatic (destination); + if (route) + { + ifIndex = route->GetInterface (); + return true; + } + else + { + return false; + } +} + void Ipv4StaticRouting::DoDispose (void) { + NS_LOG_FUNCTION; for (HostRoutesI i = m_hostRoutes.begin (); i != m_hostRoutes.end (); i = m_hostRoutes.erase (i)) @@ -246,8 +641,18 @@ Ipv4StaticRouting::DoDispose (void) delete m_defaultRoute; m_defaultRoute = 0; } + for (MulticastRoutesI i = m_multicastRoutes.begin (); + i != m_multicastRoutes.end (); + i = m_multicastRoutes.erase (i)) + { + delete (*i); + } + if (m_defaultMulticastRoute != 0) + { + delete m_defaultMulticastRoute; + m_defaultMulticastRoute = 0; + } Ipv4RoutingProtocol::DoDispose (); } - }//namespace ns3 diff --git a/src/internet-node/ipv4-static-routing.h b/src/internet-node/ipv4-static-routing.h index 8462f55a7..764d0016b 100644 --- a/src/internet-node/ipv4-static-routing.h +++ b/src/internet-node/ipv4-static-routing.h @@ -45,36 +45,441 @@ class TraceResolver; class TraceContext; +/** + * @brief Static routing protocol for IP version 4 stacks. + * + * In ns-3 we have the concept of a pluggable routing protocol. Routing + * protocols are added to a list maintained by the Ipv4L3Protocol. Every + * stack gets one routing protocol for free -- the Ipv4StaticRouting routing + * protocol is added in the constructor of the Ipv4L3Protocol (this is the + * piece of code that implements the functionality of the IP layer). + * + * The Ipv4StaticRouting class inherits from the abstract base class + * Ipv4RoutingProtocol that defines the interface methods that a routing + * protocol must support. + * + * When a packet arrives in the Ipv4L3Protocol for transmission, it comes + * either from a local source via Ipv4L3Protocol::Send or from a remote + * source via Ipv4L3Protocol::Forwarding. In both cases, a function is called + * (Ipv4L3Protocol::Lookup) to look up the routing information for the packet. + * + * The lookup function iterates through the list of routing protocols asking + * each to see if it can find a route and send the packet. A callback is + * provided during each of these calls that should be considered a pre- + * packaged send call. This is done to allow asynchronous calls into + * routing subsystems in order to support on-demand routing, for example. The + * method for requesting this operation is Ipv4StaticRouting::RequestRoute for + * the static routing protocol. + * + * Each routing protocol is also free to implement its own methods for managing + * routes which you will find below. This class manages a set of "static" or + * manually configured routes for host, network and multicast routes. + * + * @see Ipv4RoutingProtocol + * @see Ipv4L3Protocol::AddRoutingProtocol + * @see Ipv4L3Protocol::Ipv4L3Protocol + */ class Ipv4StaticRouting : public Ipv4RoutingProtocol { - public: - Ipv4StaticRouting () : m_defaultRoute (0) {} +/** + * @brief Construct an empty Ipv4StaticRouting routing protocol, + * @internal + * + * The Ipv4StaticRouting class supports host, network and multicast routes. + * This method initializes the lists containing these routes to empty. + * + * @see Ipv4StaticRouting + */ + Ipv4StaticRouting (); - virtual bool RequestRoute (Ipv4Header const &ipHeader, +/** + * @brief Request that a check for a route bw performed and if a route is found + * that the packet be sent on its way using the pre-packaged send callback. + * + * The source and destination IP addresses for the packet in question are found + * in the provided Ipv4Header. There are two major processing forks depending + * on the type of destination address. + * + * If the destination address is unicast then the routing table is consulted + * for a route to the destination and if it is found, the routeReply callback + * is executed to send the packet (with the found route). + * + * If the destination address is a multicast, then the exact processing steps + * depend on whether or not the packet has been sourced locally. This is + * determined by the parameter ifIndex. This is the interface index over which + * this packet was received. If the packet has not been received over a + * network interface, this index will be set to + * Ipv4RoutingProtocol::IF_INDEX_ANY (a very large number). In that case, + * we want to avoid the requirement that an explicit route out of each node + * must be set, so we don't do anything here. + * + * If the packet is a multicast destination and has been received over a + * network interface, a call to this method implies that the packet is being + * forwarded. In that case, there must be an explicit route out of the node. + * A multicast route references the source address, the destination address + * (the multicast group) and the input interface in order to find a route. + * We consult the multicast routing table and, if a route is found, send the + * packet out of as many interfaces as required using the provided callback + * (think of it as a pre-packaged send call). + * + * @param ifIndex The network interface index over which the packed was + * received. If the packet is from a local source, ifIndex will be set to + * Ipv4RoutingProtocol::IF_INDEX_ANY. + * @param ipHeader the Ipv4Header containing the source and destination IP + * addresses for the packet. + * @param packet The packet to be sent if a route is found. + * @param routeReply A callback that packaged up the call to actually send the + * packet. + * @return Returns true if a route is found and the packet has been sent, + * otherwise returns false indicating that the next routing protocol should + * be consulted. In practice, the static routing protocol is the last chance + * protocol. + * + * @see Ipv4StaticRouting + * @see Ipv4RoutingProtocol + */ + virtual bool RequestRoute (uint32_t ifIndex, + Ipv4Header const &ipHeader, Packet packet, RouteReplyCallback routeReply); +/** + * @brief Check to see if we can determine the interface index that will be + * used if a packet is sent to this destination. + * + * This method addresses a problem in the IP stack where a destination address + * must be present and checksummed into the IP header before the actual + * interface over which the packet is sent can be determined. The answer is + * to implement a known and intentional cross-layer violation. This is the + * endpoint of a call chain that started up quite high in the stack (sockets) + * and has found its way down to the Ipv4L3Protocol which is consulting the + * routing protocols for what they would do if presented with a packet of the + * given destination. + * + * Note that the a single interface index is returned. This means that if + * the destination address is a multicast, and an explicit route is present + * that includeds multiple output interfaces, that route cannot be used. + * + * If there are multiple paths out of the node, the resolution is performed + * by Ipv4L3Protocol::GetIfIndexforDestination which has access to more + * contextual information that is useful for making a determination. + * + * @param destination The Ipv4Address if the destination of a hypothetical + * packet. This may be a multicast group address. + * @param ifIndex A reference to the interface index over which a packet + * sent to this destination would be sent. + * @return Returns true if a route is found to the destination that involves + * a single output interface index, otherwise returns false indicating that + * the next routing protocol should be consulted. In practice, the static + * routing protocol is the last chance protocol. + * + * @see Ipv4StaticRouting + * @see Ipv4RoutingProtocol + * @see Ipv4L3Protocol + */ + virtual bool RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex); +/** + * @brief Add a host route to the static routing table. + * + * @param dest The Ipv4Address destination for this route. + * @param nextHop The Ipv4Address of the next hop in the route. + * @param interface The network interface index used to send packets to the + * destination. + * + * @see Ipv4Address + */ void AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, uint32_t interface); +/** + * @brief Add a host route to the static routing table. + * + * @param dest The Ipv4Address destination for this route. + * @param interface The network interface index used to send packets to the + * destination. + * + * @see Ipv4Address + */ void AddHostRouteTo (Ipv4Address dest, uint32_t interface); +/** + * @brief Add a network route to the static routing table. + * + * @param network The Ipv4Address network for this route. + * @param networkmask The Ipv4Mask to extract the network. + * @param nextHop The next hop in the route to the destination network. + * @param interface The network interface index used to send packets to the + * destination. + * + * @see Ipv4Address + */ void AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface); + +/** + * @brief Add a network route to the static routing table. + * + * @param network The Ipv4Address network for this route. + * @param networkmask The Ipv4Mask to extract the network. + * @param interface The network interface index used to send packets to the + * destination. + * + * @see Ipv4Address + */ void AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, uint32_t interface); + +/** + * @brief Add a default route to the static routing table. + * + * This method tells the routing system what to do in the case where a specific + * route to a destination is not found. The system forwards packets to the + * specified node in the hope that it knows better how to route the packet. + * + * If the default route is set, it is returned as the selected route from + * LookupStatic irrespective of destination address if no specific route is + * found. + * + * @param nextHop The Ipv4Address to send packets to in the hope that they + * will be forwarded correctly. + * @param interface The network interface index used to send packets. + * + * @see Ipv4Address + * @see Ipv4StaticRouting::Lookup + */ void SetDefaultRoute (Ipv4Address nextHop, uint32_t interface); + +/** + * @brief Get the number of individual unicast routes that have been added + * to the routing table. + * + * @warning The default route counts as one of the routes. + */ uint32_t GetNRoutes (void); + +/** + * @brief Get the default route from the static routing table. + * + * @return If the default route is set, a pointer to that Ipv4Route is + * returned, otherwise a zero pointer is returned. + * + * @see Ipv4Route + */ + Ipv4Route *GetDefaultRoute (void); + +/** + * @brief Get a route from the static unicast routing table. + * + * Externally, the unicast static routing table appears simply as a table with + * n entries. The one sublety of note is that if a default route has been set + * it will appear as the zeroth entry in the table. This means that if you + * add only a default route, the table will have one entry that can be accessed + * either by explicity calling GetDefaultRoute () or by calling GetRoute (0). + * + * Similarly, if the default route has been set, calling RemoveRoute (0) will + * remove the default route. + * + * @param i The index (into the routing table) of the route to retrieve. If + * the default route has been set, it will occupy index zero. + * @return If route is set, a pointer to that Ipv4Route is returned, otherwise + * a zero pointer is returned. + * + * @see Ipv4Route + * @see Ipv4StaticRouting::RemoveRoute + */ Ipv4Route *GetRoute (uint32_t i); + +/** + * @brief Remove a route from the static unicast routing table. + * + * Externally, the unicast static routing table appears simply as a table with + * n entries. The one sublety of note is that if a default route has been set + * it will appear as the zeroth entry in the table. This means that if the + * default route has been set, calling RemoveRoute (0) will remove the + * default route. + * + * @param i The index (into the routing table) of the route to remove. If + * the default route has been set, it will occupy index zero. + * + * @see Ipv4Route + * @see Ipv4StaticRouting::GetRoute + * @see Ipv4StaticRouting::AddRoute + */ void RemoveRoute (uint32_t i); +/** + * @brief Add a multicast route to the static routing table. + * + * A multicast route must specify an origin IP address, a multicast group and + * an input network interface index as conditions and provide a vector of + * output network interface indices over which packets matching the conditions + * are sent. + * + * Typically there are two main types of multicast routes: routes of the + * first kind are used during forwarding. All of the conditions must be + * exlicitly provided. The second kind of routes are used to get packets off + * of a local node. The difference is in the input interface. Routes for + * forwarding will always have an explicit input interface specified. Routes + * off of a node will always set the input interface to a wildcard specified + * by the index Ipv4RoutingProtocol::IF_INDEX_ANY. + * + * For routes off of a local node wildcards may be used in the origin and + * multicast group addresses. The wildcard used for Ipv4Adresses is that + * address returned by Ipv4Address::GetAny () -- typically "0.0.0.0". Usage + * of a wildcard allows one to specify default behavior to varying degrees. + * + * For example, making the origin address a wildcard, but leaving the + * multicast group specific allows one (in the case of a node with multiple + * interfaces) to create different routes using different output interfaces + * for each multicast group. + * + * If the origin and multicast addresses are made wildcards, you have created + * essentially a default multicast address that can forward to multiple + * interfaces. Compare this to the actual default multicast address that is + * limited to specifying a single output interface for compatibility with + * existing functionality in other systems. + * + * @param origin The Ipv4Address of the origin of packets for this route. May + * be Ipv4Address:GetAny for open groups. + * @param group The Ipv4Address of the multicast group or this route. + * @param inputInterface The input network interface index over which to + * expect packets destined for this route. May be + * Ipv4RoutingProtocol::IF_INDEX_ANY for packets of local origin. + * @param outputInterface A vector of network interface indices used to specify + * how to send packets to the destination(s). + * + * @see Ipv4Address + */ + void AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces); + +/** + * @brief Add a default multicast route to the static routing table. + * + * This is the multicast equivalent of the unicast version SetDefaultRoute. + * We tell the routing system what to do in the case where a specific route + * to a destination multicast group is not found. The system forwards + * packets out the specified interface in the hope that "something out there" + * knows better how to route the packet. This method is only used in + * initially sending packets off of a host. The default multicast route is + * not consulted during forwarding -- exact routes must be specified using + * AddMulticastRoute for that case. + * + * Since we're basically sending packets to some entity we think may know + * better what to do, we don't pay attention to "subtleties" like origin + * address, nor do we worry about forwarding out multiple interfaces. If the + * default multicast route is set, it is returned as the selected route from + * LookupStatic irrespective of origin or multicast group if another specific + * route is not found. + * + * @param outputInterface The network interface index used to specify where + * to send packets in the case of unknown routes. + * + * @see Ipv4Address + */ + void SetDefaultMulticastRoute (uint32_t outputInterface); + +/** + * @brief Get the number of individual multicast routes that have been added + * to the routing table. + * + * @warning The default multicast route counts as one of the routes. + */ + uint32_t GetNMulticastRoutes (void) const; + +/** + * @brief Get a route from the static multicast routing table. + * + * Externally, the multicast static routing table appears simply as a table + * with n entries. The one sublety of note is that if a default route has + * been set it will appear as the zeroth entry in the table. This means that + * if you add only a default route, the table will have one entry that can be + * accessed either by explicity calling GetDefaultMulticastRoute () or by + * calling GetMulticastRoute (0). + * + * Similarly, if the default route has been set, calling + * RemoveMulticastRoute (0) will remove the default route. + * + * @param i The index (into the routing table) of the multicast route to + * retrieve. If the default route has been set, it will occupy index zero. + * @return If route is set, a pointer to that Ipv4MulticastRoute is + * returned, otherwise a zero pointer is returned. + * + * @see Ipv4MulticastRoute + * @see Ipv4StaticRouting::RemoveRoute + */ + Ipv4MulticastRoute *GetMulticastRoute (uint32_t i) const; + +/** + * @brief Get the default multicast route from the static routing table. + * + * @return If the default route is set, a pointer to that Ipv4MulticastRoute is + * returned, otherwise a zero pointer is returned. + * + * @see Ipv4Route + */ + Ipv4MulticastRoute *GetDefaultMulticastRoute (void) const; + +/** + * @brief Remove a route from the static multicast routing table. + * + * Externally, the multicast static routing table appears simply as a table + * with n entries. The one sublety of note is that if a default multicast + * route has been set it will appear as the zeroth entry in the table. This + * means that the default route may be removed by calling this method with + * appropriate wildcard parameters. + * + * This method causes the multicast routing table to be searched for the first + * route that matches the parameters and removes it. + * + * Wildcards may be provided to this function, but the wildcards are used to + * exacly match wildcards in the routes (see AddMulticastRoute). That is, + * calling RemoveMulticastRoute with the origin set to "0.0.0.0" will not + * remove routes with any address in the origin, but will only remove routes + * with "0.0.0.0" set as the the origin. + * + * @param origin The IP address specified as the origin of packets for the + * route. + * @param origin The IP address specified as the multicast group addres of + * the route. + * @param inputInterfade The network interface index specified as the expected + * input interface for the route. + * @returns True if a route was found and removed, false otherwise. + * + * @see Ipv4MulticastRoute + * @see Ipv4StaticRouting::AddMulticastRoute + */ + bool RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface); + +/** + * @brief Remove a route from the static multicast routing table. + * + * Externally, the multicast static routing table appears simply as a table + * with n entries. The one sublety of note is that if a default multicast + * route has been set it will appear as the zeroth entry in the table. This + * means that if the default route has been set, calling + * RemoveMulticastRoute (0) will remove the default route. + * + * @param index The index (into the multicast routing table) of the route to + * remove. If the default route has been set, it will occupy index zero. + * + * @see Ipv4Route + * @see Ipv4StaticRouting::GetRoute + * @see Ipv4StaticRouting::AddRoute + */ + void RemoveMulticastRoute (uint32_t index); + protected: void DoDispose (void); @@ -86,15 +491,21 @@ private: typedef std::list::const_iterator NetworkRoutesCI; typedef std::list::iterator NetworkRoutesI; + typedef std::list MulticastRoutes; + typedef std::list::const_iterator MulticastRoutesCI; + typedef std::list::iterator MulticastRoutesI; + Ipv4Route *LookupStatic (Ipv4Address dest); + Ipv4MulticastRoute *LookupStatic (Ipv4Address origin, Ipv4Address group, + uint32_t ifIndex); HostRoutes m_hostRoutes; NetworkRoutes m_networkRoutes; Ipv4Route *m_defaultRoute; + Ipv4MulticastRoute *m_defaultMulticastRoute; + MulticastRoutes m_multicastRoutes; }; - - } // Namespace ns3 #endif /* IPV4_STATIC_ROUTING_H */ diff --git a/src/internet-node/pcap-trace.cc b/src/internet-node/pcap-trace.cc index 240100fb5..3378b52c5 100644 --- a/src/internet-node/pcap-trace.cc +++ b/src/internet-node/pcap-trace.cc @@ -22,7 +22,7 @@ #include -#include "ns3/trace-root.h" +#include "ns3/node-list.h" #include "ns3/trace-context.h" #include "ns3/callback.h" #include "ns3/pcap-writer.h" @@ -50,8 +50,8 @@ PcapTrace::~PcapTrace () void PcapTrace::TraceAllIp (void) { - TraceRoot::Connect ("/nodes/*/ipv4/(tx|rx)", - MakeCallback (&PcapTrace::LogIp, this)); + NodeList::Connect ("/nodes/*/ipv4/(tx|rx)", + MakeCallback (&PcapTrace::LogIp, this)); } PcapWriter * @@ -83,7 +83,7 @@ void PcapTrace::LogIp (TraceContext const &context, Packet const &p, uint32_t interfaceIndex) { NodeListIndex nodeIndex; - context.Get (nodeIndex); + context.GetElement (nodeIndex); PcapWriter *writer = GetStream (nodeIndex.Get (), interfaceIndex); writer->WritePacket (p); } diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index f0ef8569b..cbf8cbf52 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -19,9 +19,9 @@ * Author: Mathieu Lacage */ +#include "ns3/log.h" #include "ns3/assert.h" #include "ns3/packet.h" -#include "ns3/empty-trace-resolver.h" #include "ns3/node.h" #include "udp-l4-protocol.h" @@ -31,6 +31,8 @@ #include "ipv4-l3-protocol.h" #include "udp-socket.h" +NS_LOG_COMPONENT_DEFINE ("UdpL4Protocol"); + namespace ns3 { /* see http://www.iana.org/assignments/protocol-numbers */ @@ -40,20 +42,19 @@ UdpL4Protocol::UdpL4Protocol (Ptr node) : Ipv4L4Protocol (PROT_NUMBER, 2), m_node (node), m_endPoints (new Ipv4EndPointDemux ()) -{} +{ + NS_LOG_FUNCTION; +} UdpL4Protocol::~UdpL4Protocol () -{} - -TraceResolver * -UdpL4Protocol::CreateTraceResolver (TraceContext const &context) { - return new EmptyTraceResolver (context); + NS_LOG_FUNCTION; } void UdpL4Protocol::DoDispose (void) { + NS_LOG_FUNCTION; if (m_endPoints != 0) { delete m_endPoints; @@ -66,6 +67,7 @@ UdpL4Protocol::DoDispose (void) Ptr UdpL4Protocol::CreateSocket (void) { + NS_LOG_FUNCTION; Ptr socket = Create (m_node, this); return socket; } @@ -73,27 +75,40 @@ UdpL4Protocol::CreateSocket (void) Ipv4EndPoint * UdpL4Protocol::Allocate (void) { + NS_LOG_FUNCTION; return m_endPoints->Allocate (); } + Ipv4EndPoint * UdpL4Protocol::Allocate (Ipv4Address address) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << address << ")"); return m_endPoints->Allocate (address); } + Ipv4EndPoint * UdpL4Protocol::Allocate (uint16_t port) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << port << ")"); return m_endPoints->Allocate (port); } + Ipv4EndPoint * UdpL4Protocol::Allocate (Ipv4Address address, uint16_t port) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << address << ", " << port << ")"); return m_endPoints->Allocate (address, port); } Ipv4EndPoint * UdpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort, Ipv4Address peerAddress, uint16_t peerPort) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << localAddress << ", " << localPort << ", " << + peerAddress << ", " << peerPort << ")"); return m_endPoints->Allocate (localAddress, localPort, peerAddress, peerPort); } @@ -101,19 +116,26 @@ UdpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort, void UdpL4Protocol::DeAllocate (Ipv4EndPoint *endPoint) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << endPoint << ")"); m_endPoints->DeAllocate (endPoint); } void UdpL4Protocol::Receive(Packet& packet, - Ipv4Address const &source, - Ipv4Address const &destination) + Ipv4Address const &source, + Ipv4Address const &destination, + Ptr interface) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &packet << ", " << source << ", " << destination << + ")"); + UdpHeader udpHeader; packet.RemoveHeader (udpHeader); Ipv4EndPointDemux::EndPoints endPoints = m_endPoints->Lookup (destination, udpHeader.GetDestination (), - source, udpHeader.GetSource ()); + source, udpHeader.GetSource (), interface); for (Ipv4EndPointDemux::EndPointsI endPoint = endPoints.begin (); endPoint != endPoints.end (); endPoint++) { @@ -126,6 +148,10 @@ UdpL4Protocol::Send (Packet packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &packet << ", " << saddr << ", " << daddr << ", " << + sport << ", " << dport << ")"); + UdpHeader udpHeader; udpHeader.SetDestination (dport); udpHeader.SetSource (sport); @@ -139,6 +165,7 @@ UdpL4Protocol::Send (Packet packet, Ptr ipv4 = m_node->QueryInterface (Ipv4L3Protocol::iid); if (ipv4 != 0) { + NS_LOG_LOGIC ("Sending to IP"); ipv4->Send (packet, saddr, daddr, PROT_NUMBER); } } diff --git a/src/internet-node/udp-l4-protocol.h b/src/internet-node/udp-l4-protocol.h index 4d7a082d4..10502e10c 100644 --- a/src/internet-node/udp-l4-protocol.h +++ b/src/internet-node/udp-l4-protocol.h @@ -49,7 +49,6 @@ public: UdpL4Protocol (Ptr node); virtual ~UdpL4Protocol (); - virtual TraceResolver *CreateTraceResolver (TraceContext const &context); /** * \return A smart Socket pointer to a UdpSocket, allocated by this instance * of the UDP protocol @@ -86,7 +85,8 @@ public: // inherited from Ipv4L4Protocol virtual void Receive(Packet& p, Ipv4Address const &source, - Ipv4Address const &destination); + Ipv4Address const &destination, + Ptr interface); protected: virtual void DoDispose (void); private: diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index a2bde3224..e890f87ec 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -18,12 +18,19 @@ * * Author: Mathieu Lacage */ + +#include "ns3/log.h" #include "ns3/node.h" #include "ns3/inet-socket-address.h" +#include "ns3/ipv4-route.h" +#include "ns3/ipv4.h" #include "udp-socket.h" #include "udp-l4-protocol.h" #include "ipv4-end-point.h" #include "ipv4-l4-demux.h" +#include "ns3/ipv4.h" + +NS_LOG_COMPONENT_DEFINE ("UdpSocket"); namespace ns3 { @@ -35,9 +42,14 @@ UdpSocket::UdpSocket (Ptr node, Ptr udp) m_shutdownSend (false), m_shutdownRecv (false), m_connected (false) -{} +{ + NS_LOG_FUNCTION; +} + UdpSocket::~UdpSocket () { + NS_LOG_FUNCTION; + m_node = 0; if (m_endPoint != 0) { @@ -60,25 +72,30 @@ UdpSocket::~UdpSocket () enum Socket::SocketErrno UdpSocket::GetErrno (void) const { + NS_LOG_FUNCTION; return m_errno; } Ptr UdpSocket::GetNode (void) const { + NS_LOG_FUNCTION; return m_node; } void UdpSocket::Destroy (void) { + NS_LOG_FUNCTION; m_node = 0; m_endPoint = 0; m_udp = 0; } + int UdpSocket::FinishBind (void) { + NS_LOG_FUNCTION; if (m_endPoint == 0) { return -1; @@ -91,14 +108,20 @@ UdpSocket::FinishBind (void) int UdpSocket::Bind (void) { + NS_LOG_FUNCTION; m_endPoint = m_udp->Allocate (); return FinishBind (); } + int UdpSocket::Bind (const Address &address) { + NS_LOG_FUNCTION; + NS_LOG_PARAM("(" << address << ")"); + if (!InetSocketAddress::IsMatchingType (address)) { + NS_LOG_ERROR ("Not IsMatchingType"); return ERROR_INVAL; } InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); @@ -127,12 +150,15 @@ UdpSocket::Bind (const Address &address) int UdpSocket::ShutdownSend (void) { + NS_LOG_FUNCTION; m_shutdownSend = true; return 0; } + int UdpSocket::ShutdownRecv (void) { + NS_LOG_FUNCTION; m_shutdownRecv = false; return 0; } @@ -140,6 +166,7 @@ UdpSocket::ShutdownRecv (void) int UdpSocket::Close(void) { + NS_LOG_FUNCTION; NotifyCloseCompleted (); return 0; } @@ -147,34 +174,84 @@ UdpSocket::Close(void) int UdpSocket::Connect(const Address & address) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << address << ")"); + Ipv4Route routeToDest; InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); m_defaultAddress = transport.GetIpv4 (); m_defaultPort = transport.GetPort (); NotifyConnectionSucceeded (); m_connected = true; + return 0; } + int UdpSocket::Send (const Packet &p) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); + if (!m_connected) { m_errno = ERROR_NOTCONN; return -1; } + return DoSend (p); +} + +int +UdpSocket::DoSend (const Packet &p) +{ + NS_LOG_FUNCTION; + if (m_endPoint == 0) + { + if (Bind () == -1) + { + NS_ASSERT (m_endPoint == 0); + return -1; + } + NS_ASSERT (m_endPoint != 0); + } + if (m_shutdownSend) + { + m_errno = ERROR_SHUTDOWN; + return -1; + } + return DoSendTo (p, m_defaultAddress, m_defaultPort); } + int UdpSocket::DoSendTo (const Packet &p, const Address &address) { - InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); - Ipv4Address ipv4 = transport.GetIpv4 (); - uint16_t port = transport.GetPort (); - return DoSendTo (p, ipv4, port); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << address << ")"); + + if (!m_connected) + { + NS_LOG_LOGIC ("Not connected"); + InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); + Ipv4Address ipv4 = transport.GetIpv4 (); + uint16_t port = transport.GetPort (); + return DoSendTo (p, ipv4, port); + } + else + { + // connected UDP socket must use default addresses + NS_LOG_LOGIC ("Connected"); + return DoSendTo (p, m_defaultAddress, m_defaultPort); + } } + int -UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) +UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ", " << dest << ", " << port << ")"); + + Ipv4Route routeToDest; + if (m_endPoint == 0) { if (Bind () == -1) @@ -189,19 +266,49 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port) m_errno = ERROR_SHUTDOWN; return -1; } - m_udp->Send (p, m_endPoint->GetLocalAddress (), ipv4, + + uint32_t localIfIndex; + Ptr ipv4 = m_node->QueryInterface (Ipv4::iid); + + // + // If dest is sent to the limited broadcast address (all ones), + // convert it to send a copy of the packet out of every interface + // + if (dest.IsBroadcast ()) + { + NS_LOG_LOGIC ("Limited broadcast"); + for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++ ) + { + Ipv4Address addri = ipv4->GetAddress (i); + Ipv4Mask maski = ipv4->GetNetworkMask (i); + m_udp->Send (p, addri, addri.GetSubnetDirectedBroadcast (maski), + m_endPoint->GetLocalPort (), port); + NotifyDataSent (p.GetSize ()); + } + } + else if (ipv4->GetIfIndexForDestination(dest, localIfIndex)) + { + NS_LOG_LOGIC ("Route exists"); + m_udp->Send (p, ipv4->GetAddress (localIfIndex), dest, m_endPoint->GetLocalPort (), port); - NotifyDataSent (p.GetSize ()); + NotifyDataSent (p.GetSize ()); + return 0; + } + else + { + NS_LOG_ERROR ("ERROR_NOROUTETOHOST"); + m_errno = ERROR_NOROUTETOHOST; + return -1; + } + return 0; } + int UdpSocket::SendTo(const Address &address, const Packet &p) { - if (m_connected) - { - m_errno = ERROR_ISCONN; - return -1; - } + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << address << ", " << &p << ")"); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); Ipv4Address ipv4 = transport.GetIpv4 (); uint16_t port = transport.GetPort (); @@ -211,6 +318,9 @@ UdpSocket::SendTo(const Address &address, const Packet &p) void UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &packet << ", " << ipv4 << ", " << port << ")"); + if (m_shutdownRecv) { return; @@ -221,4 +331,133 @@ UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port) NotifyDataReceived (p, address); } -}//namespace ns3 +} //namespace ns3 + + +#ifdef RUN_SELF_TESTS + +#include "ns3/test.h" +#include "ns3/internet-node.h" +#include "ns3/socket-factory.h" +#include "ns3/udp.h" +#include "ns3/simulator.h" +#include "ns3/point-to-point-channel.h" +#include "ns3/point-to-point-net-device.h" +#include "ns3/drop-tail-queue.h" +#include + +namespace ns3 { + +class UdpSocketTest: public Test +{ + Packet m_receivedPacket; + Packet m_receivedPacket2; + +public: + virtual bool RunTests (void); + UdpSocketTest (); + + void ReceivePacket (Ptr socket, const Packet &packet, const Address &from); + void ReceivePacket2 (Ptr socket, const Packet &packet, const Address &from); +}; + + +UdpSocketTest::UdpSocketTest () + : Test ("UdpSocket") {} + + +void UdpSocketTest::ReceivePacket (Ptr socket, const Packet &packet, const Address &from) +{ + m_receivedPacket = packet; +} + +void UdpSocketTest::ReceivePacket2 (Ptr socket, const Packet &packet, const Address &from) +{ + m_receivedPacket2 = packet; +} + +bool +UdpSocketTest::RunTests (void) +{ + bool result = true; + + // Create topology + + // Receiver Node + Ptr rxNode = Create (); + Ptr rxDev = Create (rxNode); + rxDev->AddQueue(Create ()); + Ptr ipv4 = rxNode->QueryInterface (Ipv4::iid); + uint32_t netdev_idx = ipv4->AddInterface (rxDev); + ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.1")); + ipv4->SetNetworkMask (netdev_idx, Ipv4Mask (0xffff0000U)); + ipv4->SetUp (netdev_idx); + + // Sender Node + Ptr txNode = Create (); + Ptr txDev = Create (txNode); + txDev->AddQueue(Create ()); + ipv4 = txNode->QueryInterface (Ipv4::iid); + netdev_idx = ipv4->AddInterface (txDev); + ipv4->SetAddress (netdev_idx, Ipv4Address ("10.0.0.2")); + ipv4->SetNetworkMask (netdev_idx, Ipv4Mask (0xffff0000U)); + ipv4->SetUp (netdev_idx); + + // link the two nodes + Ptr channel = Create (); + rxDev->Attach (channel); + txDev->Attach (channel); + + + // Create the UDP sockets + Ptr rxSocketFactory = rxNode->QueryInterface (Udp::iid); + Ptr rxSocket = rxSocketFactory->CreateSocket (); + NS_TEST_ASSERT_EQUAL (rxSocket->Bind (InetSocketAddress (Ipv4Address ("10.0.0.2"), 1234)), 0); + rxSocket->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket, this)); + + Ptr txSocketFactory = txNode->QueryInterface (Udp::iid); + Ptr txSocket = txSocketFactory->CreateSocket (); + + // ------ Now the tests ------------ + + // Unicast test + m_receivedPacket = Packet (); + NS_TEST_ASSERT_EQUAL (txSocket->SendTo (InetSocketAddress (Ipv4Address("10.0.0.1"), 1234), + Packet (123)), 0); + Simulator::Run (); + NS_TEST_ASSERT_EQUAL (m_receivedPacket.GetSize (), 123); + + + // Simple broadcast test + + m_receivedPacket = Packet (); + NS_TEST_ASSERT_EQUAL (txSocket->SendTo (InetSocketAddress (Ipv4Address("255.255.255.255"), 1234), + Packet (123)), 0); + Simulator::Run (); + NS_TEST_ASSERT_EQUAL (m_receivedPacket.GetSize (), 123); + + // Broadcast test with multiple receiving sockets + + // When receiving broadcast packets, all sockets sockets bound to + // the address/port should receive a copy of the same packet. + Ptr rxSocket2 = rxSocketFactory->CreateSocket (); + rxSocket2->SetRecvCallback (MakeCallback (&UdpSocketTest::ReceivePacket2, this)); + NS_TEST_ASSERT_EQUAL (rxSocket2->Bind (InetSocketAddress (Ipv4Address ("0.0.0.0"), 1234)), 0); + + m_receivedPacket = Packet (); + m_receivedPacket2 = Packet (); + NS_TEST_ASSERT_EQUAL (txSocket->SendTo (InetSocketAddress (Ipv4Address("255.255.255.255"), 1234), + Packet (123)), 0); + Simulator::Run (); + NS_TEST_ASSERT_EQUAL (m_receivedPacket.GetSize (), 123); + NS_TEST_ASSERT_EQUAL (m_receivedPacket2.GetSize (), 123); + + return result; +} + + +static UdpSocketTest gUdpSocketTest; + +}; // namespace ns3 + +#endif /* RUN_SELF_TESTS */ diff --git a/src/internet-node/udp-socket.h b/src/internet-node/udp-socket.h index b3674f7ef..332e679d7 100644 --- a/src/internet-node/udp-socket.h +++ b/src/internet-node/udp-socket.h @@ -62,6 +62,7 @@ private: int FinishBind (void); void ForwardUp (const Packet &p, Ipv4Address ipv4, uint16_t port); void Destroy (void); + int DoSend (const Packet &p); int DoSendTo (const Packet &p, const Address &daddr); int DoSendTo (const Packet &p, Ipv4Address daddr, uint16_t dport); diff --git a/src/internet-node/waf b/src/internet-node/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/internet-node/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/internet-node/wscript b/src/internet-node/wscript index a5f5ec6ef..3bb60d1bb 100644 --- a/src/internet-node/wscript +++ b/src/internet-node/wscript @@ -2,7 +2,7 @@ def build(bld): - obj = bld.create_ns3_module('internet-node', ['node', 'applications']) + obj = bld.create_ns3_module('internet-node', ['node']) obj.source = [ 'internet-node.cc', 'ipv4-l4-demux.cc', diff --git a/src/mobility/grid-topology.cc b/src/mobility/grid-topology.cc index fbf7d2511..625cb49ae 100644 --- a/src/mobility/grid-topology.cc +++ b/src/mobility/grid-topology.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/grid-topology.h b/src/mobility/grid-topology.h index 93457503d..75ea42535 100644 --- a/src/mobility/grid-topology.h +++ b/src/mobility/grid-topology.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/hierarchical-mobility-model.cc b/src/mobility/hierarchical-mobility-model.cc index 7e4aa3fe3..00f4643c2 100644 --- a/src/mobility/hierarchical-mobility-model.cc +++ b/src/mobility/hierarchical-mobility-model.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 @@ -41,8 +40,8 @@ HierarchicalMobilityModel::HierarchicalMobilityModel (Ptr child, parentNotifier = Create (); parent->AddInterface (parentNotifier); } - childNotifier->RegisterListener (MakeCallback (&HierarchicalMobilityModel::ChildChanged, this)); - parentNotifier->RegisterListener (MakeCallback (&HierarchicalMobilityModel::ParentChanged, this)); + childNotifier->TraceConnect ("/course-changed", MakeCallback (&HierarchicalMobilityModel::ChildChanged, this)); + parentNotifier->TraceConnect ("/course-changed", MakeCallback (&HierarchicalMobilityModel::ParentChanged, this)); } Ptr @@ -89,13 +88,13 @@ HierarchicalMobilityModel::DoGetSpeed (void) const } void -HierarchicalMobilityModel::ParentChanged (Ptr model) +HierarchicalMobilityModel::ParentChanged (const TraceContext &context, Ptr model) { MobilityModel::NotifyCourseChange (); } void -HierarchicalMobilityModel::ChildChanged (Ptr model) +HierarchicalMobilityModel::ChildChanged (const TraceContext &context, Ptr model) { MobilityModel::NotifyCourseChange (); } diff --git a/src/mobility/hierarchical-mobility-model.h b/src/mobility/hierarchical-mobility-model.h index 1502c516a..44623244d 100644 --- a/src/mobility/hierarchical-mobility-model.h +++ b/src/mobility/hierarchical-mobility-model.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 @@ -63,8 +62,8 @@ private: virtual void DoSet (const Position &position); virtual Speed DoGetSpeed (void) const; - void ParentChanged (Ptr model); - void ChildChanged (Ptr model); + void ParentChanged (const TraceContext &context, Ptr model); + void ChildChanged (const TraceContext &context, Ptr model); Ptr m_child; Ptr m_parent; diff --git a/src/mobility/mobility-model-notifier.cc b/src/mobility/mobility-model-notifier.cc index abb476c20..4b87dd066 100644 --- a/src/mobility/mobility-model-notifier.cc +++ b/src/mobility/mobility-model-notifier.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 @@ -19,6 +18,8 @@ * Author: Mathieu Lacage */ #include "mobility-model-notifier.h" +#include "ns3/composite-trace-resolver.h" +#include "ns3/trace-doc.h" namespace ns3 { @@ -32,37 +33,24 @@ MobilityModelNotifier::MobilityModelNotifier () SetInterfaceId (MobilityModelNotifier::iid); } -void -MobilityModelNotifier::RegisterListener (Listener listener) -{ - m_listeners.push_back (listener); -} -void -MobilityModelNotifier::UnregisterListener (Listener callback) -{ - for (std::list::iterator i = m_listeners.begin (); - i != m_listeners.end ();) - { - Listener listener = *i; - if (listener.IsEqual (callback)) - { - i = m_listeners.erase (i); - } - else - { - i++; - } - } -} void MobilityModelNotifier::Notify (Ptr position) const { - for (std::list::const_iterator i = m_listeners.begin (); - i != m_listeners.end (); i++) - { - Listener listener = *i; - listener (position); - } + m_trace (position); +} + +Ptr +MobilityModelNotifier::GetTraceResolver (void) const +{ + Ptr resolver = + Create (); + resolver->AddSource ("course-change", + TraceDoc ("The value of the speed vector changed", + "Ptr", + "the mobility model whose course changed"), + m_trace); + resolver->SetParentResolver (Object::GetTraceResolver ()); + return resolver; } } // namespace ns3 diff --git a/src/mobility/mobility-model-notifier.h b/src/mobility/mobility-model-notifier.h index 8aec327de..e3616b904 100644 --- a/src/mobility/mobility-model-notifier.h +++ b/src/mobility/mobility-model-notifier.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 @@ -24,6 +23,7 @@ #include "ns3/object.h" #include "ns3/component-manager.h" #include "ns3/callback.h" +#include "ns3/callback-trace-source.h" #include "mobility-model.h" namespace ns3 { @@ -37,8 +37,6 @@ public: static const InterfaceId iid; static const ClassId cid; - typedef Callback > Listener; - /** * Create a new position notifier */ @@ -48,23 +46,10 @@ public: * \param position the position which just changed. */ void Notify (Ptr position) const; - - /** - * \param listener listener to add - * - * The listener will be notified upon every position change. - */ - void RegisterListener (Listener listener); - /** - * \param listener listener to remove - * - * The listener will not be notified anymore upon every - * position change. It is not an error to try to unregister - * a non-registered liste - */ - void UnregisterListener (Listener listener); +protected: + virtual Ptr GetTraceResolver (void) const; private: - std::list m_listeners; + CallbackTraceSource > m_trace; }; } // namespace ns3 diff --git a/src/mobility/mobility-model.cc b/src/mobility/mobility-model.cc index 808c5f4dd..50965d800 100644 --- a/src/mobility/mobility-model.cc +++ b/src/mobility/mobility-model.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2006,2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/mobility-model.h b/src/mobility/mobility-model.h index 5d0e6ee4a..07fd171ea 100644 --- a/src/mobility/mobility-model.h +++ b/src/mobility/mobility-model.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2006,2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/position.cc b/src/mobility/position.cc index 802fe3bb7..2418cb61e 100644 --- a/src/mobility/position.cc +++ b/src/mobility/position.cc @@ -1,3 +1,22 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * + * 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: Mathieu Lacage + */ #include "position.h" #include diff --git a/src/mobility/position.h b/src/mobility/position.h index d34fadfb2..08ab9a134 100644 --- a/src/mobility/position.h +++ b/src/mobility/position.h @@ -1,4 +1,22 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * + * 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: Mathieu Lacage + */ #ifndef POSITION_H #define POSITION_H diff --git a/src/mobility/random-position.cc b/src/mobility/random-position.cc index 93a3d825e..4e2a79f69 100644 --- a/src/mobility/random-position.cc +++ b/src/mobility/random-position.cc @@ -1,11 +1,30 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * + * 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: Mathieu Lacage + */ #include "random-position.h" #include "ns3/random-variable.h" #include "ns3/default-value.h" #include "ns3/random-variable-default-value.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include -NS_DEBUG_COMPONENT_DEFINE ("RandomPosition"); +NS_LOG_COMPONENT_DEFINE ("RandomPosition"); namespace ns3 { @@ -108,7 +127,7 @@ RandomDiscPosition::Get (void) const double rho = m_rho->GetValue (); double x = m_x + std::cos (theta) * rho; double y = m_y + std::sin (theta) * rho; - NS_DEBUG ("Disc position x=" << x << ", y=" << y); + NS_LOG_DEBUG ("Disc position x=" << x << ", y=" << y); return Position (x, y, 0.0); } diff --git a/src/mobility/random-position.h b/src/mobility/random-position.h index 8fcc54a6d..04a5b6890 100644 --- a/src/mobility/random-position.h +++ b/src/mobility/random-position.h @@ -1,4 +1,22 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * + * 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: Mathieu Lacage + */ #ifndef RANDOM_POSITION_H #define RANDOM_POSITION_H diff --git a/src/mobility/rectangle-default-value.cc b/src/mobility/rectangle-default-value.cc index 1526f5a8e..389a696d0 100644 --- a/src/mobility/rectangle-default-value.cc +++ b/src/mobility/rectangle-default-value.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/rectangle-default-value.h b/src/mobility/rectangle-default-value.h index 047e7bbb6..bc35b7440 100644 --- a/src/mobility/rectangle-default-value.h +++ b/src/mobility/rectangle-default-value.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/rectangle.cc b/src/mobility/rectangle.cc index 34e23e58b..5ae589b8c 100644 --- a/src/mobility/rectangle.cc +++ b/src/mobility/rectangle.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/rectangle.h b/src/mobility/rectangle.h index a53f641d6..df519b545 100644 --- a/src/mobility/rectangle.h +++ b/src/mobility/rectangle.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/speed.cc b/src/mobility/speed.cc index 3f97ded7c..c6abd0c1d 100644 --- a/src/mobility/speed.cc +++ b/src/mobility/speed.cc @@ -1,3 +1,22 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * + * 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: Mathieu Lacage + */ #include "speed.h" namespace ns3 { diff --git a/src/mobility/speed.h b/src/mobility/speed.h index 317fc4333..d64b1e63b 100644 --- a/src/mobility/speed.h +++ b/src/mobility/speed.h @@ -1,4 +1,22 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2007 INRIA + * + * 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: Mathieu Lacage + */ #ifndef SPEED_H #define SPEED_H diff --git a/src/mobility/static-mobility-model.cc b/src/mobility/static-mobility-model.cc index e6d68f5c3..5142b8178 100644 --- a/src/mobility/static-mobility-model.cc +++ b/src/mobility/static-mobility-model.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2006 INRIA - * All rights reserved. + * Copyright (c) 2006,2007 INRIA * * 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 diff --git a/src/mobility/static-mobility-model.h b/src/mobility/static-mobility-model.h index d70890cc0..a1215c08a 100644 --- a/src/mobility/static-mobility-model.h +++ b/src/mobility/static-mobility-model.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2006,2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/static-speed-helper.cc b/src/mobility/static-speed-helper.cc index b46f88721..82a3dd029 100644 --- a/src/mobility/static-speed-helper.cc +++ b/src/mobility/static-speed-helper.cc @@ -1,3 +1,22 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006,2007 INRIA + * + * 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: Mathieu Lacage + */ #include "ns3/simulator.h" #include "ns3/rectangle.h" #include "static-speed-helper.h" diff --git a/src/mobility/static-speed-helper.h b/src/mobility/static-speed-helper.h index 8737f2edd..24e1c6237 100644 --- a/src/mobility/static-speed-helper.h +++ b/src/mobility/static-speed-helper.h @@ -1,4 +1,22 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006,2007 INRIA + * + * 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: Mathieu Lacage + */ #ifndef STATIC_SPEED_HELPER_H #define STATIC_SPEED_HELPER_H diff --git a/src/mobility/static-speed-mobility-model.cc b/src/mobility/static-speed-mobility-model.cc index d4cfc9873..3f0dd3229 100644 --- a/src/mobility/static-speed-mobility-model.cc +++ b/src/mobility/static-speed-mobility-model.cc @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2006, 2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/static-speed-mobility-model.h b/src/mobility/static-speed-mobility-model.h index 74f5b51f9..85d4793d7 100644 --- a/src/mobility/static-speed-mobility-model.h +++ b/src/mobility/static-speed-mobility-model.h @@ -1,7 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2006, 2007 INRIA - * All rights reserved. * * 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 diff --git a/src/mobility/waf b/src/mobility/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/mobility/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/node/address-utils.cc b/src/node/address-utils.cc index 08c5b1736..da436e4cd 100644 --- a/src/node/address-utils.cc +++ b/src/node/address-utils.cc @@ -32,7 +32,7 @@ void WriteTo (Buffer::Iterator &i, const Address &ad) ad.CopyTo (mac); i.Write (mac, ad.GetLength ()); } -void WriteTo (Buffer::Iterator &i, Eui48Address ad) +void WriteTo (Buffer::Iterator &i, Mac48Address ad) { uint8_t mac[6]; ad.CopyTo (mac); @@ -49,7 +49,7 @@ void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len) i.Read (mac, len); ad.CopyFrom (mac, len); } -void ReadFrom (Buffer::Iterator &i, Eui48Address &ad) +void ReadFrom (Buffer::Iterator &i, Mac48Address &ad) { uint8_t mac[6]; i.Read (mac, 6); diff --git a/src/node/address-utils.h b/src/node/address-utils.h index 1403c544a..db9f08064 100644 --- a/src/node/address-utils.h +++ b/src/node/address-utils.h @@ -24,17 +24,17 @@ #include "ns3/buffer.h" #include "ipv4-address.h" #include "address.h" -#include "eui48-address.h" +#include "mac48-address.h" namespace ns3 { void WriteTo (Buffer::Iterator &i, Ipv4Address ad); void WriteTo (Buffer::Iterator &i, const Address &ad); -void WriteTo (Buffer::Iterator &i, Eui48Address ad); +void WriteTo (Buffer::Iterator &i, Mac48Address ad); void ReadFrom (Buffer::Iterator &i, Ipv4Address &ad); void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len); -void ReadFrom (Buffer::Iterator &i, Eui48Address &ad); +void ReadFrom (Buffer::Iterator &i, Mac48Address &ad); }; diff --git a/src/node/channel.cc b/src/node/channel.cc index 25db07984..e809b6dbc 100644 --- a/src/node/channel.cc +++ b/src/node/channel.cc @@ -14,16 +14,12 @@ * 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: Craig Dowell - * - * Thu Feb 15 14:50:46 PST 2007 craigdo: Created. */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "channel.h" -NS_DEBUG_COMPONENT_DEFINE ("Channel"); +NS_LOG_COMPONENT_DEFINE ("Channel"); namespace ns3 { @@ -32,31 +28,35 @@ const InterfaceId Channel::iid = MakeInterfaceId ("Channel", Object::iid); Channel::Channel () : m_name("Channel") { + NS_LOG_FUNCTION; SetInterfaceId (Channel::iid); - NS_DEBUG("Channel::Channel ()"); } Channel::Channel (std::string name) : m_name(name) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << name << ")"); SetInterfaceId (Channel::iid); - NS_DEBUG("Channel::Channel (" << name << ")"); } Channel::~Channel () { - NS_DEBUG("Channel::~Channel ()"); + NS_LOG_FUNCTION; } void Channel::SetName(std::string name) { + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << name << ")"); m_name = name; } std::string Channel::GetName(void) { + NS_LOG_FUNCTION; return m_name; } diff --git a/src/node/drop-tail-queue.cc b/src/node/drop-tail-queue.cc index 74c8fde17..8b5ceea79 100644 --- a/src/node/drop-tail-queue.cc +++ b/src/node/drop-tail-queue.cc @@ -17,10 +17,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "drop-tail-queue.h" -NS_DEBUG_COMPONENT_DEFINE ("DropTailQueue"); +NS_LOG_COMPONENT_DEFINE ("DropTailQueue"); namespace ns3 { @@ -33,38 +33,39 @@ DropTailQueue::DropTailQueue () : m_packets (), m_maxPackets(DTQ_NPACKETS_MAX_DEFAULT) { - NS_DEBUG("DropTailQueue::DropTailQueue ()"); + NS_LOG_FUNCTION; } DropTailQueue::~DropTailQueue () { - NS_DEBUG("DropTailQueue::~DropTailQueue ()"); + NS_LOG_FUNCTION; } void DropTailQueue::SetMaxPackets (uint32_t npackets) { - NS_DEBUG("DropTailQueue::SetMaxPackets (" << npackets << ")"); - + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << npackets << ")"); m_maxPackets = npackets; } uint32_t DropTailQueue::GetMaxPackets (void) { - NS_DEBUG("DropTailQueue::GetMaxPackets () <= " << m_maxPackets); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("returns " << m_maxPackets); return m_maxPackets; } bool DropTailQueue::DoEnqueue (const Packet& p) { - NS_DEBUG("DropTailQueue::DoEnqueue (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); if (m_packets.size () >= m_maxPackets) { - NS_DEBUG("DropTailQueue::DoEnqueue (): Queue full -- droppping pkt"); + NS_LOG_LOGIC ("Queue full -- droppping pkt"); Drop (p); return false; } @@ -76,18 +77,19 @@ DropTailQueue::DoEnqueue (const Packet& p) bool DropTailQueue::DoDequeue (Packet& p) { - NS_DEBUG("DropTailQueue::DoDequeue (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); if (m_packets.empty()) { - NS_DEBUG("DropTailQueue::DoDequeue (): Queue empty"); + NS_LOG_LOGIC ("Queue empty"); return false; } p = m_packets.front (); m_packets.pop (); - NS_DEBUG("DropTailQueue::DoDequeue (): Popped " << &p << " <= true"); + NS_LOG_LOGIC ("Popped " << &p); return true; } @@ -95,11 +97,12 @@ DropTailQueue::DoDequeue (Packet& p) bool DropTailQueue::DoPeek (Packet& p) { - NS_DEBUG("DropTailQueue::DoPeek (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); if (m_packets.empty()) { - NS_DEBUG("DropTailQueue::DoPeek (): Queue empty"); + NS_LOG_LOGIC ("Queue empty"); return false; } diff --git a/src/node/ethernet-header.cc b/src/node/ethernet-header.cc index 88803b4f5..ce2241f50 100644 --- a/src/node/ethernet-header.cc +++ b/src/node/ethernet-header.cc @@ -22,12 +22,12 @@ #include #include #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/header.h" #include "ethernet-header.h" #include "address-utils.h" -NS_DEBUG_COMPONENT_DEFINE ("EthernetHeader"); +NS_LOG_COMPONENT_DEFINE ("EthernetHeader"); namespace ns3 { @@ -73,22 +73,22 @@ EthernetHeader::GetPreambleSfd (void) const } void -EthernetHeader::SetSource (Eui48Address source) +EthernetHeader::SetSource (Mac48Address source) { m_source = source; } -Eui48Address +Mac48Address EthernetHeader::GetSource (void) const { return m_source; } void -EthernetHeader::SetDestination (Eui48Address dst) +EthernetHeader::SetDestination (Mac48Address dst) { m_destination = dst; } -Eui48Address +Mac48Address EthernetHeader::GetDestination (void) const { return m_destination; diff --git a/src/node/ethernet-header.h b/src/node/ethernet-header.h index b1b3d1998..f0c653722 100644 --- a/src/node/ethernet-header.h +++ b/src/node/ethernet-header.h @@ -24,7 +24,7 @@ #include "ns3/header.h" #include -#include "ns3/eui48-address.h" +#include "ns3/mac48-address.h" namespace ns3 { @@ -69,11 +69,11 @@ public: /** * \param source The source address of this packet */ - void SetSource (Eui48Address source); + void SetSource (Mac48Address source); /** * \param destination The destination address of this packet. */ - void SetDestination (Eui48Address destination); + void SetDestination (Mac48Address destination); /** * \param preambleSfd The value that the preambleSfd field should take */ @@ -89,11 +89,11 @@ public: /** * \return The source address of this packet */ - Eui48Address GetSource (void) const; + Mac48Address GetSource (void) const; /** * \return The destination address of this packet */ - Eui48Address GetDestination (void) const; + Mac48Address GetDestination (void) const; /** * \return The value of the PreambleSfd field */ @@ -119,8 +119,8 @@ private: bool m_enPreambleSfd; uint64_t m_preambleSfd; /// Value of the Preamble/SFD fields uint16_t m_lengthType; /// Length or type of the packet - Eui48Address m_source; /// Source address - Eui48Address m_destination; /// Destination address + Mac48Address m_source; /// Source address + Mac48Address m_destination; /// Destination address }; }; // namespace ns3 diff --git a/src/node/ethernet-trailer.cc b/src/node/ethernet-trailer.cc index 6fdb5a845..049fe24d0 100644 --- a/src/node/ethernet-trailer.cc +++ b/src/node/ethernet-trailer.cc @@ -20,11 +20,11 @@ */ #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/trailer.h" #include "ethernet-trailer.h" -NS_DEBUG_COMPONENT_DEFINE ("EthernetTrailer"); +NS_LOG_COMPONENT_DEFINE ("EthernetTrailer"); namespace ns3 { @@ -62,7 +62,7 @@ EthernetTrailer::CheckFcs (const Packet& p) const { return true; } else { - NS_DEBUG("FCS calculation is not yet enabled" << std::endl); + NS_LOG_WARN ("FCS calculation is not yet enabled"); return false; } } @@ -70,7 +70,7 @@ EthernetTrailer::CheckFcs (const Packet& p) const void EthernetTrailer::CalcFcs (const Packet& p) { - NS_DEBUG("FCS calculation is not yet enabled" << std::endl); + NS_LOG_WARN ("FCS calculation is not yet enabled"); } void diff --git a/src/node/inet-socket-address.cc b/src/node/inet-socket-address.cc index 58b589586..d4b7453a9 100644 --- a/src/node/inet-socket-address.cc +++ b/src/node/inet-socket-address.cc @@ -1,3 +1,24 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2005 INRIA + * All rights reserved. + * + * 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: Mathieu Lacage + */ + #include "inet-socket-address.h" #include "ns3/assert.h" diff --git a/src/node/inet-socket-address.h b/src/node/inet-socket-address.h index 0a00172ba..d6727342f 100644 --- a/src/node/inet-socket-address.h +++ b/src/node/inet-socket-address.h @@ -1,5 +1,26 @@ -#ifndef IPV4_TRANSPORT_ADDRESS_H -#define IPV4_TRANSPORT_ADDRESS_H +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2005 INRIA + * All rights reserved. + * + * 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: Mathieu Lacage + */ + +#ifndef INET_SOCKET_ADDRESS_H +#define INET_SOCKET_ADDRESS_H #include "address.h" #include "ipv4-address.h" @@ -93,4 +114,4 @@ private: } // namespace ns3 -#endif /* IPV4_TRANSPORT_ADDRESS_H */ +#endif /* INET_SOCKET_ADDRESS_H */ diff --git a/src/node/ipv4-address.cc b/src/node/ipv4-address.cc index 4e1e344c5..b36892c50 100644 --- a/src/node/ipv4-address.cc +++ b/src/node/ipv4-address.cc @@ -18,12 +18,12 @@ * * Author: Mathieu Lacage */ -#include "ns3/debug.h" + +#include "ns3/log.h" #include "ipv4-address.h" #include "ns3/assert.h" -NS_DEBUG_COMPONENT_DEFINE("Ipv4Address"); - +NS_LOG_COMPONENT_DEFINE("Ipv4Address"); namespace ns3 { @@ -99,6 +99,11 @@ Ipv4Mask::SetHostOrder (uint32_t value) { m_mask = value; } +uint32_t +Ipv4Mask::GetInverse (void) const +{ + return ~m_mask; +} void Ipv4Mask::Print (std::ostream &os) const @@ -162,6 +167,18 @@ Ipv4Address::CombineMask (Ipv4Mask const &mask) const return Ipv4Address (GetHostOrder () & mask.GetHostOrder ()); } +Ipv4Address +Ipv4Address::GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const +{ + return Ipv4Address (GetHostOrder () | mask.GetInverse ()); +} + +bool +Ipv4Address::IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const +{ + return ( (GetHostOrder () | mask.GetInverse ()) == GetHostOrder () ); +} + bool Ipv4Address::IsBroadcast (void) const { diff --git a/src/node/ipv4-address.h b/src/node/ipv4-address.h index 6589edcf9..f473b57c0 100644 --- a/src/node/ipv4-address.h +++ b/src/node/ipv4-address.h @@ -119,6 +119,16 @@ public: * \param mask a network mask */ Ipv4Address CombineMask (Ipv4Mask const &mask) const; + /** + * \brief Generate subnet-directed broadcast address corresponding to mask + * + * The subnet-directed broadcast address has the host bits set to all + * ones. + * + * \param mask a network mask + */ + Ipv4Address GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const; + bool IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const; static bool IsMatchingType (const Address &address); operator Address (); @@ -151,6 +161,10 @@ public: */ uint32_t GetHostOrder (void) const; void SetHostOrder (uint32_t value); + /** + * \brief Return the inverse mask in host order. + */ + uint32_t GetInverse (void) const; void Print (std::ostream &os) const; diff --git a/src/node/ipv4-route.cc b/src/node/ipv4-route.cc index bcc556894..1c56c972e 100644 --- a/src/node/ipv4-route.cc +++ b/src/node/ipv4-route.cc @@ -30,6 +30,7 @@ namespace ns3 { Ipv4Route::Ipv4Route () {} + Ipv4Route::Ipv4Route (Ipv4Route const &route) : m_dest (route.m_dest), m_destNetworkMask (route.m_destNetworkMask), @@ -37,6 +38,13 @@ Ipv4Route::Ipv4Route (Ipv4Route const &route) m_interface (route.m_interface) {} +Ipv4Route::Ipv4Route (Ipv4Route const *route) + : m_dest (route->m_dest), + m_destNetworkMask (route->m_destNetworkMask), + m_gateway (route->m_gateway), + m_interface (route->m_interface) +{} + Ipv4Route::Ipv4Route (Ipv4Address dest, Ipv4Address gateway, uint32_t interface) @@ -137,7 +145,6 @@ Ipv4Route::GetInterface (void) const return m_interface; } - Ipv4Route Ipv4Route::CreateHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, @@ -220,4 +227,108 @@ std::ostream& operator<< (std::ostream& os, Ipv4Route const& route) return os; } +/***************************************************** + * Ipv4MulticastRoute + *****************************************************/ + +Ipv4MulticastRoute::Ipv4MulticastRoute () +{ +} + +Ipv4MulticastRoute::Ipv4MulticastRoute (Ipv4MulticastRoute const &route) +: + m_origin (route.m_origin), + m_group (route.m_group), + m_inputInterface (route.m_inputInterface), + m_outputInterfaces (route.m_outputInterfaces) +{ +} + +Ipv4MulticastRoute::Ipv4MulticastRoute (Ipv4MulticastRoute const *route) +: + m_origin (route->m_origin), + m_group (route->m_group), + m_inputInterface (route->m_inputInterface), + m_outputInterfaces (route->m_outputInterfaces) +{ +} + +Ipv4MulticastRoute::Ipv4MulticastRoute ( + Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + m_origin = origin; + m_group = group; + m_inputInterface = inputInterface; + m_outputInterfaces = outputInterfaces; +} + +Ipv4Address +Ipv4MulticastRoute::GetOrigin (void) const +{ + return m_origin; +} + +Ipv4Address +Ipv4MulticastRoute::GetGroup (void) const +{ + return m_group; +} + +uint32_t +Ipv4MulticastRoute::GetInputInterface (void) const +{ + return m_inputInterface; +} + +uint32_t +Ipv4MulticastRoute::GetNOutputInterfaces (void) const +{ + return m_outputInterfaces.size (); +} + +uint32_t +Ipv4MulticastRoute::GetOutputInterface (uint32_t n) const +{ + NS_ASSERT_MSG(n < m_outputInterfaces.size (), + "Ipv4MulticastRoute::GetOutputInterface (): index out of bounds"); + + return m_outputInterfaces[n]; +} + +std::vector +Ipv4MulticastRoute::GetOutputInterfaces (void) const +{ + return m_outputInterfaces; +} + +Ipv4MulticastRoute +Ipv4MulticastRoute::CreateMulticastRoute ( + Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) +{ + return Ipv4MulticastRoute (origin, group, inputInterface, outputInterfaces); +} + +std::ostream& +operator<< (std::ostream& os, Ipv4MulticastRoute const& route) +{ + os << "origin=" << route.GetOrigin () << + ", group=" << route.GetGroup () << + ", input interface=" << route.GetInputInterface () << + ", output interfaces="; + + for (uint32_t i = 0; i < route.GetNOutputInterfaces (); ++i) + { + os << route.GetOutputInterface (i) << " "; + + } + + return os; +} + }//namespace ns3 diff --git a/src/node/ipv4-route.h b/src/node/ipv4-route.h index efe9b52e2..933e3534e 100644 --- a/src/node/ipv4-route.h +++ b/src/node/ipv4-route.h @@ -22,6 +22,7 @@ #define IPV4_ROUTE_H #include +#include #include #include "ipv4-address.h" @@ -36,12 +37,19 @@ public: * \brief This constructor does nothing */ Ipv4Route (); + /** * \brief Copy Constructor * \param route The route to copy */ Ipv4Route (Ipv4Route const &route); + /** + * \brief Copy Constructor + * \param route The route to copy + */ + Ipv4Route (Ipv4Route const *route); + bool IsHost (void) const; /** * \return The IPv4 address of the destination of this route @@ -98,6 +106,74 @@ private: std::ostream& operator<< (std::ostream& os, Ipv4Route const& route); +/** + * \brief A record of an IPv4 multicast route + */ +class Ipv4MulticastRoute { +public: + /** + * \brief This constructor does nothing + */ + Ipv4MulticastRoute (); + + /** + * \brief Copy Constructor + * \param route The route to copy + */ + Ipv4MulticastRoute (Ipv4MulticastRoute const &route); + + /** + * \brief Copy Constructor + * \param route The route to copy + */ + Ipv4MulticastRoute (Ipv4MulticastRoute const *route); + + /** + * \return The IPv4 address of the source of this route + */ + Ipv4Address GetOrigin (void) const; + + /** + * \return The IPv4 address of the multicast group of this route + */ + Ipv4Address GetGroup (void) const; + + /** + * \return The IPv4 address of the input interface of this route + */ + uint32_t GetInputInterface (void) const; + + /** + * \return The number of output interfaces of this route + */ + uint32_t GetNOutputInterfaces (void) const; + + /** + * \return A specified output interface. + */ + uint32_t GetOutputInterface (uint32_t n) const; + + /** + * \return A vector of all of the output interfaces of this route. + */ + std::vector GetOutputInterfaces (void) const; + + static Ipv4MulticastRoute CreateMulticastRoute (Ipv4Address origin, + Ipv4Address group, uint32_t inputInterface, + std::vector outputInterfaces); + +private: + Ipv4MulticastRoute (Ipv4Address origin, Ipv4Address group, + uint32_t inputInterface, std::vector outputInterfaces); + + Ipv4Address m_origin; + Ipv4Address m_group; + uint32_t m_inputInterface; + std::vector m_outputInterfaces; +}; + +std::ostream& operator<< (std::ostream& os, Ipv4MulticastRoute const& route); + }//namespace ns3 #endif /* IPV4_ROUTE_H */ diff --git a/src/node/ipv4.cc b/src/node/ipv4.cc index f99675e25..f8a852149 100644 --- a/src/node/ipv4.cc +++ b/src/node/ipv4.cc @@ -18,6 +18,9 @@ * * Author: Mathieu Lacage */ + +#include "ns3/assert.h" +#include "ns3/node.h" #include "ipv4.h" namespace ns3 { @@ -32,4 +35,61 @@ Ipv4::Ipv4 () Ipv4::~Ipv4 () {} +uint32_t +Ipv4::GetIfIndexByAddress (Ptr node, Ipv4Address a, Ipv4Mask amask) +{ + Ptr ipv4 = node->QueryInterface (Ipv4::iid); + NS_ASSERT_MSG (ipv4, "Ipv4::GetIfIndexByAddress: No Ipv4 interface"); + for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++) + { + if (ipv4->GetAddress (i).CombineMask(amask) == a.CombineMask(amask) ) + { + return i; + } + } + // Mapping not found + NS_ASSERT_MSG (false, "Ipv4::GetIfIndexByAddress failed"); + return 0; +} + +// +// XXX BUGBUG I don't think this is really the right approach here. The call +// to GetRoute () filters down into Ipv4L3Protocol where it translates into +// a call into the Ipv4 static routing package. This bypasses any other +// routing packages. At a minimum, the name is misleading. +// +bool +Ipv4::GetRouteToDestination ( + Ptr node, + Ipv4Route& route, + Ipv4Address a, + Ipv4Mask amask) +{ + Ipv4Route tempRoute; + Ptr ipv4 = node->QueryInterface (Ipv4::iid); + NS_ASSERT_MSG (ipv4, "Ipv4::GetRouteToDestination: No Ipv4 interface"); + for (uint32_t i = 0; i < ipv4->GetNRoutes (); i++) + { + tempRoute = ipv4->GetRoute (i); + // Host route found + if ( tempRoute.IsNetwork () == false && tempRoute.GetDest () == a ) + { + route = tempRoute; + return true; + } + else if ( tempRoute.IsNetwork () && + tempRoute.GetDestNetwork () == a.CombineMask(amask) ) + { + route = tempRoute; + return true; + } + else if ( tempRoute.IsDefault () ) + { + route = tempRoute; + return true; + } + } + return false; +} + } // namespace ns3 diff --git a/src/node/ipv4.h b/src/node/ipv4.h index 76d88faea..ba4868a4a 100644 --- a/src/node/ipv4.h +++ b/src/node/ipv4.h @@ -29,6 +29,7 @@ namespace ns3 { +class Node; class NetDevice; class Packet; class Ipv4Route; @@ -70,6 +71,7 @@ public: /** * \brief Asynchronously requests a route for a given packet and IP header * + * \param ifIndex The interface index on which the packet was received. * \param ipHeader IP header of the packet * \param packet packet that is being sent or forwarded * \param routeReply callback that will receive the route reply @@ -99,9 +101,47 @@ public: * immediately after the IP header, although most routing do not * insert any extra header. */ - virtual bool RequestRoute (const Ipv4Header &ipHeader, + virtual bool RequestRoute (uint32_t ifIndex, + const Ipv4Header &ipHeader, Packet packet, RouteReplyCallback routeReply) = 0; + +/** + * \brief Synchronously check to see if we can determine the interface index + * that will be used if a packet is sent to this destination. + * + * This method addresses a problem in the IP stack where a destination address + * must be present and checksummed into the IP header before the actual + * interface over which the packet is sent can be determined. The answer is + * to implement a known and intentional cross-layer violation. This is the + * endpoint of a call chain that started up quite high in the stack (sockets) + * and has found its way down to the Ipv4L3Protocol which is consulting the + * routing protocols for what they would do if presented with a packet of the + * given destination. + * + * Note that the a single interface index is returned. This means that if + * the destination address is a multicast, and an explicit route is present + * that includeds multiple output interfaces, that route cannot be used. + * + * If there are multiple paths out of the node, the resolution is performed + * by Ipv4L3Protocol::GetIfIndexforDestination which has access to more + * contextual information that is useful for making a determination. + * + * \param destination The Ipv4Address if the destination of a hypothetical + * packet. This may be a multicast group address. + * \param ifIndex A reference to the interface index over which a packet + * sent to this destination would be sent. + * \return Returns true if a route is found to the destination that involves + * a single output interface index, otherwise false. + * + * \see Ipv4StaticRouting + * \see Ipv4RoutingProtocol + * \see Ipv4L3Protocol + */ + virtual bool RequestIfIndex (Ipv4Address destination, + uint32_t& ifIndex) = 0; + + static const uint32_t IF_INDEX_ANY = 0xffffffff; }; /** @@ -193,16 +233,68 @@ public: * \returns the number of entries in the routing table. */ virtual uint32_t GetNRoutes (void) = 0; + /** * \param i index of route to return * \returns the route whose index is i */ virtual Ipv4Route GetRoute (uint32_t i) = 0; + /** * \param i index of route to remove from routing table. */ virtual void RemoveRoute (uint32_t i) = 0; + + /** + * \brief Add a static multicast route for a given multicast source and + * group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + * \param inputInterface The interface index over which the packet arrived. + * \param outputInterfaces The list of output interface indices over which + * the packet should be sent (excluding the inputInterface). + */ + virtual void AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) = 0; + /** + * \brief Remove a static multicast route for a given multicast source and + * group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + * \param inputInterface The interface index over which the packet arrived. + */ + virtual void RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface) = 0; + /** + * \brief Set the default static multicast route. + * + * \param outputInterface The network output interface index over which + * packets without specific routes should be sent. + */ + virtual void SetDefaultMulticastRoute (uint32_t outputInterface) = 0; + + /** + * \returns the number of entries in the multicast routing table. + */ + virtual uint32_t GetNMulticastRoutes (void) const = 0; + + /** + * \param i index of route to return + * \returns the route whose index is i + */ + virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const = 0; + + /** + * \param i index of route to remove from routing table. + */ + virtual void RemoveMulticastRoute (uint32_t i) = 0; + /** * \param device device to add to the list of ipv4 interfaces * which can be used as output interfaces during packet forwarding. @@ -213,49 +305,120 @@ public: * make sure that it is never used during packet forwarding. */ virtual uint32_t AddInterface (Ptr device) = 0; + /** * \returns the number of interfaces added by the user. */ virtual uint32_t GetNInterfaces (void) = 0; + /** + * \brief Find and return the interface ID of the interface that has been + * assigned the specified IP address. + * \param addr The IP address assigned to the interface of interest. + * \returns The index of the ipv4 interface with the given address. + * + * Each IP interface has an IP address associated with it. It is often + * useful to search the list of interfaces for one that corresponds to + * a known IP Address. This call takes an IP address as a parameter and + * returns the interface index of the first interface that has been assigned + * that address. If the address is not found, this function asserts. + */ + virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const = 0; + + /** + * \brief Find and return the interface ID of the interface that has been + * assigned the specified (masked) IP address. + * \param addr The IP address assigned to the interface of interest. + * \param mask The address mask to be used in address matching. + * \returns The index of the ipv4 interface with the given address. + * + * Each IP interface has an IP address associated with it. It is often + * useful to search the list of interfaces for one that corresponds to + * a known IP Address. This call takes an IP address and an IP address + * mask as parameters and returns the interface index of the first interface + * that matches the masked IP address. + */ + virtual uint32_t FindInterfaceForAddr (Ipv4Address addr, + Ipv4Mask mask) const = 0; + /** * \param i index of ipv4 interface * \returns the NetDevice associated with the ipv4 interface index */ virtual Ptr GetNetDevice (uint32_t i) = 0; + /** + * \brief Join a multicast group for a given multicast source and + * group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + */ + virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0; + + /** + * \brief Leave a multicast group for a given multicast source and + * group. + * + * \param origin The Ipv4 address of the multicast source. + * \param group The multicast group address. + */ + virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0; + /** * \param i index of ipv4 interface * \param address address to associate to the underlying ipv4 interface */ virtual void SetAddress (uint32_t i, Ipv4Address address) = 0; + /** * \param i index of ipv4 interface * \param mask mask to associate to the underlying ipv4 interface */ virtual void SetNetworkMask (uint32_t i, Ipv4Mask mask) = 0; + /** * \param i index of ipv4 interface * \returns the mask associated to the underlying ipv4 interface */ virtual Ipv4Mask GetNetworkMask (uint32_t i) const = 0; + /** * \param i index of ipv4 interface * \returns the address associated to the underlying ipv4 interface */ virtual Ipv4Address GetAddress (uint32_t i) const = 0; + + /** + * \param destination The IP address of a hypothetical destination. + * \returns The IP address assigned to the interface that will be used + * if we were to send a packet to destination. + */ + virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const = 0; + + /** + * \param destination The IP address of a hypothetical destination. + * \param ifIndex filled in with the interface index that will be used to + * send a packet to the hypothetical destination. + * \returns True if a single interface can be identified, false otherwise. + */ + virtual bool GetIfIndexForDestination (Ipv4Address dest, + uint32_t &ifIndex) const = 0; + /** * \param i index of ipv4 interface * \returns the Maximum Transmission Unit (in bytes) associated * to the underlying ipv4 interface */ virtual uint16_t GetMtu (uint32_t i) const = 0; + /** * \param i index of ipv4 interface * \returns true if the underlying interface is in the "up" state, * false otherwise. */ virtual bool IsUp (uint32_t i) const = 0; + /** * \param i index of ipv4 interface * @@ -263,6 +426,7 @@ public: * considered valid during ipv4 forwarding. */ virtual void SetUp (uint32_t i) = 0; + /** * \param i index of ipv4 interface * @@ -270,7 +434,17 @@ public: * ignored during ipv4 forwarding. */ virtual void SetDown (uint32_t i) = 0; - + +/** + * Convenience functions (Doxygen still needed) + * + * Return the ifIndex corresponding to the Ipv4Address provided. + */ + static uint32_t GetIfIndexByAddress (Ptr node, Ipv4Address a, + Ipv4Mask amask = Ipv4Mask("255.255.255.255")); + + static bool GetRouteToDestination (Ptr node, Ipv4Route& route, + Ipv4Address a, Ipv4Mask amask = Ipv4Mask("255.255.255.255")); }; } // namespace ns3 diff --git a/src/node/eui48-address.cc b/src/node/mac48-address.cc similarity index 81% rename from src/node/eui48-address.cc rename to src/node/mac48-address.cc index d197a0e52..998bb2b11 100644 --- a/src/node/eui48-address.cc +++ b/src/node/mac48-address.cc @@ -17,7 +17,7 @@ * * Author: Mathieu Lacage */ -#include "eui48-address.h" +#include "mac48-address.h" #include "address.h" #include "ns3/assert.h" #include @@ -45,11 +45,11 @@ AsciiToLowCase (char c) } -Eui48Address::Eui48Address () +Mac48Address::Mac48Address () { memset (m_address, 0, 6); } -Eui48Address::Eui48Address (const char *str) +Mac48Address::Mac48Address (const char *str) { int i = 0; while (*str != 0 && i < 6) @@ -80,44 +80,44 @@ Eui48Address::Eui48Address (const char *str) NS_ASSERT (i == 6); } void -Eui48Address::CopyFrom (const uint8_t buffer[6]) +Mac48Address::CopyFrom (const uint8_t buffer[6]) { memcpy (m_address, buffer, 6); } void -Eui48Address::CopyTo (uint8_t buffer[6]) const +Mac48Address::CopyTo (uint8_t buffer[6]) const { memcpy (buffer, m_address, 6); } bool -Eui48Address::IsMatchingType (const Address &address) +Mac48Address::IsMatchingType (const Address &address) { return address.CheckCompatible (GetType (), 6); } -Eui48Address::operator Address () +Mac48Address::operator Address () { return ConvertTo (); } Address -Eui48Address::ConvertTo (void) const +Mac48Address::ConvertTo (void) const { return Address (GetType (), m_address, 6); } -Eui48Address -Eui48Address::ConvertFrom (const Address &address) +Mac48Address +Mac48Address::ConvertFrom (const Address &address) { NS_ASSERT (address.CheckCompatible (GetType (), 6)); - Eui48Address retval; + Mac48Address retval; address.CopyTo (retval.m_address); return retval; } -Eui48Address -Eui48Address::Allocate (void) +Mac48Address +Mac48Address::Allocate (void) { static uint64_t id = 0; id++; - Eui48Address address; + Mac48Address address; address.m_address[0] = (id >> 40) & 0xff; address.m_address[1] = (id >> 32) & 0xff; address.m_address[2] = (id >> 24) & 0xff; @@ -127,13 +127,13 @@ Eui48Address::Allocate (void) return address; } uint8_t -Eui48Address::GetType (void) +Mac48Address::GetType (void) { static uint8_t type = Address::Register (); return type; } -bool operator == (const Eui48Address &a, const Eui48Address &b) +bool operator == (const Mac48Address &a, const Mac48Address &b) { uint8_t ada[6]; uint8_t adb[6]; @@ -141,12 +141,12 @@ bool operator == (const Eui48Address &a, const Eui48Address &b) b.CopyTo (adb); return memcmp (ada, adb, 6) == 0; } -bool operator != (const Eui48Address &a, const Eui48Address &b) +bool operator != (const Mac48Address &a, const Mac48Address &b) { return ! (a == b); } -std::ostream& operator<< (std::ostream& os, const Eui48Address & address) +std::ostream& operator<< (std::ostream& os, const Mac48Address & address) { uint8_t ad[6]; address.CopyTo (ad); diff --git a/src/node/eui48-address.h b/src/node/mac48-address.h similarity index 80% rename from src/node/eui48-address.h rename to src/node/mac48-address.h index bd778a444..1a290dad3 100644 --- a/src/node/eui48-address.h +++ b/src/node/mac48-address.h @@ -32,16 +32,16 @@ class Address; * * This class can contain 48 bit IEEE addresses. */ -class Eui48Address +class Mac48Address { public: - Eui48Address (); + Mac48Address (); /** - * \param str a string representing the new Eui48Address + * \param str a string representing the new Mac48Address * * The format of the string is "xx:xx:xx:xx:xx:xx" */ - Eui48Address (const char *str); + Mac48Address (const char *str); /** * \param buffer address in network order @@ -64,21 +64,21 @@ public: operator Address (); /** * \param address a polymorphic address - * \returns a new Eui48Address from the polymorphic address + * \returns a new Mac48Address from the polymorphic address * * This function performs a type check and asserts if the * type of the input address is not compatible with an - * Eui48Address. + * Mac48Address. */ - static Eui48Address ConvertFrom (const Address &address); + static Mac48Address ConvertFrom (const Address &address); /** * \returns true if the address matches, false otherwise. */ static bool IsMatchingType (const Address &address); /** - * Allocate a new Eui48Address. + * Allocate a new Mac48Address. */ - static Eui48Address Allocate (void); + static Mac48Address Allocate (void); private: /** * \returns a new Address instance @@ -90,9 +90,9 @@ private: uint8_t m_address[6]; }; -bool operator == (const Eui48Address &a, const Eui48Address &b); -bool operator != (const Eui48Address &a, const Eui48Address &b); -std::ostream& operator<< (std::ostream& os, const Eui48Address & address); +bool operator == (const Mac48Address &a, const Mac48Address &b); +bool operator != (const Mac48Address &a, const Mac48Address &b); +std::ostream& operator<< (std::ostream& os, const Mac48Address & address); } // namespace ns3 diff --git a/src/node/eui64-address.cc b/src/node/mac64-address.cc similarity index 81% rename from src/node/eui64-address.cc rename to src/node/mac64-address.cc index 9cbbba381..b6056a4ed 100644 --- a/src/node/eui64-address.cc +++ b/src/node/mac64-address.cc @@ -17,7 +17,7 @@ * * Author: Mathieu Lacage */ -#include "eui64-address.h" +#include "mac64-address.h" #include "address.h" #include "ns3/assert.h" #include @@ -45,11 +45,11 @@ AsciiToLowCase (char c) } -Eui64Address::Eui64Address () +Mac64Address::Mac64Address () { memset (m_address, 0, 8); } -Eui64Address::Eui64Address (const char *str) +Mac64Address::Mac64Address (const char *str) { int i = 0; while (*str != 0 && i < 8) @@ -80,45 +80,45 @@ Eui64Address::Eui64Address (const char *str) NS_ASSERT (i == 6); } void -Eui64Address::CopyFrom (const uint8_t buffer[8]) +Mac64Address::CopyFrom (const uint8_t buffer[8]) { memcpy (m_address, buffer, 8); } void -Eui64Address::CopyTo (uint8_t buffer[8]) const +Mac64Address::CopyTo (uint8_t buffer[8]) const { memcpy (buffer, m_address, 8); } bool -Eui64Address::IsMatchingType (const Address &address) +Mac64Address::IsMatchingType (const Address &address) { return address.CheckCompatible (GetType (), 8); } -Eui64Address::operator Address () +Mac64Address::operator Address () { return ConvertTo (); } -Eui64Address -Eui64Address::ConvertFrom (const Address &address) +Mac64Address +Mac64Address::ConvertFrom (const Address &address) { NS_ASSERT (address.CheckCompatible (GetType (), 8)); - Eui64Address retval; + Mac64Address retval; address.CopyTo (retval.m_address); return retval; } Address -Eui64Address::ConvertTo (void) const +Mac64Address::ConvertTo (void) const { return Address (GetType (), m_address, 8); } -Eui64Address -Eui64Address::Allocate (void) +Mac64Address +Mac64Address::Allocate (void) { static uint64_t id = 0; id++; - Eui64Address address; + Mac64Address address; address.m_address[0] = (id >> 56) & 0xff; address.m_address[1] = (id >> 48) & 0xff; address.m_address[2] = (id >> 40) & 0xff; @@ -130,13 +130,13 @@ Eui64Address::Allocate (void) return address; } uint8_t -Eui64Address::GetType (void) +Mac64Address::GetType (void) { static uint8_t type = Address::Register (); return type; } -bool operator == (const Eui64Address &a, const Eui64Address &b) +bool operator == (const Mac64Address &a, const Mac64Address &b) { uint8_t ada[8]; uint8_t adb[8]; @@ -144,12 +144,12 @@ bool operator == (const Eui64Address &a, const Eui64Address &b) b.CopyTo (adb); return memcmp (ada, adb, 8) == 0; } -bool operator != (const Eui64Address &a, const Eui64Address &b) +bool operator != (const Mac64Address &a, const Mac64Address &b) { return ! (a == b); } -std::ostream& operator<< (std::ostream& os, const Eui64Address & address) +std::ostream& operator<< (std::ostream& os, const Mac64Address & address) { uint8_t ad[8]; address.CopyTo (ad); diff --git a/src/node/eui64-address.h b/src/node/mac64-address.h similarity index 80% rename from src/node/eui64-address.h rename to src/node/mac64-address.h index 98b930057..f304af6a1 100644 --- a/src/node/eui64-address.h +++ b/src/node/mac64-address.h @@ -32,16 +32,16 @@ class Address; * * This class can contain 64 bit IEEE addresses. */ -class Eui64Address +class Mac64Address { public: - Eui64Address (); + Mac64Address (); /** - * \param str a string representing the new Eui64Address + * \param str a string representing the new Mac64Address * * The format of the string is "xx:xx:xx:xx:xx:xx" */ - Eui64Address (const char *str); + Mac64Address (const char *str); /** * \param buffer address in network order @@ -63,21 +63,21 @@ public: operator Address (); /** * \param address a polymorphic address - * \returns a new Eui64Address from the polymorphic address + * \returns a new Mac64Address from the polymorphic address * * This function performs a type check and asserts if the * type of the input address is not compatible with an - * Eui64Address. + * Mac64Address. */ - static Eui64Address ConvertFrom (const Address &address); + static Mac64Address ConvertFrom (const Address &address); /** * \returns true if the address matches, false otherwise. */ static bool IsMatchingType (const Address &address); /** - * Allocate a new Eui64Address. + * Allocate a new Mac64Address. */ - static Eui64Address Allocate (void); + static Mac64Address Allocate (void); private: /** * \returns a new Address instance @@ -89,9 +89,9 @@ private: uint8_t m_address[8]; }; -bool operator == (const Eui64Address &a, const Eui64Address &b); -bool operator != (const Eui64Address &a, const Eui64Address &b); -std::ostream& operator<< (std::ostream& os, const Eui64Address & address); +bool operator == (const Mac64Address &a, const Mac64Address &b); +bool operator != (const Mac64Address &a, const Mac64Address &b); +std::ostream& operator<< (std::ostream& os, const Mac64Address & address); } // namespace ns3 diff --git a/src/node/net-device.cc b/src/node/net-device.cc index e3b9537aa..888243c0f 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -22,14 +22,13 @@ #include #include "ns3/assert.h" #include "ns3/object.h" -#include "ns3/debug.h" - - +#include "ns3/log.h" +#include "ns3/trace-resolver.h" #include "channel.h" #include "net-device.h" #include "node.h" -NS_DEBUG_COMPONENT_DEFINE ("NetDevice"); +NS_LOG_COMPONENT_DEFINE ("NetDevice"); namespace ns3 { @@ -46,22 +45,27 @@ NetDevice::NetDevice(Ptr node, const Address& addr) : m_isMulticast (false), m_isPointToPoint (false) { + NS_LOG_FUNCTION; SetInterfaceId (NetDevice::iid); m_node->AddDevice (this); } NetDevice::~NetDevice () -{} +{ + NS_LOG_FUNCTION; +} Address NetDevice::GetAddress (void) const { + NS_LOG_FUNCTION; return m_address; } bool NetDevice::SetMtu (const uint16_t mtu) { + NS_LOG_FUNCTION; m_mtu = mtu; return true; } @@ -69,53 +73,63 @@ NetDevice::SetMtu (const uint16_t mtu) uint16_t NetDevice::GetMtu (void) const { + NS_LOG_FUNCTION; return m_mtu; } void NetDevice::SetName(const std::string name) { + NS_LOG_FUNCTION; m_name = name; } std::string NetDevice::GetName(void) const { + NS_LOG_FUNCTION; return m_name; } void NetDevice::SetIfIndex(uint32_t index) { + NS_LOG_FUNCTION; m_ifIndex = index; } uint32_t NetDevice::GetIfIndex(void) const { + NS_LOG_FUNCTION; return m_ifIndex; } bool NetDevice::IsLinkUp (void) const { + NS_LOG_FUNCTION; return m_isUp; } void NetDevice::SetLinkChangeCallback (Callback callback) { + NS_LOG_FUNCTION; m_linkChangeCallback = callback; } bool NetDevice::IsBroadcast (void) const { + NS_LOG_FUNCTION; return m_isBroadcast; } + Address const & NetDevice::GetBroadcast (void) const { + NS_LOG_FUNCTION; NS_ASSERT (m_isBroadcast); return m_broadcast; } @@ -123,6 +137,7 @@ NetDevice::GetBroadcast (void) const void NetDevice::EnableBroadcast (Address broadcast) { + NS_LOG_FUNCTION; m_isBroadcast = true; m_broadcast = broadcast; } @@ -130,42 +145,68 @@ NetDevice::EnableBroadcast (Address broadcast) void NetDevice::DisableBroadcast (void) { + NS_LOG_FUNCTION; m_isBroadcast = false; } bool NetDevice::IsMulticast (void) const { + NS_LOG_FUNCTION; return m_isMulticast; } -void -NetDevice::EnableMulticast (void) +Address +NetDevice::GetMulticast (void) const { + NS_LOG_FUNCTION; + NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): " + "Invalid operation when not IsMulticast ()"); + return m_multicast; +} + +Address +NetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const +{ + NS_LOG_FUNCTION; + NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): " + "Invalid operation when not IsMulticast ()"); + return m_multicast; +} + +void +NetDevice::EnableMulticast (Address multicast) +{ + NS_LOG_FUNCTION; m_isMulticast = true; + m_multicast = multicast; } void NetDevice::DisableMulticast (void) { + NS_LOG_FUNCTION; m_isMulticast = false; } bool NetDevice::IsPointToPoint (void) const { + NS_LOG_FUNCTION; return m_isPointToPoint; } void NetDevice::EnablePointToPoint (void) { + NS_LOG_FUNCTION; m_isPointToPoint = true; } void NetDevice::DisablePointToPoint (void) { + NS_LOG_FUNCTION; m_isPointToPoint = false; } @@ -173,6 +214,7 @@ NetDevice::DisablePointToPoint (void) bool NetDevice::Send(const Packet& p, const Address& dest, uint16_t protocolNumber) { + NS_LOG_FUNCTION; if (m_isUp) { return SendTo(p, dest, protocolNumber); @@ -183,15 +225,10 @@ NetDevice::Send(const Packet& p, const Address& dest, uint16_t protocolNumber) } } -TraceResolver * -NetDevice::CreateTraceResolver (TraceContext const &context) -{ - return DoCreateTraceResolver (context); -} - Ptr NetDevice::GetChannel (void) const { + NS_LOG_FUNCTION; return DoGetChannel (); } @@ -199,10 +236,10 @@ NetDevice::GetChannel (void) const bool NetDevice::ForwardUp(const Packet& p, uint16_t param, const Address &from) { + NS_LOG_FUNCTION; bool retval = false; - NS_DEBUG ("NetDevice::ForwardUp: UID is " << p.GetUid() - << " device is: " << GetName()); + NS_LOG_LOGIC ("UID is " << p.GetUid() << " device is: " << GetName()); if (!m_receiveCallback.IsNull ()) { @@ -210,7 +247,7 @@ NetDevice::ForwardUp(const Packet& p, uint16_t param, const Address &from) } else { - NS_DEBUG ("NetDevice::Receive call back is NULL"); + NS_LOG_WARN ("NetDevice::Receive call back is NULL"); } return retval; @@ -219,6 +256,7 @@ NetDevice::ForwardUp(const Packet& p, uint16_t param, const Address &from) void NetDevice::NotifyLinkUp (void) { + NS_LOG_FUNCTION; m_isUp = true; if (!m_linkChangeCallback.IsNull ()) { @@ -229,6 +267,7 @@ NetDevice::NotifyLinkUp (void) void NetDevice::NotifyLinkDown (void) { + NS_LOG_FUNCTION; m_isUp = false; if (!m_linkChangeCallback.IsNull ()) { @@ -239,24 +278,28 @@ NetDevice::NotifyLinkDown (void) Ptr NetDevice::GetNode (void) const { + NS_LOG_FUNCTION; return m_node; } bool NetDevice::NeedsArp (void) const { + NS_LOG_FUNCTION; return DoNeedsArp (); } void NetDevice::SetReceiveCallback (ReceiveCallback cb) { + NS_LOG_FUNCTION; m_receiveCallback = cb; } void NetDevice::DoDispose() { + NS_LOG_FUNCTION; m_node = 0; } diff --git a/src/node/net-device.h b/src/node/net-device.h index cc93e6420..7c95d5b84 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -29,6 +29,7 @@ #include "ns3/object.h" #include "ns3/ptr.h" #include "address.h" +#include "ipv4-address.h" namespace ns3 { @@ -62,14 +63,6 @@ public: static const InterfaceId iid; virtual ~NetDevice(); - /** - * \param context the trace context to use to construct the - * TraceResolver to return - * \returns a TraceResolver which can resolve all traces - * performed in this object. The caller must - * delete the returned object. - */ - TraceResolver *CreateTraceResolver (TraceContext const &context); /** * \return the channel this NetDevice is connected to. The value @@ -138,10 +131,69 @@ public: * not true. */ Address const &GetBroadcast (void) const; + /** * \return value of m_isMulticast flag */ bool IsMulticast (void) const; + + /** + * \brief Return the MAC multicast base address used when mapping multicast + * groups to MAC multicast addresses. + * + * Typically when one constructs a multicast MAC addresses, some bits from + * the IP multicast group are copied into a corresponding MAC multicast + * group. In EUI-48, for example, the low order 23 bits of the multicast + * group are copied to the MAC multicast group base address. + * + * This method allows access to the underlying MAC multicast group base + * address. It is expected that in most cases, a net device client will + * allow the net device to perform the actual construction of the multicast + * address. Use of this method is discouraged unless you have a good reason + * to perform a custom mapping. You should prefer + * NetDevice::MakeMulticastAddress which will do the RFC-specified mapping + * for the net device in question. + * + * \return The multicast address supported by this net device. + * + * \warning Calling this method is invalid if IsMulticast returns not true. + * The method NS_ASSERTs if the device is not a multicast device. + * \see NetDevice::MakeMulticastAddress + */ + Address GetMulticast (void) const; + + /** + * \brief Make and return a MAC multicast address using the provided + * multicast group + * + * RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet + * multicast address by placing the low-order 23-bits of the IP address into + * the low-order 23 bits of the Ethernet multicast address + * 01-00-5E-00-00-00 (hex). Similar RFCs exist for Ipv6 and Eui64 mappings. + * This method performs the multicast address creation function appropriate + * to the underlying MAC address of the device. This MAC address is + * encapsulated in an abstract Address to avoid dependencies on the exact + * MAC address format. + * + * A default imlementation of MakeMulticastAddress is provided, but this + * method simply NS_ASSERTS. In the case of net devices that do not support + * multicast, clients are expected to test NetDevice::IsMulticast and avoid + * attempting to map multicast packets. Subclasses of NetDevice that do + * support multicasting are expected to override this method and provide an + * implementation appropriate to the particular device. + * + * \param multicastGroup The IP address for the multicast group destination + * of the packet. + * \return The MAC multicast Address used to send packets to the provided + * multicast group. + * + * \warning Calling this method is invalid if IsMulticast returns not true. + * \see Ipv4Address + * \see Address + * \see NetDevice::IsMulticast + */ + virtual Address MakeMulticastAddress (Ipv4Address multicastGroup) const; + /** * \return value of m_isPointToPoint flag */ @@ -212,9 +264,10 @@ public: */ void DisableBroadcast (void); /** - * Set m_isMulticast flag to true + * Enable multicast support. This method should be + * called by subclasses from their constructor */ - void EnableMulticast (void); + void EnableMulticast (Address multicast); /** * Set m_isMulticast flag to false */ @@ -282,15 +335,6 @@ public: * Subclasses must implement this method. */ virtual bool DoNeedsArp (void) const = 0; - /** - * \param context the trace context to associated to the - * trace resolver. - * \returns a trace resolver associated to the input context. - * the caller takes ownership of the pointer returned. - * - * Subclasses must implement this method. - */ - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context) = 0; /** * \returns the channel associated to this NetDevice. * @@ -303,6 +347,7 @@ public: uint16_t m_ifIndex; Address m_address; Address m_broadcast; + Address m_multicast; uint16_t m_mtu; bool m_isUp; bool m_isBroadcast; diff --git a/src/node/node-list.cc b/src/node/node-list.cc index eb43727d9..1accfa2be 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -20,24 +20,12 @@ * Mathieu Lacage , */ -#include "ns3/array-trace-resolver.h" -#include "ns3/trace-root.h" +#include "ns3/composite-trace-resolver.h" #include "ns3/simulator.h" #include "ns3/simulation-singleton.h" #include "node-list.h" #include "node.h" -namespace { -static class Initialization -{ -public: - Initialization () - { - ns3::TraceRoot::Register ("nodes", ns3::MakeCallback (&ns3::NodeList::CreateTraceResolver)); - } -} g_initialization; -} - namespace ns3 { NodeListIndex::NodeListIndex () @@ -62,6 +50,11 @@ NodeListIndex::Get (void) const { return m_index; } +std::string +NodeListIndex::GetTypeName (void) const +{ + return "ns3::NodeListIndex"; +} /** @@ -74,9 +67,9 @@ public: ~NodeListPriv (); uint32_t Add (Ptr node); - NodeList::Iterator Begin (void); - NodeList::Iterator End (void); - TraceResolver *CreateTraceResolver (TraceContext const &context); + NodeList::Iterator Begin (void) const; + NodeList::Iterator End (void) const; + Ptr GetTraceResolver (void) const; Ptr GetNode (uint32_t n); uint32_t GetNNodes (void); @@ -108,12 +101,12 @@ NodeListPriv::Add (Ptr node) } NodeList::Iterator -NodeListPriv::Begin (void) +NodeListPriv::Begin (void) const { return m_nodes.begin (); } NodeList::Iterator -NodeListPriv::End (void) +NodeListPriv::End (void) const { return m_nodes.end (); } @@ -130,14 +123,11 @@ NodeListPriv::GetNode (uint32_t n) } -TraceResolver * -NodeListPriv::CreateTraceResolver (TraceContext const &context) +Ptr +NodeListPriv::GetTraceResolver (void) const { - ArrayTraceResolver, NodeListIndex> *resolver = - new ArrayTraceResolver, NodeListIndex> - (context, - MakeCallback (&NodeListPriv::GetNNodes, this), - MakeCallback (&NodeListPriv::GetNode, this)); + Ptr resolver = Create (); + resolver->AddArray ("nodes", Begin (), End (), NodeListIndex ()); return resolver; } @@ -165,17 +155,30 @@ NodeList::End (void) { return SimulationSingleton::Get ()->End (); } -TraceResolver * -NodeList::CreateTraceResolver (TraceContext const &context) -{ - return SimulationSingleton::Get ()->CreateTraceResolver (context); -} Ptr NodeList::GetNode (uint32_t n) { return SimulationSingleton::Get ()->GetNode (n); } - - +void +NodeList::Connect (std::string name, const CallbackBase &cb) +{ + SimulationSingleton::Get ()->GetTraceResolver ()->Connect (name, cb, TraceContext ()); +} +void +NodeList::Disconnect (std::string name, const CallbackBase &cb) +{ + SimulationSingleton::Get ()->GetTraceResolver ()->Disconnect (name, cb); +} +void +NodeList::TraceAll (std::ostream &os) +{ + SimulationSingleton::Get ()->GetTraceResolver ()->TraceAll (os, TraceContext ()); +} +Ptr +NodeList::GetTraceResolver (void) +{ + return SimulationSingleton::Get ()->GetTraceResolver (); +} }//namespace ns3 diff --git a/src/node/node-list.h b/src/node/node-list.h index 1fdcd9e0e..ef3ee6348 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -29,9 +29,12 @@ namespace ns3 { class Node; +class CallbackBase; class TraceResolver; -class TraceContext; +/** + * \brief hold in a TraceContext the index of a node within a NodeList. + */ class NodeListIndex : public TraceContextElement { public: @@ -39,7 +42,11 @@ public: NodeListIndex (uint32_t index); void Print (std::ostream &os); static uint16_t GetUid (void); + /** + * \returns the index of the node within the NodeList + */ uint32_t Get (void) const; + std::string GetTypeName (void) const; private: uint32_t m_index; }; @@ -53,7 +60,7 @@ private: class NodeList { public: - typedef std::vector< Ptr >::iterator Iterator; + typedef std::vector< Ptr >::const_iterator Iterator; /** * \param node node to add @@ -73,19 +80,50 @@ public: * list. */ static Iterator End (void); - /** - * \param context trace context to use for trace resolver - * to create. - * \returns the requested trace resolver. The caller - * takes ownership of the returned pointer. - */ - static TraceResolver *CreateTraceResolver (TraceContext const &context); - /** * \param n index of requested node. * \returns the Node associated to index n. */ static Ptr GetNode (uint32_t n); + /** + * \param name namespace regexp to match + * \param cb callback to connect + * + * Connect input callback to all trace sources which match + * the input namespace regexp. + * A tutorial which explains how to use this method can be + * found in the \ref tracing section. + */ + static void Connect (std::string name, const CallbackBase &cb); + /** + * \param name namespace regexp to match + * \param cb callback to connect + * + * Disconnect input callback from all trace sources which match + * the input namespace regexp. + */ + static void Disconnect (std::string name, const CallbackBase &cb); + /** + * \param os the output stream on which the content of each trace event should be + * dumped in ascii format. + * + * Enable _every_ trace source accessible from the NodeList and write to the + * output stream an ascii representation of each trace event. + * This method is very useful to get quick-and-dirty trace output from a + * simulation. + * More fancy tracing output could be generated with the ns3::NodeList::Connect + * method as explained in the \ref tracing section. + */ + static void TraceAll (std::ostream &os); + /** + * \returns the trace resolver used by the ns3::NodeList::Connect, + * ns3::NodeList::Disconnect, and, ns3::NodeList::TraceAll methods. + * + * Using this method directly is not really recommended. Instead, users + * should use one of the three methods ns3::NodeList::Connect, + * ns3::NodeList::Disconnect, or, ns3::NodeList::TraceAll methods. + */ + static Ptr GetTraceResolver (void); }; }//namespace ns3 diff --git a/src/node/node.cc b/src/node/node.cc index ee83e8588..171af4e2d 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -25,7 +25,6 @@ #include "packet-socket-factory.h" #include "ns3/simulator.h" #include "ns3/composite-trace-resolver.h" -#include "ns3/array-trace-resolver.h" namespace ns3{ @@ -53,6 +52,11 @@ NodeNetDeviceIndex::GetUid (void) static uint16_t uid = AllocateUid ("NodeNetDeviceIndex"); return uid; } +std::string +NodeNetDeviceIndex::GetTypeName (void) const +{ + return "ns3::NodeNetDeviceIndex"; +} @@ -82,11 +86,12 @@ Node::Construct (void) Node::~Node () {} -TraceResolver * -Node::CreateTraceResolver (TraceContext const &context) +Ptr +Node::GetTraceResolver (void) const { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); - DoFillTraceResolver (*resolver); + Ptr resolver = Create (); + resolver->AddArray ("devices", m_devices.begin (), m_devices.end (), NodeNetDeviceIndex ()); + resolver->SetParentResolver (Object::GetTraceResolver ()); return resolver; } @@ -141,25 +146,6 @@ Node::GetNApplications (void) const return m_applications.size (); } -TraceResolver * -Node::CreateDevicesTraceResolver (const TraceContext &context) -{ - ArrayTraceResolver,NodeNetDeviceIndex> *resolver = - new ArrayTraceResolver,NodeNetDeviceIndex> - (context, - MakeCallback (&Node::GetNDevices, this), - MakeCallback (&Node::GetDevice, this)); - - return resolver; -} - -void -Node::DoFillTraceResolver (CompositeTraceResolver &resolver) -{ - resolver.Add ("devices", - MakeCallback (&Node::CreateDevicesTraceResolver, this)); -} - void Node::DoDispose() { diff --git a/src/node/node.h b/src/node/node.h index f4d898f53..cd032e2e0 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -37,13 +37,20 @@ class Packet; class Address; class CompositeTraceResolver; +/** + * \brief hold in a TraceContext the index of a NetDevice within a Node + */ class NodeNetDeviceIndex : public TraceContextElement { public: NodeNetDeviceIndex (); NodeNetDeviceIndex (uint32_t index); + /** + * \returns the index of the NetDevice within its container Node. + */ uint32_t Get (void) const; void Print (std::ostream &os) const; + std::string GetTypeName (void) const; static uint16_t GetUid (void); private: uint32_t m_index; @@ -84,17 +91,6 @@ public: virtual ~Node(); - /** - * \param context the trace context for the TraceResolver to create - * \returns a newly-created TraceResolver. The caller takes - * ownership of the returned pointer. - * - * Request the Node to create a trace resolver. This method - * could be used directly by a user who needs access to very low-level - * trace configuration. - */ - TraceResolver *CreateTraceResolver (TraceContext const &context); - /** * \returns the unique id of this node. * @@ -183,23 +179,15 @@ public: void UnregisterProtocolHandler (ProtocolHandler handler); protected: + virtual Ptr GetTraceResolver (void) const; /** * The dispose method. Subclasses must override this method * and must chain up to it by calling Node::DoDispose at the * end of their own DoDispose method. */ virtual void DoDispose (void); - /** - * \param resolver the resolver to store trace sources in. - * - * If a subclass wants to add new traces to a Node, it needs - * to override this method and record the new trace sources - * in the input resolver. Subclasses also _must_ chain up to - * their parent's DoFillTraceResolver method prior - * to recording they own trace sources. - */ - virtual void DoFillTraceResolver (CompositeTraceResolver &resolver); private: + /** * \param device the device added to this Node. * @@ -213,7 +201,6 @@ private: bool ReceiveFromDevice (Ptr device, const Packet &packet, uint16_t protocol, const Address &from); void Construct (void); - TraceResolver *CreateDevicesTraceResolver (const TraceContext &context); struct ProtocolHandlerEntry { ProtocolHandler handler; diff --git a/src/node/packet-socket-address.h b/src/node/packet-socket-address.h index e280db8df..87f254e8c 100644 --- a/src/node/packet-socket-address.h +++ b/src/node/packet-socket-address.h @@ -22,8 +22,8 @@ #include "ns3/ptr.h" #include "address.h" -#include "eui48-address.h" -#include "eui64-address.h" +#include "mac48-address.h" +#include "mac64-address.h" #include "net-device.h" namespace ns3 { @@ -54,7 +54,7 @@ class PacketSocketAddress /** * \param address a polymorphic address * - * Convert a polymorphic address to an Eui48Address instance. + * Convert a polymorphic address to an Mac48Address instance. * The conversion performs a type check. */ static PacketSocketAddress ConvertFrom (const Address &address); diff --git a/src/node/packet-socket-factory.cc b/src/node/packet-socket-factory.cc index 3cd403a1a..74d74a8f4 100644 --- a/src/node/packet-socket-factory.cc +++ b/src/node/packet-socket-factory.cc @@ -20,6 +20,7 @@ */ #include "packet-socket-factory.h" #include "node.h" +#include "packet-socket.h" namespace ns3 { diff --git a/src/node/packet-socket-factory.h b/src/node/packet-socket-factory.h index 0f052ce6e..7d7468052 100644 --- a/src/node/packet-socket-factory.h +++ b/src/node/packet-socket-factory.h @@ -22,7 +22,6 @@ #define PACKET_SOCKET_FACTORY_H #include "socket-factory.h" -#include "packet-socket.h" namespace ns3 { diff --git a/src/node/packet-socket.cc b/src/node/packet-socket.cc index f642eee9e..448b84334 100644 --- a/src/node/packet-socket.cc +++ b/src/node/packet-socket.cc @@ -21,22 +21,24 @@ #include "packet-socket.h" #include "packet-socket-address.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/node.h" -NS_DEBUG_COMPONENT_DEFINE ("PacketSocket"); +NS_LOG_COMPONENT_DEFINE ("PacketSocket"); namespace ns3 { PacketSocket::PacketSocket (Ptr node) : m_node (node) { + NS_LOG_FUNCTION; Init(); } void PacketSocket::Init() { + NS_LOG_FUNCTION; m_state = STATE_OPEN; m_shutdownSend = false; m_shutdownRecv = false; @@ -44,37 +46,45 @@ PacketSocket::Init() } PacketSocket::~PacketSocket () -{} +{ + NS_LOG_FUNCTION; +} void PacketSocket::DoDispose (void) { + NS_LOG_FUNCTION; m_device = 0; } enum Socket::SocketErrno PacketSocket::GetErrno (void) const { + NS_LOG_FUNCTION; return m_errno; } Ptr PacketSocket::GetNode (void) const { + NS_LOG_FUNCTION; return m_node; } int PacketSocket::Bind (void) { + NS_LOG_FUNCTION; PacketSocketAddress address; address.SetProtocol (0); address.SetAllDevices (); return DoBind (address); } + int PacketSocket::Bind (const Address &address) -{ +{ + NS_LOG_FUNCTION; if (!PacketSocketAddress::IsMatchingType (address)) { m_errno = ERROR_INVAL; @@ -87,6 +97,7 @@ PacketSocket::Bind (const Address &address) int PacketSocket::DoBind (const PacketSocketAddress &address) { + NS_LOG_FUNCTION; if (m_state == STATE_BOUND || m_state == STATE_CONNECTED) { @@ -119,6 +130,7 @@ PacketSocket::DoBind (const PacketSocketAddress &address) int PacketSocket::ShutdownSend (void) { + NS_LOG_FUNCTION; if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; @@ -127,9 +139,11 @@ PacketSocket::ShutdownSend (void) m_shutdownSend = true; return 0; } + int PacketSocket::ShutdownRecv (void) { + NS_LOG_FUNCTION; if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; @@ -138,9 +152,11 @@ PacketSocket::ShutdownRecv (void) m_shutdownRecv = false; return 0; } + int PacketSocket::Close(void) { + NS_LOG_FUNCTION; if (m_state == STATE_CLOSED) { m_errno = ERROR_BADF; @@ -154,6 +170,7 @@ PacketSocket::Close(void) int PacketSocket::Connect(const Address &ad) { + NS_LOG_FUNCTION; PacketSocketAddress address; if (m_state == STATE_CLOSED) { @@ -188,6 +205,7 @@ PacketSocket::Connect(const Address &ad) int PacketSocket::Send (const Packet &p) { + NS_LOG_FUNCTION; if (m_state == STATE_OPEN || m_state == STATE_BOUND) { @@ -200,6 +218,7 @@ PacketSocket::Send (const Packet &p) int PacketSocket::SendTo(const Address &address, const Packet &p) { + NS_LOG_FUNCTION; PacketSocketAddress ad; if (m_state == STATE_CLOSED) { @@ -265,6 +284,7 @@ void PacketSocket::ForwardUp (Ptr device, const Packet &packet, uint16_t protocol, const Address &from) { + NS_LOG_FUNCTION; if (m_shutdownRecv) { return; @@ -277,8 +297,7 @@ PacketSocket::ForwardUp (Ptr device, const Packet &packet, address.SetSingleDevice (device->GetIfIndex ()); address.SetProtocol (protocol); - NS_DEBUG ("PacketSocket::ForwardUp: UID is " << packet.GetUid() - << " PacketSocket " << this); + NS_LOG_LOGIC ("UID is " << packet.GetUid() << " PacketSocket " << this); NotifyDataReceived (p, address); } diff --git a/src/node/queue.cc b/src/node/queue.cc index 72eafed69..4a622c2b0 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -17,13 +17,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/composite-trace-resolver.h" #include "ns3/default-value.h" #include "ns3/component-manager.h" #include "queue.h" -NS_DEBUG_COMPONENT_DEFINE ("Queue"); +NS_LOG_COMPONENT_DEFINE ("Queue"); namespace ns3 { @@ -32,31 +32,51 @@ static ClassIdDefaultValue g_classIdDefaultValue ("Queue", "Packet Queue", Queue::iid, "DropTailQueue"); +std::string +QueueTraceType::GetTypeName (void) const +{ + NS_LOG_FUNCTION; + return "ns3::QueueTraceType"; +} + uint16_t QueueTraceType::GetUid (void) { + NS_LOG_FUNCTION; static uint16_t uid = AllocateUid ("QueueTraceType"); return uid; } + QueueTraceType::QueueTraceType () : m_type (QueueTraceType::ENQUEUE) -{} +{ + NS_LOG_FUNCTION; +} + QueueTraceType::QueueTraceType (enum Type type) : m_type (type) -{} +{ + NS_LOG_FUNCTION; +} + bool QueueTraceType::IsEnqueue (void) const { + NS_LOG_FUNCTION; return m_type == ENQUEUE; } + bool QueueTraceType::IsDequeue (void) const { + NS_LOG_FUNCTION; return m_type == DEQUEUE; } + bool QueueTraceType::IsDrop (void) const { + NS_LOG_FUNCTION; return m_type == DROP; } @@ -85,31 +105,42 @@ Queue::Queue() : m_nTotalDroppedBytes(0), m_nTotalDroppedPackets(0) { + NS_LOG_FUNCTION; SetInterfaceId (Queue::iid); - NS_DEBUG("Queue::Queue ()"); } Queue::~Queue() { - NS_DEBUG("Queue::~Queue ()"); + NS_LOG_FUNCTION; } -TraceResolver * -Queue::CreateTraceResolver (TraceContext const &context) +Ptr +Queue::GetTraceResolver (void) const { - CompositeTraceResolver *resolver = new CompositeTraceResolver (context); - resolver->Add ("enqueue", m_traceEnqueue, QueueTraceType (QueueTraceType::ENQUEUE)); - resolver->Add ("dequeue", m_traceDequeue, QueueTraceType (QueueTraceType::DEQUEUE)); - resolver->Add ("drop", m_traceDrop, QueueTraceType (QueueTraceType::DROP)); + NS_LOG_FUNCTION; + Ptr resolver = Create (); + resolver->AddSource ("enqueue", + TraceDoc ("store packet in queue", + "const Packet &", "packet queued"), + m_traceEnqueue, QueueTraceType (QueueTraceType::ENQUEUE)); + resolver->AddSource ("dequeue", + TraceDoc ("remove packet from queue", + "const Packet &", "packet dequeued"), + m_traceDequeue, QueueTraceType (QueueTraceType::DEQUEUE)); + resolver->AddSource ("drop", + TraceDoc ("drop packet from queue", + "const Packet &", "packet dropped"), + m_traceDrop, QueueTraceType (QueueTraceType::DROP)); + resolver->SetParentResolver (Object::GetTraceResolver ()); return resolver; } bool Queue::Enqueue (const Packet& p) { - NS_DEBUG("Queue::Enqueue (" << &p << ")"); - - NS_DEBUG("Queue::Enqueue (): m_traceEnqueue (p)"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); + NS_LOG_LOGIC ("m_traceEnqueue (p)"); m_traceEnqueue (p); @@ -125,7 +156,8 @@ Queue::Enqueue (const Packet& p) bool Queue::Dequeue (Packet &p) { - NS_DEBUG("Queue::Dequeue (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); bool retval = DoDequeue (p); @@ -137,7 +169,7 @@ Queue::Dequeue (Packet &p) NS_ASSERT (m_nBytes >= 0); NS_ASSERT (m_nPackets >= 0); - NS_DEBUG("Queue::Dequeue (): m_traceDequeue (p)"); + NS_LOG_LOGIC("m_traceDequeue (p)"); const Packet packet = p; m_traceDequeue (packet); @@ -149,16 +181,15 @@ Queue::Dequeue (Packet &p) void Queue::DequeueAll (void) { - NS_DEBUG("Queue::DequeueAll ()"); - - NS_ASSERT (!"Don't know what to do with dequeued packets!"); + NS_LOG_FUNCTION; + NS_ASSERT_MSG (0, "Don't know what to do with dequeued packets!"); } bool Queue::Peek (Packet &p) { - NS_DEBUG("Queue::Peek (" << &p << ")"); - + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); return DoPeek (p); } @@ -166,66 +197,63 @@ Queue::Peek (Packet &p) uint32_t Queue::GetNPackets (void) { - NS_DEBUG("Queue::GetNPackets () <= " << m_nPackets); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("returns " << m_nPackets); return m_nPackets; } uint32_t Queue::GetNBytes (void) { - NS_DEBUG("Queue::GetNBytes () <= " << m_nBytes); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC (" returns " << m_nBytes); return m_nBytes; } - bool Queue::IsEmpty (void) { - NS_DEBUG("Queue::IsEmpty () <= " << (m_nPackets == 0)); + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("returns " << (m_nPackets == 0)); return m_nPackets == 0; } uint32_t Queue::GetTotalReceivedBytes (void) { - NS_DEBUG("Queue::GetTotalReceivedBytes () <= " << m_nTotalReceivedBytes); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC("returns " << m_nTotalReceivedBytes); return m_nTotalReceivedBytes; } uint32_t Queue::GetTotalReceivedPackets (void) { - NS_DEBUG("Queue::GetTotalReceivedPackets () <= " << m_nTotalReceivedPackets); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("returns " << m_nTotalReceivedPackets); return m_nTotalReceivedPackets; } uint32_t Queue:: GetTotalDroppedBytes (void) { - NS_DEBUG( - "Queue::GetTotalDroppedBytes () <= " << m_nTotalDroppedBytes - ); + NS_LOG_FUNCTION; + NS_LOG_LOGIC ("returns " << m_nTotalDroppedBytes); return m_nTotalDroppedBytes; } uint32_t Queue::GetTotalDroppedPackets (void) { - NS_DEBUG( - "Queue::GetTotalDroppedPackets () <= " << m_nTotalDroppedPackets); - + NS_LOG_FUNCTION; + NS_LOG_LOGIC("returns " << m_nTotalDroppedPackets); return m_nTotalDroppedPackets; } void Queue::ResetStatistics (void) { - NS_DEBUG("Queue::ResetStatistics ()"); - + NS_LOG_FUNCTION; m_nTotalReceivedBytes = 0; m_nTotalReceivedPackets = 0; m_nTotalDroppedBytes = 0; @@ -235,18 +263,20 @@ Queue::ResetStatistics (void) void Queue::Drop (const Packet& p) { - NS_DEBUG("Queue::Drop (" << &p << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << &p << ")"); m_nTotalDroppedPackets++; m_nTotalDroppedBytes += p.GetSize (); - NS_DEBUG("Queue::Drop (): m_traceDrop (p)"); + NS_LOG_LOGIC ("m_traceDrop (p)"); m_traceDrop (p); } Ptr Queue::CreateDefault (void) { + NS_LOG_FUNCTION; ClassId classId = g_classIdDefaultValue.GetValue (); Ptr queue = ComponentManager::Create (classId, Queue::iid); return queue; diff --git a/src/node/queue.h b/src/node/queue.h index d135fff68..b8531c9c7 100644 --- a/src/node/queue.h +++ b/src/node/queue.h @@ -37,6 +37,9 @@ namespace ns3 { class StringEnumDefaultValue; +/** + * \brief hold in a TraceContext the type of a trace source + */ class QueueTraceType : public TraceContextElement { public: @@ -48,10 +51,20 @@ public: static uint16_t GetUid (void); QueueTraceType (); QueueTraceType (enum Type type); + /** + * \returns true if this is an enqueue event, false otherwise. + */ bool IsEnqueue (void) const; + /** + * \returns true if this is a dequeue event, false otherwise. + */ bool IsDequeue (void) const; + /** + * \returns true if this is a drop event, false otherwise. + */ bool IsDrop (void) const; void Print (std::ostream &os) const; + std::string GetTypeName (void) const; private: enum Type m_type; }; @@ -69,8 +82,6 @@ public: Queue (); virtual ~Queue (); - - TraceResolver *CreateTraceResolver (TraceContext const &context); /** * \return true if the queue is empty; false otherwise @@ -167,6 +178,7 @@ private: virtual bool DoPeek (Packet &p) = 0; protected: + Ptr GetTraceResolver (void) const; // called by subclasses to notify parent of packet drops. void Drop (const Packet& p); diff --git a/src/node/socket.cc b/src/node/socket.cc index 58f83947f..48623abbe 100644 --- a/src/node/socket.cc +++ b/src/node/socket.cc @@ -19,83 +19,109 @@ * Authors: George F. Riley * Mathieu Lacage */ -#include "socket.h" + +#include "ns3/log.h" #include "ns3/packet.h" +#include "socket.h" + +NS_LOG_COMPONENT_DEFINE ("Socket"); namespace ns3 { Socket::~Socket () -{} +{ + NS_LOG_FUNCTION; +} void Socket::SetCloseCallback (Callback > closeCompleted) { + NS_LOG_FUNCTION; m_closeCompleted = closeCompleted; } + void -Socket::SetConnectCallback (Callback > connectionSucceeded, - Callback > connectionFailed, - Callback > halfClose) +Socket::SetConnectCallback ( + Callback > connectionSucceeded, + Callback > connectionFailed, + Callback > halfClose) { + NS_LOG_FUNCTION; m_connectionSucceeded = connectionSucceeded; m_connectionFailed = connectionFailed; m_halfClose = halfClose; } + void -Socket::SetAcceptCallback (Callback, const Address &> connectionRequest, - Callback, const Address&> newConnectionCreated, - Callback > closeRequested) +Socket::SetAcceptCallback ( + Callback, const Address &> connectionRequest, + Callback, const Address&> newConnectionCreated, + Callback > closeRequested) { + NS_LOG_FUNCTION; m_connectionRequest = connectionRequest; m_newConnectionCreated = newConnectionCreated; m_closeRequested = closeRequested; } + void Socket::SetSendCallback (Callback, uint32_t> dataSent) { + NS_LOG_FUNCTION; m_dataSent = dataSent; } + void Socket::SetRecvCallback (Callback, const Packet &,const Address&> receivedData) { + NS_LOG_FUNCTION; m_receivedData = receivedData; } void Socket::NotifyCloseCompleted (void) { + NS_LOG_FUNCTION; if (!m_closeCompleted.IsNull ()) { m_closeCompleted (this); } } + void Socket::NotifyConnectionSucceeded (void) { + NS_LOG_FUNCTION; if (!m_connectionSucceeded.IsNull ()) { m_connectionSucceeded (this); } } + void Socket::NotifyConnectionFailed (void) { + NS_LOG_FUNCTION; if (!m_connectionFailed.IsNull ()) { m_connectionFailed (this); } } + void Socket::NotifyHalfClose (void) { + NS_LOG_FUNCTION; if (!m_halfClose.IsNull ()) { m_halfClose (this); } } + bool Socket::NotifyConnectionRequest (const Address &from) { + NS_LOG_FUNCTION; if (!m_connectionRequest.IsNull ()) { return m_connectionRequest (this, from); @@ -106,39 +132,45 @@ Socket::NotifyConnectionRequest (const Address &from) return false; } } + void Socket::NotifyNewConnectionCreated (Ptr socket, const Address &from) { + NS_LOG_FUNCTION; if (!m_newConnectionCreated.IsNull ()) { m_newConnectionCreated (socket, from); } } + void Socket::NotifyCloseRequested (void) { + NS_LOG_FUNCTION; if (!m_closeRequested.IsNull ()) { m_closeRequested (this); } } + void Socket::NotifyDataSent (uint32_t size) { + NS_LOG_FUNCTION; if (!m_dataSent.IsNull ()) { m_dataSent (this, size); } } + void Socket::NotifyDataReceived (const Packet &p, const Address &from) { + NS_LOG_FUNCTION; if (!m_receivedData.IsNull ()) { m_receivedData (this, p, from); } } - - }//namespace ns3 diff --git a/src/node/socket.h b/src/node/socket.h index c717ec0a5..fb62fdca3 100644 --- a/src/node/socket.h +++ b/src/node/socket.h @@ -58,6 +58,7 @@ public: ERROR_AFNOSUPPORT, ERROR_INVAL, ERROR_BADF, + ERROR_NOROUTETOHOST, SOCKET_ERRNO_LAST }; diff --git a/src/node/waf b/src/node/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/node/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/node/wscript b/src/node/wscript index b9fd9552a..c491b8b0e 100644 --- a/src/node/wscript +++ b/src/node/wscript @@ -4,8 +4,8 @@ def build(bld): node = bld.create_ns3_module('node', ['core', 'common', 'simulator']) node.source = [ 'address.cc', - 'eui48-address.cc', - 'eui64-address.cc', + 'mac48-address.cc', + 'mac64-address.cc', 'inet-socket-address.cc', 'packet-socket-address.cc', 'node.cc', @@ -32,8 +32,8 @@ def build(bld): headers = bld.create_obj('ns3header') headers.source = [ 'address.h', - 'eui48-address.h', - 'eui64-address.h', + 'mac48-address.h', + 'mac64-address.h', 'inet-socket-address.h', 'packet-socket-address.h', 'node.h', diff --git a/src/routing/global-routing/candidate-queue.cc b/src/routing/global-routing/candidate-queue.cc index 67bec63b1..e6d3b552e 100644 --- a/src/routing/global-routing/candidate-queue.cc +++ b/src/routing/global-routing/candidate-queue.cc @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -14,31 +16,30 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/assert.h" #include "candidate-queue.h" -NS_DEBUG_COMPONENT_DEFINE ("CandidateQueue"); +NS_LOG_COMPONENT_DEFINE ("CandidateQueue"); namespace ns3 { CandidateQueue::CandidateQueue() : m_candidates () { - NS_DEBUG("CandidateQueue::CandidateQueue ()"); + NS_LOG_FUNCTION; } CandidateQueue::~CandidateQueue() { - NS_DEBUG("CandidateQueue::~CandidateQueue ()"); + NS_LOG_FUNCTION; Clear (); } void CandidateQueue::Clear (void) { - NS_DEBUG("CandidateQueue::Clear ()"); - + NS_LOG_FUNCTION; while (!m_candidates.empty ()) { SPFVertex *p = Pop (); @@ -50,7 +51,8 @@ CandidateQueue::Clear (void) void CandidateQueue::Push (SPFVertex *vNew) { - NS_DEBUG("CandidateQueue::Push (" << vNew << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << vNew << ")"); CandidateList_t::iterator i = m_candidates.begin (); @@ -68,8 +70,7 @@ CandidateQueue::Push (SPFVertex *vNew) SPFVertex * CandidateQueue::Pop (void) { - NS_DEBUG("CandidateQueue::Pop ()"); - + NS_LOG_FUNCTION; if (m_candidates.empty ()) { return 0; @@ -83,8 +84,7 @@ CandidateQueue::Pop (void) SPFVertex * CandidateQueue::Top (void) const { - NS_DEBUG("CandidateQueue::Top ()"); - + NS_LOG_FUNCTION; if (m_candidates.empty ()) { return 0; @@ -96,24 +96,21 @@ CandidateQueue::Top (void) const bool CandidateQueue::Empty (void) const { - NS_DEBUG("CandidateQueue::Empty ()"); - + NS_LOG_FUNCTION; return m_candidates.empty (); } uint32_t CandidateQueue::Size (void) const { - NS_DEBUG("CandidateQueue::Size ()"); - + NS_LOG_FUNCTION; return m_candidates.size (); } SPFVertex * CandidateQueue::Find (const Ipv4Address addr) const { - NS_DEBUG("CandidateQueue::Find ()"); - + NS_LOG_FUNCTION; CandidateList_t::const_iterator i = m_candidates.begin (); for (; i != m_candidates.end (); i++) @@ -131,8 +128,7 @@ CandidateQueue::Find (const Ipv4Address addr) const void CandidateQueue::Reorder (void) { - NS_DEBUG("CandidateQueue::Reorder ()"); - + NS_LOG_FUNCTION; std::list temp; while (!m_candidates.empty ()) { diff --git a/src/routing/global-routing/candidate-queue.h b/src/routing/global-routing/candidate-queue.h index 09b3a5c22..605ca40b2 100644 --- a/src/routing/global-routing/candidate-queue.h +++ b/src/routing/global-routing/candidate-queue.h @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,8 @@ * 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: Craig Dowell (craigdo@ee.washington.edu) */ #ifndef CANDIDATE_QUEUE_H diff --git a/src/routing/global-routing/global-route-manager-impl.cc b/src/routing/global-routing/global-route-manager-impl.cc index 9ede0a134..88d9def84 100644 --- a/src/routing/global-routing/global-route-manager-impl.cc +++ b/src/routing/global-routing/global-route-manager-impl.cc @@ -1,5 +1,8 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * Copyright (C) 1999, 2000 Kunihiro Ishiguro, Toshiaki Takada + * * 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; @@ -12,6 +15,11 @@ * 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 + * + * Authors: Tom Henderson (tomhend@u.washington.edu) + * + * Kunihiro Ishigura, Toshiaki Takada (GNU Zebra) are attributed authors + * of the quagga 0.99.7/src/ospfd/ospf_spf.c code which was ported here */ #include @@ -19,14 +27,14 @@ #include #include "ns3/assert.h" #include "ns3/fatal-error.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/node-list.h" #include "ns3/ipv4.h" #include "global-router-interface.h" #include "global-route-manager-impl.h" #include "candidate-queue.h" -NS_DEBUG_COMPONENT_DEFINE ("GlobalRouteManager"); +NS_LOG_COMPONENT_DEFINE ("GlobalRouteManager"); namespace ns3 { @@ -46,6 +54,7 @@ SPFVertex::SPFVertex () : m_parent (0), m_children () { + NS_LOG_FUNCTION; } SPFVertex::SPFVertex (GlobalRoutingLSA* lsa) : @@ -57,20 +66,22 @@ SPFVertex::SPFVertex (GlobalRoutingLSA* lsa) : m_parent (0), m_children () { + NS_LOG_FUNCTION; if (lsa->GetLSType () == GlobalRoutingLSA::RouterLSA) { - NS_DEBUG ("SPFVertex:: setting m_vertexType to VertexRouter"); + NS_LOG_LOGIC ("Setting m_vertexType to VertexRouter"); m_vertexType = SPFVertex::VertexRouter; } else if (lsa->GetLSType () == GlobalRoutingLSA::NetworkLSA) { - NS_DEBUG ("SPFVertex:: setting m_vertexType to VertexNetwork"); + NS_LOG_LOGIC ("Setting m_vertexType to VertexNetwork"); m_vertexType = SPFVertex::VertexNetwork; } } SPFVertex::~SPFVertex () { + NS_LOG_FUNCTION; for ( ListOfSPFVertex_t::iterator i = m_children.begin (); i != m_children.end (); i++) @@ -86,96 +97,112 @@ SPFVertex::~SPFVertex () void SPFVertex::SetVertexType (SPFVertex::VertexType type) { + NS_LOG_FUNCTION; m_vertexType = type; } SPFVertex::VertexType SPFVertex::GetVertexType (void) const { + NS_LOG_FUNCTION; return m_vertexType; } void SPFVertex::SetVertexId (Ipv4Address id) { + NS_LOG_FUNCTION; m_vertexId = id; } Ipv4Address SPFVertex::GetVertexId (void) const { + NS_LOG_FUNCTION; return m_vertexId; } void SPFVertex::SetLSA (GlobalRoutingLSA* lsa) { + NS_LOG_FUNCTION; m_lsa = lsa; } GlobalRoutingLSA* SPFVertex::GetLSA (void) const { + NS_LOG_FUNCTION; return m_lsa; } void SPFVertex::SetDistanceFromRoot (uint32_t distance) { + NS_LOG_FUNCTION; m_distanceFromRoot = distance; } uint32_t SPFVertex::GetDistanceFromRoot (void) const { + NS_LOG_FUNCTION; return m_distanceFromRoot; } void SPFVertex::SetOutgoingInterfaceId (uint32_t id) { + NS_LOG_FUNCTION; m_rootOif = id; } uint32_t SPFVertex::GetOutgoingInterfaceId (void) const { + NS_LOG_FUNCTION; return m_rootOif; } void SPFVertex::SetNextHop (Ipv4Address nextHop) { + NS_LOG_FUNCTION; m_nextHop = nextHop; } Ipv4Address SPFVertex::GetNextHop (void) const { + NS_LOG_FUNCTION; return m_nextHop; } void SPFVertex::SetParent (SPFVertex* parent) { + NS_LOG_FUNCTION; m_parent = parent; } SPFVertex* SPFVertex::GetParent (void) const { + NS_LOG_FUNCTION; return m_parent; } uint32_t SPFVertex::GetNChildren (void) const { + NS_LOG_FUNCTION; return m_children.size (); } SPFVertex* SPFVertex::GetChild (uint32_t n) const { + NS_LOG_FUNCTION; uint32_t j = 0; for ( ListOfSPFVertex_t::const_iterator i = m_children.begin (); @@ -194,6 +221,7 @@ SPFVertex::GetChild (uint32_t n) const uint32_t SPFVertex::AddChild (SPFVertex* child) { + NS_LOG_FUNCTION; m_children.push_back (child); return m_children.size (); } @@ -208,29 +236,27 @@ GlobalRouteManagerLSDB::GlobalRouteManagerLSDB () : m_database () { - NS_DEBUG ("GlobalRouteManagerLSDB::GlobalRouteManagerLSDB ()"); + NS_LOG_FUNCTION; } GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB () { - NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ()"); - + NS_LOG_FUNCTION; LSDBMap_t::iterator i; for (i= m_database.begin (); i!= m_database.end (); i++) { - NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ():free LSA"); + NS_LOG_LOGIC ("free LSA"); GlobalRoutingLSA* temp = i->second; delete temp; } - NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB (): clear map"); + NS_LOG_LOGIC ("clear map"); m_database.clear (); } void GlobalRouteManagerLSDB::Initialize () { - NS_DEBUG ("GlobalRouteManagerLSDB::Initialize ()"); - + NS_LOG_FUNCTION; LSDBMap_t::iterator i; for (i= m_database.begin (); i!= m_database.end (); i++) { @@ -242,14 +268,14 @@ GlobalRouteManagerLSDB::Initialize () void GlobalRouteManagerLSDB::Insert (Ipv4Address addr, GlobalRoutingLSA* lsa) { - NS_DEBUG ("GlobalRouteManagerLSDB::Insert ()"); + NS_LOG_FUNCTION; m_database.insert (LSDBPair_t (addr, lsa)); } GlobalRoutingLSA* GlobalRouteManagerLSDB::GetLSA (Ipv4Address addr) const { - NS_DEBUG ("GlobalRouteManagerLSDB::GetLSA ()"); + NS_LOG_FUNCTION; // // Look up an LSA by its address. // @@ -267,7 +293,7 @@ GlobalRouteManagerLSDB::GetLSA (Ipv4Address addr) const GlobalRoutingLSA* GlobalRouteManagerLSDB::GetLSAByLinkData (Ipv4Address addr) const { - NS_DEBUG ("GlobalRouteManagerLSDB::GetLSAByLinkData ()"); + NS_LOG_FUNCTION; // // Look up an LSA by its address. // @@ -299,14 +325,13 @@ GlobalRouteManagerImpl::GlobalRouteManagerImpl () : m_spfroot (0) { - NS_DEBUG ("GlobalRouteManagerImpl::GlobalRoutemanagerImpl ()"); + NS_LOG_FUNCTION; m_lsdb = new GlobalRouteManagerLSDB (); } GlobalRouteManagerImpl::~GlobalRouteManagerImpl () { - NS_DEBUG ("GlobalRouteManagerImpl::~GlobalRouteManagerImpl ()"); - + NS_LOG_FUNCTION; if (m_lsdb) { delete m_lsdb; @@ -316,8 +341,7 @@ GlobalRouteManagerImpl::~GlobalRouteManagerImpl () void GlobalRouteManagerImpl::DebugUseLsdb (GlobalRouteManagerLSDB* lsdb) { - NS_DEBUG ("GlobalRouteManagerImpl::DebugUseLsdb ()"); - + NS_LOG_FUNCTION; if (m_lsdb) { delete m_lsdb; @@ -335,15 +359,12 @@ GlobalRouteManagerImpl::DebugUseLsdb (GlobalRouteManagerLSDB* lsdb) void GlobalRouteManagerImpl::SelectRouterNodes () { - NS_DEBUG ("GlobalRouteManagerImpl::SelectRouterNodes ()"); - - typedef std::vector < Ptr >::iterator Iterator; - for (Iterator i = NodeList::Begin (); i != NodeList::End (); i++) + NS_LOG_FUNCTION; + for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++) { Ptr node = *i; - NS_DEBUG ("GlobalRouteManagerImpl::SelectRouterNodes (): " - "Adding GlobalRouter interface to node " << - node->GetId ()); + NS_LOG_LOGIC ("Adding GlobalRouter interface to node " << + node->GetId ()); Ptr globalRouter = Create (node); node->AddInterface (globalRouter); @@ -362,12 +383,11 @@ GlobalRouteManagerImpl::SelectRouterNodes () void GlobalRouteManagerImpl::BuildGlobalRoutingDatabase () { - NS_DEBUG ("GlobalRouteManagerImpl::BuildGlobalRoutingDatabase()"); + NS_LOG_FUNCTION; // // Walk the list of nodes looking for the GlobalRouter Interface. // - typedef std::vector < Ptr >::iterator Iterator; - for (Iterator i = NodeList::Begin (); i != NodeList::End (); i++) + for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++) { Ptr node = *i; @@ -389,7 +409,7 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase () // found. // uint32_t numLSAs = rtr->DiscoverLSAs (); - NS_DEBUG ("Discover LSAs: Found " << numLSAs << " LSAs"); + NS_LOG_LOGIC ("Found " << numLSAs << " LSAs"); for (uint32_t j = 0; j < numLSAs; ++j) { @@ -399,7 +419,7 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase () // router. // rtr->GetLSA (j, *lsa); - NS_DEBUG (*lsa); + NS_LOG_LOGIC (*lsa); // // Write the newly discovered link state advertisement to the database. // @@ -444,12 +464,11 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase () void GlobalRouteManagerImpl::InitializeRoutes () { - NS_DEBUG ("GlobalRouteManagerImpl::InitializeRoutes ()"); + NS_LOG_FUNCTION; // // Walk the list of nodes in the system. // - typedef std::vector < Ptr >::iterator Iterator; - for (Iterator i = NodeList::Begin (); i != NodeList::End (); i++) + for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++) { Ptr node = *i; // @@ -485,16 +504,17 @@ GlobalRouteManagerImpl::InitializeRoutes () void GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) { + NS_LOG_FUNCTION; + SPFVertex* w = 0; GlobalRoutingLSA* w_lsa = 0; GlobalRoutingLinkRecord *l = 0; uint32_t distance = 0; uint32_t numRecordsInVertex = 0; - - NS_DEBUG ("GlobalRouteManagerImpl::SPFNext ()"); - +// // V points to a Router-LSA or Network-LSA // Loop over the links in router LSA or attached routers in Network LSA +// if (v->GetVertexType () == SPFVertex::VertexRouter) { numRecordsInVertex = v->GetLSA ()->GetNLinkRecords (); @@ -509,7 +529,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) // Get w_lsa: In case of V is Router-LSA if (v->GetVertexType () == SPFVertex::VertexRouter) { - NS_DEBUG ("SPFNext: Examining " << v->GetVertexId () << "'s " << + NS_LOG_LOGIC ("Examining " << v->GetVertexId () << "'s " << v->GetLSA ()->GetNLinkRecords () << " link records"); // // (a) If this is a link to a stub network, examine the next link in V's LSA. @@ -519,8 +539,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) l = v->GetLSA ()->GetLinkRecord (i); if (l->GetLinkType () == GlobalRoutingLinkRecord::StubNetwork) { - NS_DEBUG ("SPFNext: Found a Stub record to " << - l->GetLinkId ()); + NS_LOG_LOGIC ("Found a Stub record to " << l->GetLinkId ()); continue; } // @@ -536,7 +555,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) // w_lsa = m_lsdb->GetLSA (l->GetLinkId ()); NS_ASSERT (w_lsa); - NS_DEBUG ("SPFNext: Found a P2P record from " << + NS_LOG_LOGIC ("Found a P2P record from " << v->GetVertexId () << " to " << w_lsa->GetLinkStateId ()); } else if (l->GetLinkType () == @@ -544,7 +563,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) { w_lsa = m_lsdb->GetLSA (l->GetLinkId ()); NS_ASSERT (w_lsa); - NS_DEBUG ("SPFNext: Found a Transit record from " << + NS_LOG_LOGIC ("Found a Transit record from " << v->GetVertexId () << " to " << w_lsa->GetLinkStateId ()); } else @@ -561,7 +580,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) { continue; } - NS_DEBUG ("SPFNext: Found a Network LSA from " << + NS_LOG_LOGIC ("Found a Network LSA from " << v->GetVertexId () << " to " << w_lsa->GetLinkStateId ()); } @@ -575,7 +594,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) // if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_IN_SPFTREE) { - NS_DEBUG ("SPFNext: Skipping-> LSA "<< + NS_LOG_LOGIC ("Skipping -> LSA "<< w_lsa->GetLinkStateId () << " already in SPF tree"); continue; } @@ -594,7 +613,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) distance = v->GetDistanceFromRoot (); } - NS_DEBUG ("SPFNext: Considering w_lsa " << w_lsa->GetLinkStateId ()); + NS_LOG_LOGIC ("Considering w_lsa " << w_lsa->GetLinkStateId ()); // Is there already vertex w in candidate list? if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED) @@ -616,7 +635,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) // root node). // candidate.Push (w); - NS_DEBUG ("SPFNext: Pushing " << + NS_LOG_LOGIC ("Pushing " << w->GetVertexId () << ", parent vertexId: " << v->GetVertexId ()); } @@ -685,8 +704,8 @@ GlobalRouteManagerImpl::SPFNexthopCalculation ( GlobalRoutingLinkRecord* l, uint32_t distance) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFNexthopCalculation ()"); - + NS_LOG_FUNCTION; +// // If w is a NetworkVertex, l should be null /* if (w->GetVertexType () == SPFVertex::VertexNetwork && l) @@ -766,7 +785,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation ( w->SetOutgoingInterfaceId ( FindOutgoingInterfaceId (l->GetLinkData ())); - NS_DEBUG ("SPFNexthopCalculation: Next hop from " << + NS_LOG_LOGIC ("Next hop from " << v->GetVertexId () << " to " << w->GetVertexId () << " goes through next hop " << w->GetNextHop () << " via outgoing interface " << w->GetOutgoingInterfaceId ()); @@ -783,7 +802,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation ( w_lsa->GetNetworkLSANetworkMask () )); w->SetDistanceFromRoot (distance); w->SetParent (v); - NS_DEBUG ("SPFNexthopCalculation: Next hop from " << + NS_LOG_LOGIC ("Next hop from " << v->GetVertexId () << " to network " << w->GetVertexId () << " via outgoing interface " << w->GetOutgoingInterfaceId ()); return 1; @@ -810,7 +829,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation ( */ w->SetNextHop(linkRemote->GetLinkData ()); w->SetOutgoingInterfaceId (v->GetOutgoingInterfaceId ()); - NS_DEBUG ("SPFNexthopCalculation: Next hop from " << + NS_LOG_LOGIC ("Next hop from " << v->GetVertexId () << " to " << w->GetVertexId () << " goes through next hop " << w->GetNextHop () << " via outgoing interface " << w->GetOutgoingInterfaceId ()); @@ -867,7 +886,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( SPFVertex* w, GlobalRoutingLinkRecord* prev_link) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFGetNextLink ()"); + NS_LOG_FUNCTION; bool skip = true; bool found_prev_link = false; @@ -901,12 +920,12 @@ GlobalRouteManagerImpl::SPFGetNextLink ( { if (!found_prev_link) { - NS_DEBUG ("SPFGetNextLink: Skipping links before prev_link found"); + NS_LOG_LOGIC ("Skipping links before prev_link found"); found_prev_link = true; continue; } - NS_DEBUG ("SPFGetNextLink: Found matching link l: linkId = " << + NS_LOG_LOGIC ("Found matching link l: linkId = " << l->GetLinkId () << " linkData = " << l->GetLinkData ()); // // If skip is false, don't (not too surprisingly) skip the link found -- it's @@ -917,7 +936,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( // if (skip == false) { - NS_DEBUG ("SPFGetNextLink: Returning the found link"); + NS_LOG_LOGIC ("Returning the found link"); return l; } else @@ -927,7 +946,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( // Setting skip to false gets us the next point-to-point global router link // record in the LSA from . // - NS_DEBUG ("SPFGetNextLink: Skipping the found link"); + NS_LOG_LOGIC ("Skipping the found link"); skip = false; continue; } @@ -942,7 +961,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( void GlobalRouteManagerImpl::DebugSPFCalculate (Ipv4Address root) { - NS_DEBUG ("GlobalRouteManagerImpl::DebugSPFCalculate ()"); + NS_LOG_FUNCTION; SPFCalculate (root); } @@ -950,8 +969,8 @@ GlobalRouteManagerImpl::DebugSPFCalculate (Ipv4Address root) void GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFCalculate (): " - "root = " << root); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << root << ")"); SPFVertex *v; // @@ -1017,7 +1036,7 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root) // the candidate list. // v = candidate.Pop (); - NS_DEBUG ("SPFCalculate: Popped vertex " << v->GetVertexId ()); + NS_LOG_LOGIC ("Popped vertex " << v->GetVertexId ()); // // Update the status field of the vertex to indicate that it is in the SPF // tree. @@ -1091,87 +1110,15 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root) m_spfroot = 0; } -// -// XXX This should probably be a method on Ipv4 -// -// Return the interface index corresponding to a given IP address -// - uint32_t -GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a) -{ -// -// We have an IP address and a vertex ID of the root of the SPF tree. -// The question is what interface index does this address correspond to. -// The answer is a little complicated since we have to find a pointer to -// the node corresponding to the vertex ID, find the Ipv4 interface on that -// node in order to iterate the interfaces and find the one corresponding to -// the address in question. -// - Ipv4Address routerId = m_spfroot->GetVertexId (); -// -// Walk the list of nodes in the system looking for the one corresponding to -// the node at the root of the SPF tree. This is the node for which we are -// building the routing table. -// - std::vector >::iterator i = NodeList::Begin (); - for (; i != NodeList::End (); i++) - { - Ptr node = *i; - - Ptr rtr = - node->QueryInterface (GlobalRouter::iid); -// -// If the node doesn't have a GlobalRouter interface it can't be the one -// we're interested in. -// - if (rtr == 0) - { - continue; - } - - if (rtr->GetRouterId () == routerId) - { -// -// This is the node we're building the routing table for. We're going to need -// the Ipv4 interface to look for the ipv4 interface index. Since this node -// is participating in routing IP version 4 packets, it certainly must have -// an Ipv4 interface. -// - Ptr ipv4 = node->QueryInterface (Ipv4::iid); - NS_ASSERT_MSG (ipv4, - "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): " - "QI for interface failed"); -// -// Look through the interfaces on this node for one that has the IP address -// we're looking for. If we find one, return the corresponding interface -// index. -// - for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++) - { - if (ipv4->GetAddress (i) == a) - { - NS_DEBUG ( - "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): " - "Interface match for " << a); - return i; - } - } - } - } -// -// Couldn't find it. -// - return 0; -} - -// -// XXX This should probably be a method on Ipv4 // // Return the interface index corresponding to a given IP address +// This is a wrapper around GetIfIndexByIpv4Address(), but we first +// have to find the right node pointer to pass to that function. // uint32_t GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) { + NS_LOG_FUNCTION; // // We have an IP address and a vertex ID of the root of the SPF tree. // The question is what interface index does this address correspond to. @@ -1186,7 +1133,7 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) // the node at the root of the SPF tree. This is the node for which we are // building the routing table. // - std::vector >::iterator i = NodeList::Begin (); + NodeList::Iterator i = NodeList::Begin (); for (; i != NodeList::End (); i++) { Ptr node = *i; @@ -1219,17 +1166,7 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) // we're looking for. If we find one, return the corresponding interface // index. // - for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++) - { - if (ipv4->GetAddress (i).CombineMask(amask) == - a.CombineMask(amask) ) - { - NS_DEBUG ( - "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): " - "Interface match for " << a); - return i; - } - } + return (Ipv4::GetIfIndexByAddress (node, a, amask) ); } } // @@ -1257,7 +1194,7 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask) void GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter ()"); + NS_LOG_FUNCTION; NS_ASSERT_MSG (m_spfroot, "GlobalRouteManagerImpl::SPFIntraAddRouter (): Root pointer not set"); @@ -1270,14 +1207,13 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) // Ipv4Address routerId = m_spfroot->GetVertexId (); - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): " - "Vertex ID = " << routerId); + NS_LOG_LOGIC ("Vertex ID = " << routerId); // // We need to walk the list of nodes looking for the one that has the router // ID corresponding to the root vertex. This is the one we're going to write // the routing information to. // - std::vector >::iterator i = NodeList::Begin (); + NodeList::Iterator i = NodeList::Begin (); for (; i != NodeList::End (); i++) { Ptr node = *i; @@ -1291,8 +1227,8 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) if (rtr == 0) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): " - "No GlobalRouter interface on node " << node->GetId ()); + NS_LOG_LOGIC ("No GlobalRouter interface on node " << + node->GetId ()); continue; } // @@ -1300,13 +1236,11 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) // root of the SPF tree, then this node is the one for which we need to // write the routing tables. // - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): " - "Considering router " << rtr->GetRouterId ()); + NS_LOG_LOGIC ("Considering router " << rtr->GetRouterId ()); if (rtr->GetRouterId () == routerId) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): " - "setting routes for node " << node->GetId ()); + NS_LOG_LOGIC ("Setting routes for node " << node->GetId ()); // // Routing information is updated using the Ipv4 interface. We need to QI // for that interface. If the node is acting as an IP version 4 router, it @@ -1347,8 +1281,7 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) continue; } - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): " - " Node " << node->GetId () << + NS_LOG_LOGIC (" Node " << node->GetId () << " add route to " << lr->GetLinkData () << " using next hop " << v->GetNextHop () << " via interface " << v->GetOutgoingInterfaceId ()); @@ -1378,7 +1311,7 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v) void GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit ()"); + NS_LOG_FUNCTION; NS_ASSERT_MSG (m_spfroot, "GlobalRouteManagerImpl::SPFIntraAddTransit (): Root pointer not set"); @@ -1391,14 +1324,13 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) // Ipv4Address routerId = m_spfroot->GetVertexId (); - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " - "Vertex ID = " << routerId); + NS_LOG_LOGIC ("Vertex ID = " << routerId); // // We need to walk the list of nodes looking for the one that has the router // ID corresponding to the root vertex. This is the one we're going to write // the routing information to. // - std::vector >::iterator i = NodeList::Begin (); + NodeList::Iterator i = NodeList::Begin (); for (; i != NodeList::End (); i++) { Ptr node = *i; @@ -1412,8 +1344,8 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) if (rtr == 0) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " - "No GlobalRouter interface on node " << node->GetId ()); + NS_LOG_LOGIC ("No GlobalRouter interface on node " << + node->GetId ()); continue; } // @@ -1421,13 +1353,11 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) // root of the SPF tree, then this node is the one for which we need to // write the routing tables. // - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " - "Considering router " << rtr->GetRouterId ()); + NS_LOG_LOGIC ("Considering router " << rtr->GetRouterId ()); if (rtr->GetRouterId () == routerId) { - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): " - "setting routes for node " << node->GetId ()); + NS_LOG_LOGIC ("setting routes for node " << node->GetId ()); // // Routing information is updated using the Ipv4 interface. We need to QI // for that interface. If the node is acting as an IP version 4 router, it @@ -1452,8 +1382,7 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) tempip = tempip.CombineMask (tempmask); ipv4->AddNetworkRouteTo (tempip, tempmask, v->GetNextHop (), v->GetOutgoingInterfaceId ()); - NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddNetwork (): " - " Node " << node->GetId () << + NS_LOG_LOGIC ("Node " << node->GetId () << " add network route to " << tempip << " using next hop " << v->GetNextHop () << " via interface " << v->GetOutgoingInterfaceId ()); @@ -1475,6 +1404,7 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v) void GlobalRouteManagerImpl::SPFVertexAddParent (SPFVertex* v) { + NS_LOG_FUNCTION; v->GetParent ()->AddChild (v); } @@ -1493,27 +1423,6 @@ GlobalRouteManagerImpl::SPFVertexAddParent (SPFVertex* v) namespace ns3 { -class GlobalRouterTestNode : public Node -{ -public: - GlobalRouterTestNode (); - -private: - virtual void DoAddDevice (Ptr device) const {}; - virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); -}; - -GlobalRouterTestNode::GlobalRouterTestNode () -{ -// Ptr ipv4 = Create (this); -} - - TraceResolver* -GlobalRouterTestNode::DoCreateTraceResolver (TraceContext const &context) -{ - return 0; -} - class GlobalRouteManagerImplTest : public Test { public: GlobalRouteManagerImplTest (); @@ -1696,6 +1605,9 @@ GlobalRouteManagerImplTest::RunTests (void) srm->DebugSPFCalculate (lsa0->GetLinkStateId ()); // node n0 Simulator::Run (); + +// XXX here we should do some verification of the routes built + Simulator::Destroy (); // This delete clears the srm, which deletes the LSDB, which clears @@ -1706,7 +1618,6 @@ GlobalRouteManagerImplTest::RunTests (void) } // Instantiate this class for the unit tests -// XXX here we should do some verification of the routes built static GlobalRouteManagerImplTest g_globalRouteManagerTest; } // namespace ns3 diff --git a/src/routing/global-routing/global-route-manager-impl.h b/src/routing/global-routing/global-route-manager-impl.h index 739e20592..55d4099f6 100644 --- a/src/routing/global-routing/global-route-manager-impl.h +++ b/src/routing/global-routing/global-route-manager-impl.h @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,9 @@ * 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 + * + * Authors: Craig Dowell (craigdo@ee.washington.edu) + * Tom Henderson (tomhend@u.washington.edu) */ #ifndef GLOBAL_ROUTE_MANAGER_IMPL_H @@ -754,8 +759,8 @@ private: GlobalRoutingLinkRecord* prev_link); void SPFIntraAddRouter (SPFVertex* v); void SPFIntraAddTransit (SPFVertex* v); - uint32_t FindOutgoingInterfaceId (Ipv4Address a); - uint32_t FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask); + uint32_t FindOutgoingInterfaceId (Ipv4Address a, + Ipv4Mask amask = Ipv4Mask("255.255.255.255")); }; } // namespace ns3 diff --git a/src/routing/global-routing/global-route-manager.cc b/src/routing/global-routing/global-route-manager.cc index c166da015..4349f0df8 100644 --- a/src/routing/global-routing/global-route-manager.cc +++ b/src/routing/global-routing/global-route-manager.cc @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,10 +14,12 @@ * 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: Tom Henderson (tomhend@u.washington.edu) */ #include "ns3/assert.h" -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/simulation-singleton.h" #include "global-route-manager.h" #include "global-route-manager-impl.h" diff --git a/src/routing/global-routing/global-route-manager.h b/src/routing/global-routing/global-route-manager.h index 7562da67d..333aff78c 100644 --- a/src/routing/global-routing/global-route-manager.h +++ b/src/routing/global-routing/global-route-manager.h @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,9 @@ * 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 + * + * Authors: Craig Dowell (craigdo@ee.washington.edu) + * Tom Henderson (tomhend@u.washington.edu) */ #ifndef GLOBAL_ROUTE_MANAGER_H diff --git a/src/routing/global-routing/global-router-interface.cc b/src/routing/global-routing/global-router-interface.cc index c057f9ddf..2819b7a24 100644 --- a/src/routing/global-routing/global-router-interface.cc +++ b/src/routing/global-routing/global-router-interface.cc @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,9 +14,11 @@ * 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 + * + * Authors: Tom Henderson (tomhend@u.washington.edu) */ -#include "ns3/debug.h" +#include "ns3/log.h" #include "ns3/assert.h" #include "ns3/channel.h" #include "ns3/net-device.h" @@ -22,7 +26,7 @@ #include "ns3/ipv4.h" #include "global-router-interface.h" -NS_DEBUG_COMPONENT_DEFINE ("GlobalRouter"); +NS_LOG_COMPONENT_DEFINE ("GlobalRouter"); namespace ns3 { @@ -39,7 +43,7 @@ GlobalRoutingLinkRecord::GlobalRoutingLinkRecord () m_linkType (Unknown), m_metric (0) { - NS_DEBUG("GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ()"); + NS_LOG_FUNCTION; } GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ( @@ -53,47 +57,48 @@ GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ( m_linkType (linkType), m_metric (metric) { - NS_DEBUG("GlobalRoutingLinkRecord::GlobalRoutingLinkRecord (" << - linkType << ", " << linkId << ", " << linkData << ", " << metric << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << linkType << ", " << linkId << ", " << linkData << + ", " << metric << ")"); } GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord () { - NS_DEBUG("GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord ()"); + NS_LOG_FUNCTION; } Ipv4Address GlobalRoutingLinkRecord::GetLinkId (void) const { - NS_DEBUG("GlobalRoutingLinkRecord::GetLinkId ()"); + NS_LOG_FUNCTION; return m_linkId; } void GlobalRoutingLinkRecord::SetLinkId (Ipv4Address addr) { - NS_DEBUG("GlobalRoutingLinkRecord::SetLinkId ()"); + NS_LOG_FUNCTION; m_linkId = addr; } Ipv4Address GlobalRoutingLinkRecord::GetLinkData (void) const { - NS_DEBUG("GlobalRoutingLinkRecord::GetLinkData ()"); + NS_LOG_FUNCTION; return m_linkData; } void GlobalRoutingLinkRecord::SetLinkData (Ipv4Address addr) { - NS_DEBUG("GlobalRoutingLinkRecord::SetLinkData ()"); + NS_LOG_FUNCTION; m_linkData = addr; } GlobalRoutingLinkRecord::LinkType GlobalRoutingLinkRecord::GetLinkType (void) const { - NS_DEBUG("GlobalRoutingLinkRecord::GetLinkType ()"); + NS_LOG_FUNCTION; return m_linkType; } @@ -101,21 +106,21 @@ GlobalRoutingLinkRecord::GetLinkType (void) const GlobalRoutingLinkRecord::SetLinkType ( GlobalRoutingLinkRecord::LinkType linkType) { - NS_DEBUG("GlobalRoutingLinkRecord::SetLinkType ()"); + NS_LOG_FUNCTION; m_linkType = linkType; } uint32_t GlobalRoutingLinkRecord::GetMetric (void) const { - NS_DEBUG("GlobalRoutingLinkRecord::GetMetric ()"); + NS_LOG_FUNCTION; return m_metric; } void GlobalRoutingLinkRecord::SetMetric (uint32_t metric) { - NS_DEBUG("GlobalRoutingLinkRecord::SetMetric ()"); + NS_LOG_FUNCTION; m_metric = metric; } @@ -135,7 +140,7 @@ GlobalRoutingLSA::GlobalRoutingLSA() m_attachedRouters(), m_status(GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED) { - NS_DEBUG("GlobalRoutingLSA::GlobalRoutingLSA ()"); + NS_LOG_FUNCTION; } GlobalRoutingLSA::GlobalRoutingLSA ( @@ -151,8 +156,9 @@ GlobalRoutingLSA::GlobalRoutingLSA ( m_attachedRouters(), m_status(status) { - NS_DEBUG("GlobalRoutingLSA::GlobalRoutingLSA (" << status << ", " << - linkStateId << ", " << advertisingRtr << ")"); + NS_LOG_FUNCTION; + NS_LOG_PARAM ("(" << status << ", " << linkStateId << ", " << + advertisingRtr << ")"); } GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa) @@ -161,6 +167,7 @@ GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa) m_networkLSANetworkMask(lsa.m_networkLSANetworkMask), m_status(lsa.m_status) { + NS_LOG_FUNCTION; NS_ASSERT_MSG(IsEmpty(), "GlobalRoutingLSA::GlobalRoutingLSA (): Non-empty LSA in constructor"); CopyLinkRecords (lsa); @@ -169,6 +176,7 @@ GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa) GlobalRoutingLSA& GlobalRoutingLSA::operator= (const GlobalRoutingLSA& lsa) { + NS_LOG_FUNCTION; m_lsType = lsa.m_lsType; m_linkStateId = lsa.m_linkStateId; m_advertisingRtr = lsa.m_advertisingRtr; @@ -183,6 +191,7 @@ GlobalRoutingLSA::operator= (const GlobalRoutingLSA& lsa) void GlobalRoutingLSA::CopyLinkRecords (const GlobalRoutingLSA& lsa) { + NS_LOG_FUNCTION; for (ListOfLinkRecords_t::const_iterator i = lsa.m_linkRecords.begin (); i != lsa.m_linkRecords.end (); i++) @@ -203,18 +212,19 @@ GlobalRoutingLSA::CopyLinkRecords (const GlobalRoutingLSA& lsa) GlobalRoutingLSA::~GlobalRoutingLSA() { - NS_DEBUG("GlobalRoutingLSA::~GlobalRoutingLSA ()"); + NS_LOG_FUNCTION; ClearLinkRecords (); } void GlobalRoutingLSA::ClearLinkRecords(void) { + NS_LOG_FUNCTION; for ( ListOfLinkRecords_t::iterator i = m_linkRecords.begin (); i != m_linkRecords.end (); i++) { - NS_DEBUG("GlobalRoutingLSA::ClearLinkRecords (): free link record"); + NS_LOG_LOGIC ("Free link record"); GlobalRoutingLinkRecord *p = *i; delete p; @@ -222,13 +232,14 @@ GlobalRoutingLSA::ClearLinkRecords(void) *i = 0; } - NS_DEBUG("GlobalRoutingLSA::ClearLinkRecords(): clear list"); + NS_LOG_LOGIC ("Clear list"); m_linkRecords.clear(); } uint32_t GlobalRoutingLSA::AddLinkRecord (GlobalRoutingLinkRecord* lr) { + NS_LOG_FUNCTION; m_linkRecords.push_back (lr); return m_linkRecords.size (); } @@ -236,12 +247,14 @@ GlobalRoutingLSA::AddLinkRecord (GlobalRoutingLinkRecord* lr) uint32_t GlobalRoutingLSA::GetNLinkRecords (void) const { + NS_LOG_FUNCTION; return m_linkRecords.size (); } GlobalRoutingLinkRecord * GlobalRoutingLSA::GetLinkRecord (uint32_t n) const { + NS_LOG_FUNCTION; uint32_t j = 0; for ( ListOfLinkRecords_t::const_iterator i = m_linkRecords.begin (); i != m_linkRecords.end (); @@ -259,66 +272,77 @@ GlobalRoutingLSA::GetLinkRecord (uint32_t n) const bool GlobalRoutingLSA::IsEmpty (void) const { + NS_LOG_FUNCTION; return m_linkRecords.size () == 0; } GlobalRoutingLSA::LSType GlobalRoutingLSA::GetLSType (void) const { + NS_LOG_FUNCTION; return m_lsType; } void GlobalRoutingLSA::SetLSType (GlobalRoutingLSA::LSType typ) { + NS_LOG_FUNCTION; m_lsType = typ; } Ipv4Address GlobalRoutingLSA::GetLinkStateId (void) const { + NS_LOG_FUNCTION; return m_linkStateId; } void GlobalRoutingLSA::SetLinkStateId (Ipv4Address addr) { + NS_LOG_FUNCTION; m_linkStateId = addr; } Ipv4Address GlobalRoutingLSA::GetAdvertisingRouter (void) const { + NS_LOG_FUNCTION; return m_advertisingRtr; } void GlobalRoutingLSA::SetAdvertisingRouter (Ipv4Address addr) { + NS_LOG_FUNCTION; m_advertisingRtr = addr; } void GlobalRoutingLSA::SetNetworkLSANetworkMask (Ipv4Mask mask) { + NS_LOG_FUNCTION; m_networkLSANetworkMask = mask; } Ipv4Mask GlobalRoutingLSA::GetNetworkLSANetworkMask (void) const { + NS_LOG_FUNCTION; return m_networkLSANetworkMask; } GlobalRoutingLSA::SPFStatus GlobalRoutingLSA::GetStatus (void) const { + NS_LOG_FUNCTION; return m_status; } uint32_t GlobalRoutingLSA::AddAttachedRouter (Ipv4Address addr) { + NS_LOG_FUNCTION; m_attachedRouters.push_back (addr); return m_attachedRouters.size (); } @@ -326,12 +350,14 @@ GlobalRoutingLSA::AddAttachedRouter (Ipv4Address addr) uint32_t GlobalRoutingLSA::GetNAttachedRouters (void) const { + NS_LOG_FUNCTION; return m_attachedRouters.size (); } Ipv4Address GlobalRoutingLSA::GetAttachedRouter (uint32_t n) const { + NS_LOG_FUNCTION; uint32_t j = 0; for ( ListOfAttachedRouters_t::const_iterator i = m_attachedRouters.begin (); i != m_attachedRouters.end (); @@ -342,13 +368,15 @@ GlobalRoutingLSA::GetAttachedRouter (uint32_t n) const return *i; } } - NS_ASSERT_MSG(false, "GlobalRoutingLSA::GetAttachedRouter (): invalid index"); + NS_ASSERT_MSG(false, + "GlobalRoutingLSA::GetAttachedRouter (): invalid index"); return Ipv4Address("0.0.0.0"); } void GlobalRoutingLSA::SetStatus (GlobalRoutingLSA::SPFStatus status) { + NS_LOG_FUNCTION; m_status = status; } @@ -409,20 +437,21 @@ const InterfaceId GlobalRouter::iid = GlobalRouter::GlobalRouter (Ptr node) : m_node(node), m_LSAs() { - NS_DEBUG("GlobalRouter::GlobalRouter ()"); + NS_LOG_FUNCTION; SetInterfaceId (GlobalRouter::iid); m_routerId.Set(GlobalRouteManager::AllocateRouterId ()); } GlobalRouter::~GlobalRouter () { - NS_DEBUG("GlobalRouter::~GlobalRouter ()"); + NS_LOG_FUNCTION; ClearLSAs(); } void GlobalRouter::DoDispose () { + NS_LOG_FUNCTION; m_node = 0; Object::DoDispose (); } @@ -430,13 +459,12 @@ GlobalRouter::DoDispose () void GlobalRouter::ClearLSAs () { - NS_DEBUG("GlobalRouter::ClearLSAs ()"); - + NS_LOG_FUNCTION; for ( ListOfLSAs_t::iterator i = m_LSAs.begin (); i != m_LSAs.end (); i++) { - NS_DEBUG("GlobalRouter::ClearLSAs (): free LSA"); + NS_LOG_LOGIC ("Free LSA"); GlobalRoutingLSA *p = *i; delete p; @@ -444,13 +472,14 @@ GlobalRouter::ClearLSAs () *i = 0; } - NS_DEBUG("GlobalRouter::ClearLSAs (): clear list"); + NS_LOG_LOGIC ("Clear list"); m_LSAs.clear(); } Ipv4Address GlobalRouter::GetRouterId (void) const { + NS_LOG_FUNCTION; return m_routerId; } @@ -461,7 +490,8 @@ GlobalRouter::GetRouterId (void) const uint32_t GlobalRouter::DiscoverLSAs (void) { - NS_DEBUG("GlobalRouter::DiscoverLSAs () for node " << m_node->GetId () ); + NS_LOG_FUNCTION; + NS_LOG_LOGIC("For node " << m_node->GetId () ); NS_ASSERT_MSG(m_node, "GlobalRouter::DiscoverLSAs (): interface not set"); @@ -494,14 +524,14 @@ GlobalRouter::DiscoverLSAs (void) // ethernets, etc.). // uint32_t numDevices = m_node->GetNDevices(); - NS_DEBUG("GlobalRouter::DiscoverLSAs (): numDevices = " << numDevices); + NS_LOG_LOGIC ("numDevices = " << numDevices); for (uint32_t i = 0; i < numDevices; ++i) { Ptr ndLocal = m_node->GetDevice(i); if (ndLocal->IsBroadcast () && !ndLocal->IsPointToPoint () ) { - NS_DEBUG("GlobalRouter::DiscoverLSAs (): broadcast link"); + NS_LOG_LOGIC ("Broadcast link"); GlobalRoutingLinkRecord *plr = new GlobalRoutingLinkRecord; // // We need to determine whether we are on a transit or stub network @@ -516,7 +546,7 @@ GlobalRouter::DiscoverLSAs (void) uint32_t ifIndexLocal = FindIfIndexForDevice(m_node, ndLocal); Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal); Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal); - NS_DEBUG("Working with local address " << addrLocal); + NS_LOG_LOGIC ("Working with local address " << addrLocal); // // Now, we're going to walk over to the remote net device on the other end of // the point-to-point channel we now know we have. This is where our adjacent @@ -527,7 +557,7 @@ GlobalRouter::DiscoverLSAs (void) if (nDevices == 1) { // This is a stub broadcast interface - NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA stub broadcast link"); + NS_LOG_LOGIC("Router-LSA stub broadcast link"); // XXX in future, need to consider if >1 includes other routers plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); // Link ID is IP network number of attached network @@ -544,7 +574,7 @@ GlobalRouter::DiscoverLSAs (void) } else { - NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA Broadcast link"); + NS_LOG_LOGIC ("Router-LSA Broadcast link"); // multiple routers on a broadcast interface // lowest IP address is designated router plr->SetLinkType (GlobalRoutingLinkRecord::TransitNetwork); @@ -554,8 +584,7 @@ GlobalRouter::DiscoverLSAs (void) if (desigRtr == addrLocal) { listOfDRInterfaces.push_back (ndLocal); - NS_DEBUG("GlobalRouter::DiscoverLSAs (): " << - m_node->GetId () << " is a DR"); + NS_LOG_LOGIC (m_node->GetId () << " is a DR"); } plr->SetLinkId (desigRtr); // Link Data is router's own IP address @@ -569,7 +598,7 @@ GlobalRouter::DiscoverLSAs (void) } else if (ndLocal->IsPointToPoint () ) { - NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA Point-to-point device"); + NS_LOG_LOGIC ("Router-LSA Point-to-point device"); // // Now, we have to find the Ipv4 interface whose netdevice is the one we // just found. This is still the IP on the local side of the channel. There @@ -583,7 +612,7 @@ GlobalRouter::DiscoverLSAs (void) // Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal); Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal); - NS_DEBUG("Working with local address " << addrLocal); + NS_LOG_LOGIC ("Working with local address " << addrLocal); // // Now, we're going to walk over to the remote net device on the other end of // the point-to-point channel we now know we have. This is where our adjacent @@ -608,7 +637,7 @@ GlobalRouter::DiscoverLSAs (void) NS_ASSERT_MSG(srRemote, "GlobalRouter::DiscoverLSAs():QI for remote failed"); Ipv4Address rtrIdRemote = srRemote->GetRouterId(); - NS_DEBUG("Working with remote router " << rtrIdRemote); + NS_LOG_LOGIC ("Working with remote router " << rtrIdRemote); // // Now, just like we did above, we need to get the IP interface index for the // net device on the other end of the point-to-point channel. @@ -620,7 +649,7 @@ GlobalRouter::DiscoverLSAs (void) // Ipv4Address addrRemote = ipv4Remote->GetAddress(ifIndexRemote); Ipv4Mask maskRemote = ipv4Remote->GetNetworkMask(ifIndexRemote); - NS_DEBUG("Working with remote address " << addrRemote); + NS_LOG_LOGIC ("Working with remote address " << addrRemote); // // Now we can fill out the link records for this link. There are always two // link records; the first is a point-to-point record describing the link and @@ -650,8 +679,7 @@ GlobalRouter::DiscoverLSAs (void) // The LSA goes on a list of LSAs in case we want to begin exporting other // kinds of advertisements (than Router LSAs). m_LSAs.push_back (pLSA); - NS_DEBUG(*pLSA); - + NS_LOG_LOGIC (*pLSA); // Now, determine whether we need to build a NetworkLSA if (listOfDRInterfaces.size () > 0) @@ -687,7 +715,7 @@ GlobalRouter::DiscoverLSAs (void) pLSA->AddAttachedRouter (tempAddr); } m_LSAs.push_back (pLSA); - NS_DEBUG(*pLSA); + NS_LOG_LOGIC (*pLSA); } } @@ -729,7 +757,7 @@ GlobalRouter::FindDesignatedRouterForLink (Ptr node, uint32_t GlobalRouter::GetNumLSAs (void) const { - NS_DEBUG("GlobalRouter::GetNumLSAs ()"); + NS_LOG_FUNCTION; return m_LSAs.size (); } @@ -739,6 +767,7 @@ GlobalRouter::GetNumLSAs (void) const bool GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const { + NS_LOG_FUNCTION; NS_ASSERT_MSG(lsa.IsEmpty(), "GlobalRouter::GetLSA (): Must pass empty LSA"); // // All of the work was done in GetNumLSAs. All we have to do here is to @@ -768,7 +797,7 @@ GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const Ptr GlobalRouter::GetAdjacent(Ptr nd, Ptr ch) const { - + NS_LOG_FUNCTION; NS_ASSERT_MSG(ch->GetNDevices() == 2, "GlobalRouter::GetAdjacent (): Channel with other than two devices"); // @@ -804,6 +833,7 @@ GlobalRouter::GetAdjacent(Ptr nd, Ptr ch) const uint32_t GlobalRouter::FindIfIndexForDevice(Ptr node, Ptr nd) const { + NS_LOG_FUNCTION; Ptr ipv4 = node->QueryInterface (Ipv4::iid); NS_ASSERT_MSG(ipv4, "QI for interface failed"); for (uint32_t i = 0; i < ipv4->GetNInterfaces(); ++i ) diff --git a/src/routing/global-routing/global-router-interface.h b/src/routing/global-routing/global-router-interface.h index b6558eb20..cf3f94166 100644 --- a/src/routing/global-routing/global-router-interface.h +++ b/src/routing/global-routing/global-router-interface.h @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* + * Copyright 2007 University of Washington + * * 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; @@ -12,6 +14,9 @@ * 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 + * + * Authors: Craig Dowell (craigdo@ee.washington.edu) + * Tom Henderson (tomhend@u.washington.edu) */ #ifndef GLOBAL_ROUTER_INTERFACE_H diff --git a/src/routing/global-routing/waf b/src/routing/global-routing/waf new file mode 100755 index 000000000..4283ec141 --- /dev/null +++ b/src/routing/global-routing/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../../waf "$@" diff --git a/src/simulator/simulator.cc b/src/simulator/simulator.cc index 6ee0340fd..e00f548b5 100644 --- a/src/simulator/simulator.cc +++ b/src/simulator/simulator.cc @@ -762,7 +762,7 @@ SimulatorTests::cbaz5c (const int &, const int &, const int &, const int &, cons bool SimulatorTests::RunOneTest (void) { - bool ok = true; + bool result = true; m_a = true; m_b = false; m_c = true; @@ -772,26 +772,16 @@ SimulatorTests::RunOneTest (void) Simulator::Schedule (MicroSeconds (11), &SimulatorTests::B, this, 2); m_idC = Simulator::Schedule (MicroSeconds (12), &SimulatorTests::C, this, 3); - if (m_idC.IsExpired ()) - { - ok = false; - } - if (a.IsExpired ()) - { - ok = false; - } + NS_TEST_ASSERT (!m_idC.IsExpired ()); + NS_TEST_ASSERT (!a.IsExpired ()); Simulator::Cancel (a); - if (!a.IsExpired ()) - { - ok = false; - } + NS_TEST_ASSERT (a.IsExpired ()); Simulator::Run (); - - if (!m_a || !m_b || !m_c || !m_d) - { - ok = false; - } - return ok; + NS_TEST_ASSERT (m_a); + NS_TEST_ASSERT (m_b); + NS_TEST_ASSERT (m_c); + NS_TEST_ASSERT (m_d); + return result; } void SimulatorTests::RunTestsConst (void) const @@ -870,24 +860,25 @@ SimulatorTests::RunTestsConst (void) const bool SimulatorTests::RunTests (void) { - bool ok = true; + bool result = true; + Simulator::Destroy (); Simulator::SetLinkedList (); if (!RunOneTest ()) { - ok = false; + result = false; } Simulator::Destroy (); Simulator::SetBinaryHeap (); if (!RunOneTest ()) { - ok = false; + result = false; } Simulator::Destroy (); Simulator::SetStdMap (); if (!RunOneTest ()) { - ok = false; + result = false; } Simulator::Destroy (); @@ -1018,36 +1009,26 @@ SimulatorTests::RunTests (void) EventId nowId = Simulator::ScheduleNow (&foo0); m_destroyId = Simulator::ScheduleDestroy (&SimulatorTests::destroy, this); - if (m_destroyId.IsExpired ()) - { - ok = false; - } + NS_TEST_ASSERT (!m_destroyId.IsExpired ()); Simulator::Run (); m_destroy = false; Simulator::Destroy (); - if (!m_destroy) - { - ok = false; - } + NS_TEST_ASSERT (m_destroy); EventId anId = Simulator::ScheduleNow (&foo0); EventId anotherId = anId; - if (anId.IsExpired () || anotherId.IsExpired ()) - { - ok = false; - } + NS_TEST_ASSERT (!(anId.IsExpired () || anotherId.IsExpired ())); + Simulator::Remove (anId); - if (!anId.IsExpired () || !anotherId.IsExpired ()) - { - ok = false; - } + NS_TEST_ASSERT (anId.IsExpired ()); + NS_TEST_ASSERT (anotherId.IsExpired ()); Simulator::Run (); Simulator::Destroy (); - return ok; + return result; } SimulatorTests gSimulatorTests; diff --git a/src/simulator/waf b/src/simulator/waf new file mode 100755 index 000000000..3dcf598bc --- /dev/null +++ b/src/simulator/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff --git a/src/wscript b/src/wscript index 7e7642c6e..759bd3059 100644 --- a/src/wscript +++ b/src/wscript @@ -18,7 +18,9 @@ all_modules = ( 'internet-node', 'devices/point-to-point', 'devices/csma', - 'applications', + 'applications/onoff', + 'applications/packet-sink', + 'applications/udp-echo', 'routing/global-routing', 'mobility', 'devices/wifi', @@ -40,11 +42,9 @@ def configure(conf): conf.sub_config('simulator') blddir = os.path.abspath(os.path.join(conf.m_blddir, conf.env.variant())) - conf.env['NS3_MODULE_PATH'] = [os.path.join(blddir, 'src')] - for module in all_modules: - module_path = os.path.join(blddir, 'src', module) - if Params.g_options.enable_rpath: - conf.env.append_value('RPATH', '-Wl,-rpath=%s' % (module_path,)) + conf.env['NS3_MODULE_PATH'] = [os.path.join(blddir)] + if Params.g_options.enable_rpath: + conf.env.append_value('RPATH', '-Wl,-rpath=%s' % (os.path.join(blddir),)) ## Used to link the 'run-tests' program with all of ns-3 code conf.env['NS3_MODULES'] = ['ns3-' + module.split('/')[-1] for module in all_modules] @@ -65,12 +65,6 @@ def build(bld): bld.add_subdirs(list(all_modules)) - ## Create a single ns3 library containing all modules - lib = bld.create_obj('cpp', 'shlib') - lib.name = 'ns3' - lib.target = 'ns3' - lib.add_objects = list(bld.env_of_name('default')['NS3_MODULES']) - class Ns3Header(Object.genobj): """A set of NS-3 header files""" diff --git a/tutorial/hello-simulator.cc b/tutorial/hello-simulator.cc new file mode 100644 index 000000000..735d98130 --- /dev/null +++ b/tutorial/hello-simulator.cc @@ -0,0 +1,29 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include "ns3/log.h" + +NS_LOG_COMPONENT_DEFINE ("HelloSimulator"); + +using namespace ns3; + +int +main (int argc, char *argv[]) +{ + LogComponentEnable ("HelloSimulator", LOG_LEVEL_INFO); + + NS_LOG_INFO ("Hello Simulator"); +} diff --git a/tutorial/tutorial-1.cc b/tutorial/tutorial-1.cc new file mode 100644 index 000000000..972a753bb --- /dev/null +++ b/tutorial/tutorial-1.cc @@ -0,0 +1,81 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include "ns3/log.h" +#include "ns3/ptr.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/mac48-address.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/udp-echo-client.h" +#include "ns3/udp-echo-server.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" + +NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation"); + +using namespace ns3; + +int +main (int argc, char *argv[]) +{ + LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO); + + NS_LOG_INFO ("UDP Echo Simulation"); + + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + Ptr lan = + CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); + + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, + "08:00:2e:00:00:00"); + + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, + "08:00:2e:00:00:01"); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, + "08:00:2e:00:00:02"); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, + "08:00:2e:00:00:03"); + + CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0"); + + uint16_t port = 7; + + Ptr client = Create (n0, "10.1.1.2", port, + 1, Seconds(1.), 1024); + + Ptr server = Create (n1, port); + + server->Start(Seconds(1.)); + client->Start(Seconds(2.)); + + server->Stop (Seconds(10.)); + client->Stop (Seconds(10.)); + + Simulator::Run (); + Simulator::Destroy (); +} diff --git a/tutorial/tutorial-2.cc b/tutorial/tutorial-2.cc new file mode 100644 index 000000000..e8f9f07cb --- /dev/null +++ b/tutorial/tutorial-2.cc @@ -0,0 +1,86 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include "ns3/log.h" +#include "ns3/ptr.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/mac48-address.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/udp-echo-client.h" +#include "ns3/udp-echo-server.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/ascii-trace.h" + +NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation"); + +using namespace ns3; + +int +main (int argc, char *argv[]) +{ + LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO); + + NS_LOG_INFO ("UDP Echo Simulation"); + + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + Ptr lan = + CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); + + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, + "08:00:2e:00:00:00"); + + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, + "08:00:2e:00:00:01"); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, + "08:00:2e:00:00:02"); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, + "08:00:2e:00:00:03"); + + CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0"); + + uint16_t port = 7; + + Ptr client = Create (n0, "10.1.1.2", port, + 1, Seconds(1.), 1024); + + Ptr server = Create (n1, port); + + server->Start(Seconds(1.)); + client->Start(Seconds(2.)); + + server->Stop (Seconds(10.)); + client->Stop (Seconds(10.)); + + AsciiTrace asciitrace ("tutorial.tr"); + asciitrace.TraceAllQueues (); + asciitrace.TraceAllNetDeviceRx (); + + Simulator::Run (); + Simulator::Destroy (); +} diff --git a/tutorial/tutorial-3.cc b/tutorial/tutorial-3.cc new file mode 100644 index 000000000..1e68275ac --- /dev/null +++ b/tutorial/tutorial-3.cc @@ -0,0 +1,90 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include "ns3/log.h" +#include "ns3/ptr.h" +#include "ns3/internet-node.h" +#include "ns3/csma-channel.h" +#include "ns3/mac48-address.h" +#include "ns3/csma-net-device.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/udp-echo-client.h" +#include "ns3/udp-echo-server.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/ascii-trace.h" +#include "ns3/pcap-trace.h" + +NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation"); + +using namespace ns3; + +int +main (int argc, char *argv[]) +{ + LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO); + + NS_LOG_INFO ("UDP Echo Simulation"); + + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + Ptr lan = + CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); + + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, + "08:00:2e:00:00:00"); + + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, + "08:00:2e:00:00:01"); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, + "08:00:2e:00:00:02"); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, + "08:00:2e:00:00:03"); + + CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0"); + + uint16_t port = 7; + + Ptr client = Create (n0, "10.1.1.2", port, + 1, Seconds(1.), 1024); + + Ptr server = Create (n1, port); + + server->Start(Seconds(1.)); + client->Start(Seconds(2.)); + + server->Stop (Seconds(10.)); + client->Stop (Seconds(10.)); + + AsciiTrace asciitrace ("tutorial.tr"); + asciitrace.TraceAllQueues (); + asciitrace.TraceAllNetDeviceRx (); + + PcapTrace pcaptrace ("tutorial.pcap"); + pcaptrace.TraceAllIp (); + + Simulator::Run (); + Simulator::Destroy (); +} diff --git a/tutorial/tutorial-4.cc b/tutorial/tutorial-4.cc new file mode 100644 index 000000000..173aa202c --- /dev/null +++ b/tutorial/tutorial-4.cc @@ -0,0 +1,137 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include "ns3/log.h" +#include "ns3/ptr.h" +#include "ns3/internet-node.h" +#include "ns3/point-to-point-channel.h" +#include "ns3/csma-channel.h" +#include "ns3/mac48-address.h" +#include "ns3/point-to-point-net-device.h" +#include "ns3/csma-net-device.h" +#include "ns3/point-to-point-topology.h" +#include "ns3/csma-topology.h" +#include "ns3/csma-ipv4-topology.h" +#include "ns3/udp-echo-client.h" +#include "ns3/udp-echo-server.h" +#include "ns3/simulator.h" +#include "ns3/nstime.h" +#include "ns3/ascii-trace.h" +#include "ns3/pcap-trace.h" +#include "ns3/global-route-manager.h" + +NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation"); + +using namespace ns3; + +// Network topology +// +// point to point +// +--------------+ +// | | +// n0 n1 n2 n3 n4 n5 n6 n7 +// | | | | | | | | +// ================ ================ +// lan0 lan1 +// +int +main (int argc, char *argv[]) +{ + LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO); + + NS_LOG_INFO ("UDP Echo Simulation"); + + Ptr n0 = Create (); + Ptr n1 = Create (); + Ptr n2 = Create (); + Ptr n3 = Create (); + + Ptr n4 = Create (); + Ptr n5 = Create (); + Ptr n6 = Create (); + Ptr n7 = Create (); + + Ptr lan1 = + CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); + + uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan1, + "08:00:2e:00:00:00"); + + uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan1, + "08:00:2e:00:00:01"); + + uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, + "08:00:2e:00:00:02"); + + uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, + "08:00:2e:00:00:03"); + + CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0"); + + Ptr lan2 = + CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2)); + + uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan2, + "08:00:2e:00:00:04"); + + uint32_t nd5 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n5, lan2, + "08:00:2e:00:00:05"); + + uint32_t nd6 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n6, lan2, + "08:00:2e:00:00:06"); + + uint32_t nd7 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n7, lan2, + "08:00:2e:00:00:07"); + + CsmaIpv4Topology::AddIpv4Address (n4, nd4, "10.1.2.1", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n5, nd5, "10.1.2.2", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n6, nd6, "10.1.2.3", "255.255.255.0"); + CsmaIpv4Topology::AddIpv4Address (n7, nd7, "10.1.2.4", "255.255.255.0"); + + Ptr link = PointToPointTopology::AddPointToPointLink ( + n3, n4, DataRate (500000), MilliSeconds (20)); + + PointToPointTopology::AddIpv4Addresses (link, n3, "10.1.3.1", + n4, "10.1.3.2"); + + uint16_t port = 7; + + Ptr client = Create (n0, "10.1.2.4", port, + 1, Seconds(1.), 1024); + + Ptr server = Create (n7, port); + + server->Start(Seconds(1.)); + client->Start(Seconds(2.)); + + server->Stop (Seconds(10.)); + client->Stop (Seconds(10.)); + + AsciiTrace asciitrace ("tutorial-4.tr"); + asciitrace.TraceAllQueues (); + asciitrace.TraceAllNetDeviceRx (); + + PcapTrace pcaptrace ("tutorial-4.pcap"); + pcaptrace.TraceAllIp (); + + GlobalRouteManager::PopulateRoutingTables (); + + Simulator::Run (); + Simulator::Destroy (); +} diff --git a/tutorial/waf b/tutorial/waf new file mode 100755 index 000000000..191b7dbb2 --- /dev/null +++ b/tutorial/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../waf "$@" diff --git a/tutorial/wscript b/tutorial/wscript new file mode 100644 index 000000000..965b8196e --- /dev/null +++ b/tutorial/wscript @@ -0,0 +1,22 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' + + obj = bld.create_ns3_program('tutorial-1', + ['core']) + obj.source = 'tutorial-1.cc' + + obj = bld.create_ns3_program('tutorial-2', + ['core']) + obj.source = 'tutorial-2.cc' + + obj = bld.create_ns3_program('tutorial-3', + ['core']) + obj.source = 'tutorial-3.cc' + + obj = bld.create_ns3_program('tutorial-4', + ['core']) + obj.source = 'tutorial-4.cc' diff --git a/tutorial/wscript-0 b/tutorial/wscript-0 new file mode 100644 index 000000000..abd2df7b9 --- /dev/null +++ b/tutorial/wscript-0 @@ -0,0 +1,6 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' diff --git a/tutorial/wscript-1 b/tutorial/wscript-1 new file mode 100644 index 000000000..724d86fb7 --- /dev/null +++ b/tutorial/wscript-1 @@ -0,0 +1,10 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' + + obj = bld.create_ns3_program('tutorial-1', + ['core']) + obj.source = 'tutorial-1.cc' diff --git a/tutorial/wscript-2 b/tutorial/wscript-2 new file mode 100644 index 000000000..64ddd44dd --- /dev/null +++ b/tutorial/wscript-2 @@ -0,0 +1,14 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' + + obj = bld.create_ns3_program('tutorial-1', + ['core']) + obj.source = 'tutorial-1.cc' + + obj = bld.create_ns3_program('tutorial-2', + ['core']) + obj.source = 'tutorial-2.cc' diff --git a/tutorial/wscript-3 b/tutorial/wscript-3 new file mode 100644 index 000000000..1021c3aa9 --- /dev/null +++ b/tutorial/wscript-3 @@ -0,0 +1,18 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' + + obj = bld.create_ns3_program('tutorial-1', + ['core']) + obj.source = 'tutorial-1.cc' + + obj = bld.create_ns3_program('tutorial-2', + ['core']) + obj.source = 'tutorial-2.cc' + + obj = bld.create_ns3_program('tutorial-3', + ['core']) + obj.source = 'tutorial-3.cc' diff --git a/tutorial/wscript-4 b/tutorial/wscript-4 new file mode 100644 index 000000000..965b8196e --- /dev/null +++ b/tutorial/wscript-4 @@ -0,0 +1,22 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('hello-simulator', + ['core']) + obj.source = 'hello-simulator.cc' + + obj = bld.create_ns3_program('tutorial-1', + ['core']) + obj.source = 'tutorial-1.cc' + + obj = bld.create_ns3_program('tutorial-2', + ['core']) + obj.source = 'tutorial-2.cc' + + obj = bld.create_ns3_program('tutorial-3', + ['core']) + obj.source = 'tutorial-3.cc' + + obj = bld.create_ns3_program('tutorial-4', + ['core']) + obj.source = 'tutorial-4.cc' diff --git a/utils/bench-packets.cc b/utils/bench-packets.cc index a6986d272..e16c17b02 100644 --- a/utils/bench-packets.cc +++ b/utils/bench-packets.cc @@ -32,12 +32,15 @@ class BenchHeader : public Header public: BenchHeader (); bool IsOk (void) const; + + static uint32_t GetUid (void); + + static std::string GetName (void); + void Print (std::ostream &os) const; + uint32_t GetSerializedSize (void) const; + void Serialize (Buffer::Iterator start) const; + uint32_t Deserialize (Buffer::Iterator start); private: - virtual std::string DoGetName (void) const; - virtual void PrintTo (std::ostream &os) const; - virtual uint32_t GetSerializedSize (void) const; - virtual void SerializeTo (Buffer::Iterator start) const; - virtual uint32_t DeserializeFrom (Buffer::Iterator start); bool m_ok; }; @@ -53,18 +56,26 @@ BenchHeader::IsOk (void) const return m_ok; } +template +uint32_t +BenchHeader::GetUid (void) +{ + static uint32_t uid = AllocateUid > (GetName ()); + return uid; +} + template std::string -BenchHeader::DoGetName (void) const +BenchHeader::GetName (void) { std::ostringstream oss; - oss << N; + oss << "BenchHeader" << N; return oss.str (); } template void -BenchHeader::PrintTo (std::ostream &os) const +BenchHeader::Print (std::ostream &os) const { NS_ASSERT (false); } @@ -76,13 +87,13 @@ BenchHeader::GetSerializedSize (void) const } template void -BenchHeader::SerializeTo (Buffer::Iterator start) const +BenchHeader::Serialize (Buffer::Iterator start) const { start.WriteU8 (N, N); } template uint32_t -BenchHeader::DeserializeFrom (Buffer::Iterator start) +BenchHeader::Deserialize (Buffer::Iterator start) { m_ok = true; for (int i = 0; i < N; i++) @@ -156,6 +167,7 @@ benchPtrC (uint32_t n) } } +#if 0 static void benchPrint (uint32_t n) { @@ -171,6 +183,7 @@ benchPrint (uint32_t n) p.Print (std::cerr, printer); } } +#endif static void @@ -205,7 +218,7 @@ int main (int argc, char *argv[]) runBench (&benchPtrC, n, "c"); Packet::EnableMetadata (); - runBench (&benchPrint, n, "print"); + //runBench (&benchPrint, n, "print"); PacketMetadata::SetOptOne (false); runBench (&benchPtrA, n, "meta-a"); runBench (&benchPtrB, n, "meta-b"); diff --git a/utils/print-trace-sources.cc b/utils/print-trace-sources.cc new file mode 100644 index 000000000..af7cfb755 --- /dev/null +++ b/utils/print-trace-sources.cc @@ -0,0 +1,100 @@ +#include "ns3/internet-node.h" +#include "ns3/ptr.h" +#include "ns3/trace-resolver.h" +#include "ns3/node-list.h" +#include "ns3/point-to-point-net-device.h" +#include "ns3/csma-net-device.h" +#include "ns3/queue.h" +#include "ns3/mobility-model-notifier.h" + +using namespace ns3; + +void +PrintSimpleText (const TraceResolver::SourceCollection *sources, std::ostream &os) +{ + for (TraceResolver::SourceCollection::Iterator i = sources->Begin (); i != sources->End (); i++) + { + os << "source=" << i->path << std::endl; + os << "TraceContext=["; + i->context.PrintAvailable (os, ","); + os << "]" << std::endl; + os << "help=\"" << i->doc.GetHelp () << "\"" << std::endl; + os << "void TraceSinkCallback (const TraceContext &"; + for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++) + { + os << ", " << k->first; + } + os << ")" << std::endl; + os << "argument 1 -- the trace context associated to the connected trace source." << std::endl; + uint32_t k = 2; + for (TraceDoc::Iterator j = i->doc.ArgsBegin (); j != i->doc.ArgsEnd (); j++) + { + os << "argument " << k << " -- " << j->second << "." << std::endl; + k++; + } + os << std::endl; + } +} +void +PrintDoxygenText (const TraceResolver::SourceCollection *sources, std::ostream &os) +{ + uint32_t z = 0; + for (TraceResolver::SourceCollection::Iterator i = sources->Begin (); i != sources->End (); i++) + { + os << "///" << std::endl; + os << "/// \\ingroup TraceSourceList" << std::endl; + os << "/// \\brief " << i->doc.GetHelp () << std::endl; + os << "/// \\param arg1 the trace context associated to the connected trace source." << std::endl; + uint32_t j = 2; + for (TraceDoc::Iterator l = i->doc.ArgsBegin (); l != i->doc.ArgsEnd (); l++) + { + os << "/// \\param arg" << j << " " << l->second << "." << std::endl; + j++; + } + os << "///" << std::endl; + os << "///" << std::endl; + os << "/// The path to this trace source is: " << i->path << "." << std::endl; + os << "///" << std::endl; + if (i->context.Begin ().IsLast ()) + { + os << "/// No data can be extracted from \\p arg1 with ns3::TraceContext::GetElement." << std::endl; + } + else + { + os << "/// The following classes can be extracted from \\p arg1 with " << std::endl; + os << "/// ns3::TraceContext::GetElement:" << std::endl; + for (TraceContext::Iterator m = i->context.Begin (); !m.IsLast (); m.Next ()) + { + os << "/// - " << m.Get () << std::endl; + } + } + os << "void TraceSinkCallback" << z << " (const TraceContext & arg1" ; + j = 2; + for (TraceDoc::Iterator k = i->doc.ArgsBegin (); k != i->doc.ArgsEnd (); k++) + { + os << ", " << k->first << " arg" << j; + j++; + } + os << ");" << std::endl; + os << std::endl; + z++; + } +} + + +int main (int argc, char *argv[]) +{ + Ptr node = Create (); + node->AddInterface (Create ()); + + Ptr p2p = Create (node); + p2p->AddQueue (Queue::CreateDefault ()); + Ptr csma = Create (node); + csma->AddQueue (Queue::CreateDefault ()); + + TraceResolver::SourceCollection collection; + NodeList::GetTraceResolver ()->CollectSources ("", TraceContext (), &collection); + PrintDoxygenText (&collection, std::cout); + + return 0; +} diff --git a/utils/run-tests.cc b/utils/run-tests.cc index 774e88c1f..f99f560c3 100644 --- a/utils/run-tests.cc +++ b/utils/run-tests.cc @@ -20,10 +20,13 @@ */ #include "ns3/test.h" +#include "ns3/packet-metadata.h" + int main (int argc, char *argv[]) { #ifdef RUN_SELF_TESTS + ns3::PacketMetadata::Enable (); ns3::TestManager::EnableVerbose (); bool success = ns3::TestManager::RunTests (); if (!success) diff --git a/utils/waf b/utils/waf new file mode 100755 index 000000000..191b7dbb2 --- /dev/null +++ b/utils/waf @@ -0,0 +1 @@ +exec "`dirname "$0"`"/../waf "$@" diff --git a/utils/wscript b/utils/wscript index d64d46dc5..15fbfa512 100644 --- a/utils/wscript +++ b/utils/wscript @@ -14,5 +14,12 @@ def build(bld): obj = bld.create_ns3_program('bench-simulator', ['simulator']) obj.source = 'bench-simulator.cc' + obj = bld.create_ns3_program('bench-packets', ['common']) + obj.source = 'bench-packets.cc' + obj = bld.create_ns3_program('replay-simulation', ['simulator']) obj.source = 'replay-simulation.cc' + + obj = bld.create_ns3_program('print-trace-sources', + ['internet-node', 'csma-cd', 'point-to-point']) + obj.source = 'print-trace-sources.cc' diff --git a/waf b/waf index d4f80d72a..ab9fa0776 100755 --- a/waf +++ b/waf @@ -1,6 +1,34 @@ #! /usr/bin/env python # encoding: utf-8 -# Thomas Nagy, 2005 (ita) +# Thomas Nagy, 2005, 2006, 2007 (ita) + +""" +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +""" import os, sys if 'PSYCOWAF' in os.environ: @@ -10,8 +38,8 @@ if 'PSYCOWAF' in os.environ: except: pass -VERSION="1.1.1" -REVISION="1272724989" +VERSION="1.2.0" +REVISION="1894439586" INSTALL=sys.platform=='win32' and 'c:/temp' or '/usr/local' cwd = os.getcwd() @@ -274,13 +302,11 @@ else: Utils.set_main_module(os.path.join(candidate, 'wscript')) if build_dir_override: - try: + d = getattr(Utils.g_module, 'blddir', None) + if d: # test if user has set the blddir in wscript. - blddir = Utils.g_module.blddir - msg = 'Overriding build directory %s with %s' % (blddir, build_dir_override) + msg = 'Overriding build directory %s with %s' % (d, build_dir_override) Params.niceprint(msg, 'WARNING', 'waf') - except: - pass Utils.g_module.blddir = build_dir_override # fetch the custom command-line options recursively and in a procedural way @@ -291,40 +317,44 @@ opt_obj.parse_args() # use the parser results if Params.g_commands['dist']: # try to use the user-defined dist function first, fallback to the waf scheme - try: - Utils.g_module.dist() - sys.exit(0) - except AttributeError: - pass - try: appname = Utils.g_module.APPNAME - except: appname = 'noname' + fun = getattr(Utils.g_module, 'dist', None) + if fun: fun(); sys.exit(0) - try: - get_version = Utils.g_module.get_version - except AttributeError: - try: - version = Utils.g_module.VERSION - except AttributeError: - version = '1.0' - else: - version = get_version() + appname = getattr(Utils.g_module, 'APPNAME', 'noname') + + get_version = getattr(Utils.g_module, 'get_version', None) + if get_version: version = get_version() + else: version = getattr(Utils.g_module, 'VERSION', None) + if not version: version = '1.0' from Scripting import Dist Dist(appname, version) sys.exit(0) elif Params.g_commands['distclean']: # try to use the user-defined distclean first, fallback to the waf scheme - try: - Utils.g_module.distclean() - sys.exit(0) - except AttributeError: - pass + fun = getattr(Utils.g_module, 'distclean', None) + if fun: fun(); sys.exit(0) from Scripting import DistClean DistClean() sys.exit(0) +elif Params.g_commands['distcheck']: + # try to use the user-defined dist function first, fallback to the waf scheme + fun = getattr(Utils.g_module, 'dist', None) + if fun: fun(); sys.exit(0) -try: Utils.g_module.init() -except AttributeError: pass + appname = getattr(Utils.g_module, 'APPNAME', 'noname') + + get_version = getattr(Utils.g_module, 'get_version', None) + if get_version: version = get_version() + else: version = getattr(Utils.g_module, 'VERSION', None) + if not version: version = '1.0' + + from Scripting import DistCheck + DistCheck(appname, version) + sys.exit(0) + +fun=getattr(Utils.g_module, 'init', None) +if fun: fun() import Scripting try: Scripting.Main() @@ -333,6 +363,7 @@ except KeyboardInterrupt: Params.fatal('build interrupted') #prof=hotshot.Profile("/tmp/proftest.txt") #prof.runcall(Scripting.Main) #prof.close() + # ===>BEGIN WOOF<=== -#6<\%_0gSqh;d"&i4hUq"'EA+4s8;Tjs8W-!s8W-!s8W+l!!!?/+s8Ri#QQOmTF;*7jW*^\\1'ZCz!!!!q-n#&q!!"DJF2"&p-aW8SQY$K"!EWV\h!&gY=W_6RV_sr\722cZ@k5kdqqg'$4*["='$#2".3/jH9s\UR>BX?ohY0*=H[;!kmGlsVII%EnT7)!(/U>#5gO6P<#sP`m!Um]ST#;0S]:$Hk8J3V550%G+n!@)?&(e/H?7rG4)HopHecsJV&*NLld/Hf'i_/tW]OXF=:('"e7,sVH,!!!'c"B6'9h=&$=^$;/b<7!LN[75n*Zqu06hetOCfNT/9Dgh)`hX=R2Efmj*fjoK.pmJmh!ZlhGA_fKbKkV"UYb%$W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&5d/6PjV.TqPQR0`J[E$V<,6FP$Ad%]ai7?IW7HL#P;*tf^QnEO5Q$T>ebcXfahfg?<<)L"\'Dom>jL5JEpr[2[9B]8\a)mY_dUE0&Bn4*3%gs36G'"HohHeg8;U+hQZ&H"_=%"Cde6i2Ki#QMcuO\QT93P\61!! # ===>END WOOF<=== diff --git a/wscript b/wscript index 48b731729..a02db75da 100644 --- a/wscript +++ b/wscript @@ -20,7 +20,7 @@ APPNAME = 'ns' srcdir = '.' blddir = 'build' -def dist_hook(srcdir, blddir): +def dist_hook(): shutil.rmtree("doc/html", True) shutil.rmtree("doc/latex", True) @@ -37,7 +37,7 @@ def set_options(opt): opt.add_option('-d', '--debug-level', action='callback', - type="string", dest='debug_level', default='debug', + type="string", dest='debug_level', default='ultradebug', help=('Specify the debug level, does nothing if CFLAGS is set' ' in the environment. [Allowed Values: debug, optimized].' ' WARNING: this option only has effect ' @@ -85,8 +85,7 @@ def set_options(opt): def configure(conf): - if not conf.check_tool('compiler_cxx'): - Params.fatal("No suitable compiler found") + conf.check_tool('compiler_cxx') # create the second environment, set the variant and set its name variant_env = conf.env.copy() @@ -96,6 +95,8 @@ def configure(conf): else: variant_name = debug_level + variant_env['INCLUDEDIR'] = os.path.join(variant_env['PREFIX'], 'include') + if Params.g_options.enable_gcov: variant_name += '-gcov' variant_env.append_value('CCFLAGS', '-fprofile-arcs') @@ -114,11 +115,12 @@ def configure(conf): if (os.path.basename(conf.env['CXX']).startswith("g++") and 'CXXFLAGS' not in os.environ): - variant_env.append_value('CXXFLAGS', ['-Wall', '-Werror']) + variant_env.append_value('CXXFLAGS', ['-Werror']) if 'debug' in Params.g_options.debug_level.lower(): variant_env.append_value('CXXDEFINES', 'NS3_DEBUG_ENABLE') variant_env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE') + variant_env.append_value('CXXDEFINES', 'NS3_LOG_ENABLE') ## In optimized builds we still want debugging symbols, e.g. for ## profiling, and at least partially usable stack traces. @@ -129,6 +131,13 @@ def configure(conf): if flag.startswith('-g'): variant_env.append_value('CXXFLAGS', flag) + ## in optimized builds, replace -O2 with -O3 + if 'optimized' in Params.g_options.debug_level.lower(): + lst = variant_env['CXXFLAGS'] + for i, flag in enumerate(lst): + if flag == '-O2': + lst[i] = '-O3' + if sys.platform == 'win32': if os.path.basename(conf.env['CXX']).startswith("g++"): variant_env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc") @@ -145,6 +154,9 @@ def create_ns3_program(bld, name, dependencies=('simulator',)): def build(bld): + print "Entering directory `%s/build'" % Params.g_build.m_curdirnode.abspath() + Params.g_cwd_launch = Params.g_build.m_curdirnode.abspath() + bld.create_ns3_program = types.MethodType(create_ns3_program, bld) variant_name = bld.env_of_name('default')['NS3_ACTIVE_VARIANT'] @@ -163,8 +175,13 @@ def build(bld): # process subfolders from here bld.add_subdirs('src') - bld.add_subdirs('samples utils examples') + bld.add_subdirs('samples utils examples tutorial') + ## Create a single ns3 library containing all modules + lib = bld.create_obj('cpp', 'shlib') + lib.name = 'ns3' + lib.target = 'ns3' + lib.add_objects = list(bld.env_of_name('default')['NS3_MODULES']) def shutdown(): #import UnitTest