From 93205ebccf8e93417c4fd2a5d6abc2c451755338 Mon Sep 17 00:00:00 2001 From: Josh Pelkey Date: Sun, 27 Feb 2011 01:00:17 -0500 Subject: [PATCH] modularize nix and aodv, thanks lalith --- examples/routing/wscript | 12 ------- .../topology-read/topology-example-sim.cc | 1 + src/helper/wscript | 4 --- src/routing/aodv/{ => doc}/aodv.h | 0 .../routing/aodv/examples}/aodv.cc | 1 - src/routing/aodv/examples/wscript | 6 ++++ src/{ => routing/aodv}/helper/aodv-helper.cc | 0 src/{ => routing/aodv}/helper/aodv-helper.h | 0 src/routing/aodv/{ => model}/aodv-dpd.cc | 0 src/routing/aodv/{ => model}/aodv-dpd.h | 0 src/routing/aodv/{ => model}/aodv-id-cache.cc | 0 src/routing/aodv/{ => model}/aodv-id-cache.h | 0 src/routing/aodv/{ => model}/aodv-neighbor.cc | 0 src/routing/aodv/{ => model}/aodv-neighbor.h | 0 src/routing/aodv/{ => model}/aodv-packet.cc | 0 src/routing/aodv/{ => model}/aodv-packet.h | 0 .../aodv/{ => model}/aodv-routing-protocol.cc | 0 .../aodv/{ => model}/aodv-routing-protocol.h | 0 src/routing/aodv/{ => model}/aodv-rqueue.cc | 0 src/routing/aodv/{ => model}/aodv-rqueue.h | 0 src/routing/aodv/{ => model}/aodv-rtable.cc | 0 src/routing/aodv/{ => model}/aodv-rtable.h | 0 .../aodv/{ => test}/aodv-test-suite.cc | 8 ++--- src/routing/aodv/wscript | 34 +++++++++++-------- .../{ => doc}/nix-vector-routing.h | 0 .../examples}/nix-simple.cc | 2 +- .../examples}/nms-p2p-nix.cc | 1 + .../nix-vector-routing/examples/wscript | 10 ++++++ .../helper/ipv4-nix-vector-helper.cc | 0 .../helper/ipv4-nix-vector-helper.h | 0 .../{ => model}/ipv4-nix-vector-routing.cc | 0 .../{ => model}/ipv4-nix-vector-routing.h | 0 src/routing/nix-vector-routing/wscript | 8 +++-- test.py | 6 ++-- 34 files changed, 51 insertions(+), 42 deletions(-) rename src/routing/aodv/{ => doc}/aodv.h (100%) rename {examples/routing => src/routing/aodv/examples}/aodv.cc (99%) create mode 100644 src/routing/aodv/examples/wscript rename src/{ => routing/aodv}/helper/aodv-helper.cc (100%) rename src/{ => routing/aodv}/helper/aodv-helper.h (100%) rename src/routing/aodv/{ => model}/aodv-dpd.cc (100%) rename src/routing/aodv/{ => model}/aodv-dpd.h (100%) rename src/routing/aodv/{ => model}/aodv-id-cache.cc (100%) rename src/routing/aodv/{ => model}/aodv-id-cache.h (100%) rename src/routing/aodv/{ => model}/aodv-neighbor.cc (100%) rename src/routing/aodv/{ => model}/aodv-neighbor.h (100%) rename src/routing/aodv/{ => model}/aodv-packet.cc (100%) rename src/routing/aodv/{ => model}/aodv-packet.h (100%) rename src/routing/aodv/{ => model}/aodv-routing-protocol.cc (100%) rename src/routing/aodv/{ => model}/aodv-routing-protocol.h (100%) rename src/routing/aodv/{ => model}/aodv-rqueue.cc (100%) rename src/routing/aodv/{ => model}/aodv-rqueue.h (100%) rename src/routing/aodv/{ => model}/aodv-rtable.cc (100%) rename src/routing/aodv/{ => model}/aodv-rtable.h (100%) rename src/routing/aodv/{ => test}/aodv-test-suite.cc (99%) rename src/routing/nix-vector-routing/{ => doc}/nix-vector-routing.h (100%) rename {examples/routing => src/routing/nix-vector-routing/examples}/nix-simple.cc (98%) rename {examples/routing => src/routing/nix-vector-routing/examples}/nms-p2p-nix.cc (99%) create mode 100644 src/routing/nix-vector-routing/examples/wscript rename src/{ => routing/nix-vector-routing}/helper/ipv4-nix-vector-helper.cc (100%) rename src/{ => routing/nix-vector-routing}/helper/ipv4-nix-vector-helper.h (100%) rename src/routing/nix-vector-routing/{ => model}/ipv4-nix-vector-routing.cc (100%) rename src/routing/nix-vector-routing/{ => model}/ipv4-nix-vector-routing.h (100%) diff --git a/examples/routing/wscript b/examples/routing/wscript index d75502da7..192089bf7 100644 --- a/examples/routing/wscript +++ b/examples/routing/wscript @@ -29,18 +29,6 @@ def build(bld): ['point-to-point', 'internet', 'csma']) obj.source = 'mixed-global-routing.cc' - obj = bld.create_ns3_program('nix-simple', - ['point-to-point', 'internet', 'nix-vector-routing']) - obj.source = 'nix-simple.cc' - - obj = bld.create_ns3_program('nms-p2p-nix', - ['point-to-point', 'internet', 'nix-vector-routing']) - obj.source = 'nms-p2p-nix.cc' - obj = bld.create_ns3_program('simple-routing-ping6', ['csma', 'internet']) obj.source = 'simple-routing-ping6.cc' - - obj = bld.create_ns3_program('aodv', - ['wifi', 'internet', 'aodv']) - obj.source = 'aodv.cc' diff --git a/examples/topology-read/topology-example-sim.cc b/examples/topology-read/topology-example-sim.cc index afc281db0..01d4312d6 100644 --- a/examples/topology-read/topology-example-sim.cc +++ b/examples/topology-read/topology-example-sim.cc @@ -32,6 +32,7 @@ #include "ns3/core-module.h" #include "ns3/ipv4-static-routing-helper.h" #include "ns3/ipv4-list-routing-helper.h" +#include "ns3/ipv4-nix-vector-helper.h" #include "ns3/topology-read-module.h" #include diff --git a/src/helper/wscript b/src/helper/wscript index 378d58d44..e06c335d1 100644 --- a/src/helper/wscript +++ b/src/helper/wscript @@ -13,8 +13,6 @@ def build(bld): 'v4ping-helper.cc', 'nqos-wifi-mac-helper.cc', 'qos-wifi-mac-helper.cc', - 'ipv4-nix-vector-helper.cc', - 'aodv-helper.cc', 'mesh-helper.cc', 'dot11s-installer.cc', 'flame-installer.cc', @@ -45,8 +43,6 @@ def build(bld): 'v4ping-helper.h', 'nqos-wifi-mac-helper.h', 'qos-wifi-mac-helper.h', - 'ipv4-nix-vector-helper.h', - 'aodv-helper.h', 'mesh-helper.h', 'mesh-stack-installer.h', 'dot11s-installer.h', diff --git a/src/routing/aodv/aodv.h b/src/routing/aodv/doc/aodv.h similarity index 100% rename from src/routing/aodv/aodv.h rename to src/routing/aodv/doc/aodv.h diff --git a/examples/routing/aodv.cc b/src/routing/aodv/examples/aodv.cc similarity index 99% rename from examples/routing/aodv.cc rename to src/routing/aodv/examples/aodv.cc index 16688b6f9..134652df5 100644 --- a/examples/routing/aodv.cc +++ b/src/routing/aodv/examples/aodv.cc @@ -25,7 +25,6 @@ #include "ns3/network-module.h" #include "ns3/helper-module.h" #include "ns3/mobility-module.h" -#include "ns3/contrib-module.h" #include "ns3/wifi-module.h" #include "ns3/v4ping-helper.h" #include diff --git a/src/routing/aodv/examples/wscript b/src/routing/aodv/examples/wscript new file mode 100644 index 000000000..257423848 --- /dev/null +++ b/src/routing/aodv/examples/wscript @@ -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('aodv', + ['wifi', 'internet', 'aodv']) + obj.source = 'aodv.cc' diff --git a/src/helper/aodv-helper.cc b/src/routing/aodv/helper/aodv-helper.cc similarity index 100% rename from src/helper/aodv-helper.cc rename to src/routing/aodv/helper/aodv-helper.cc diff --git a/src/helper/aodv-helper.h b/src/routing/aodv/helper/aodv-helper.h similarity index 100% rename from src/helper/aodv-helper.h rename to src/routing/aodv/helper/aodv-helper.h diff --git a/src/routing/aodv/aodv-dpd.cc b/src/routing/aodv/model/aodv-dpd.cc similarity index 100% rename from src/routing/aodv/aodv-dpd.cc rename to src/routing/aodv/model/aodv-dpd.cc diff --git a/src/routing/aodv/aodv-dpd.h b/src/routing/aodv/model/aodv-dpd.h similarity index 100% rename from src/routing/aodv/aodv-dpd.h rename to src/routing/aodv/model/aodv-dpd.h diff --git a/src/routing/aodv/aodv-id-cache.cc b/src/routing/aodv/model/aodv-id-cache.cc similarity index 100% rename from src/routing/aodv/aodv-id-cache.cc rename to src/routing/aodv/model/aodv-id-cache.cc diff --git a/src/routing/aodv/aodv-id-cache.h b/src/routing/aodv/model/aodv-id-cache.h similarity index 100% rename from src/routing/aodv/aodv-id-cache.h rename to src/routing/aodv/model/aodv-id-cache.h diff --git a/src/routing/aodv/aodv-neighbor.cc b/src/routing/aodv/model/aodv-neighbor.cc similarity index 100% rename from src/routing/aodv/aodv-neighbor.cc rename to src/routing/aodv/model/aodv-neighbor.cc diff --git a/src/routing/aodv/aodv-neighbor.h b/src/routing/aodv/model/aodv-neighbor.h similarity index 100% rename from src/routing/aodv/aodv-neighbor.h rename to src/routing/aodv/model/aodv-neighbor.h diff --git a/src/routing/aodv/aodv-packet.cc b/src/routing/aodv/model/aodv-packet.cc similarity index 100% rename from src/routing/aodv/aodv-packet.cc rename to src/routing/aodv/model/aodv-packet.cc diff --git a/src/routing/aodv/aodv-packet.h b/src/routing/aodv/model/aodv-packet.h similarity index 100% rename from src/routing/aodv/aodv-packet.h rename to src/routing/aodv/model/aodv-packet.h diff --git a/src/routing/aodv/aodv-routing-protocol.cc b/src/routing/aodv/model/aodv-routing-protocol.cc similarity index 100% rename from src/routing/aodv/aodv-routing-protocol.cc rename to src/routing/aodv/model/aodv-routing-protocol.cc diff --git a/src/routing/aodv/aodv-routing-protocol.h b/src/routing/aodv/model/aodv-routing-protocol.h similarity index 100% rename from src/routing/aodv/aodv-routing-protocol.h rename to src/routing/aodv/model/aodv-routing-protocol.h diff --git a/src/routing/aodv/aodv-rqueue.cc b/src/routing/aodv/model/aodv-rqueue.cc similarity index 100% rename from src/routing/aodv/aodv-rqueue.cc rename to src/routing/aodv/model/aodv-rqueue.cc diff --git a/src/routing/aodv/aodv-rqueue.h b/src/routing/aodv/model/aodv-rqueue.h similarity index 100% rename from src/routing/aodv/aodv-rqueue.h rename to src/routing/aodv/model/aodv-rqueue.h diff --git a/src/routing/aodv/aodv-rtable.cc b/src/routing/aodv/model/aodv-rtable.cc similarity index 100% rename from src/routing/aodv/aodv-rtable.cc rename to src/routing/aodv/model/aodv-rtable.cc diff --git a/src/routing/aodv/aodv-rtable.h b/src/routing/aodv/model/aodv-rtable.h similarity index 100% rename from src/routing/aodv/aodv-rtable.h rename to src/routing/aodv/model/aodv-rtable.h diff --git a/src/routing/aodv/aodv-test-suite.cc b/src/routing/aodv/test/aodv-test-suite.cc similarity index 99% rename from src/routing/aodv/aodv-test-suite.cc rename to src/routing/aodv/test/aodv-test-suite.cc index 22899f42f..68cfe0b5d 100644 --- a/src/routing/aodv/aodv-test-suite.cc +++ b/src/routing/aodv/test/aodv-test-suite.cc @@ -18,10 +18,10 @@ * Authors: Pavel Boyko */ #include "ns3/test.h" -#include "aodv-neighbor.h" -#include "aodv-packet.h" -#include "aodv-rqueue.h" -#include "aodv-rtable.h" +#include "ns3/aodv-neighbor.h" +#include "ns3/aodv-packet.h" +#include "ns3/aodv-rqueue.h" +#include "ns3/aodv-rtable.h" #include "ns3/ipv4-route.h" namespace ns3 diff --git a/src/routing/aodv/wscript b/src/routing/aodv/wscript index e2b680afa..2511a8d18 100644 --- a/src/routing/aodv/wscript +++ b/src/routing/aodv/wscript @@ -4,14 +4,15 @@ def build(bld): module = bld.create_ns3_module('aodv', ['internet', 'contrib']) module.includes = '.' module.source = [ - 'aodv-id-cache.cc', - 'aodv-dpd.cc', - 'aodv-rtable.cc', - 'aodv-rqueue.cc', - 'aodv-packet.cc', - 'aodv-neighbor.cc', - 'aodv-routing-protocol.cc', - 'aodv-test-suite.cc', + 'model/aodv-id-cache.cc', + 'model/aodv-dpd.cc', + 'model/aodv-rtable.cc', + 'model/aodv-rqueue.cc', + 'model/aodv-packet.cc', + 'model/aodv-neighbor.cc', + 'model/aodv-routing-protocol.cc', + 'helper/aodv-helper.cc', + 'test/aodv-test-suite.cc', 'test/aodv-regression.cc', 'test/bug-772.cc', 'test/loopback.cc', @@ -20,12 +21,15 @@ def build(bld): headers = bld.new_task_gen('ns3header') headers.module = 'aodv' headers.source = [ - 'aodv-id-cache.h', - 'aodv-dpd.h', - 'aodv-rtable.h', - 'aodv-rqueue.h', - 'aodv-packet.h', - 'aodv-neighbor.h', - 'aodv-routing-protocol.h', + 'model/aodv-id-cache.h', + 'model/aodv-dpd.h', + 'model/aodv-rtable.h', + 'model/aodv-rqueue.h', + 'model/aodv-packet.h', + 'model/aodv-neighbor.h', + 'model/aodv-routing-protocol.h', + 'helper/aodv-helper.h', ] + if bld.env['ENABLE_EXAMPLES']: + bld.add_subdirs('examples') diff --git a/src/routing/nix-vector-routing/nix-vector-routing.h b/src/routing/nix-vector-routing/doc/nix-vector-routing.h similarity index 100% rename from src/routing/nix-vector-routing/nix-vector-routing.h rename to src/routing/nix-vector-routing/doc/nix-vector-routing.h diff --git a/examples/routing/nix-simple.cc b/src/routing/nix-vector-routing/examples/nix-simple.cc similarity index 98% rename from examples/routing/nix-simple.cc rename to src/routing/nix-vector-routing/examples/nix-simple.cc index e21496589..7fd6aa2eb 100644 --- a/examples/routing/nix-simple.cc +++ b/src/routing/nix-vector-routing/examples/nix-simple.cc @@ -14,12 +14,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "ns3/core-module.h" #include "ns3/core-module.h" #include "ns3/network-module.h" #include "ns3/helper-module.h" #include "ns3/ipv4-static-routing-helper.h" #include "ns3/ipv4-list-routing-helper.h" +#include "ns3/ipv4-nix-vector-helper.h" /* * Simple point to point links: diff --git a/examples/routing/nms-p2p-nix.cc b/src/routing/nix-vector-routing/examples/nms-p2p-nix.cc similarity index 99% rename from examples/routing/nms-p2p-nix.cc rename to src/routing/nix-vector-routing/examples/nms-p2p-nix.cc index a45b75f28..0f4452cd8 100644 --- a/examples/routing/nms-p2p-nix.cc +++ b/src/routing/nix-vector-routing/examples/nms-p2p-nix.cc @@ -46,6 +46,7 @@ #include "ns3/simulator.h" #include "ns3/ipv4-static-routing-helper.h" #include "ns3/ipv4-list-routing-helper.h" +#include "ns3/ipv4-nix-vector-helper.h" using namespace std; using namespace ns3; diff --git a/src/routing/nix-vector-routing/examples/wscript b/src/routing/nix-vector-routing/examples/wscript new file mode 100644 index 000000000..9f4bd3841 --- /dev/null +++ b/src/routing/nix-vector-routing/examples/wscript @@ -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('nix-simple', + ['point-to-point', 'internet', 'nix-vector-routing']) + obj.source = 'nix-simple.cc' + + obj = bld.create_ns3_program('nms-p2p-nix', + ['point-to-point', 'internet', 'nix-vector-routing']) + obj.source = 'nms-p2p-nix.cc' diff --git a/src/helper/ipv4-nix-vector-helper.cc b/src/routing/nix-vector-routing/helper/ipv4-nix-vector-helper.cc similarity index 100% rename from src/helper/ipv4-nix-vector-helper.cc rename to src/routing/nix-vector-routing/helper/ipv4-nix-vector-helper.cc diff --git a/src/helper/ipv4-nix-vector-helper.h b/src/routing/nix-vector-routing/helper/ipv4-nix-vector-helper.h similarity index 100% rename from src/helper/ipv4-nix-vector-helper.h rename to src/routing/nix-vector-routing/helper/ipv4-nix-vector-helper.h diff --git a/src/routing/nix-vector-routing/ipv4-nix-vector-routing.cc b/src/routing/nix-vector-routing/model/ipv4-nix-vector-routing.cc similarity index 100% rename from src/routing/nix-vector-routing/ipv4-nix-vector-routing.cc rename to src/routing/nix-vector-routing/model/ipv4-nix-vector-routing.cc diff --git a/src/routing/nix-vector-routing/ipv4-nix-vector-routing.h b/src/routing/nix-vector-routing/model/ipv4-nix-vector-routing.h similarity index 100% rename from src/routing/nix-vector-routing/ipv4-nix-vector-routing.h rename to src/routing/nix-vector-routing/model/ipv4-nix-vector-routing.h diff --git a/src/routing/nix-vector-routing/wscript b/src/routing/nix-vector-routing/wscript index e83e66a19..9bbf36f14 100644 --- a/src/routing/nix-vector-routing/wscript +++ b/src/routing/nix-vector-routing/wscript @@ -4,12 +4,16 @@ def build(bld): module = bld.create_ns3_module('nix-vector-routing', ['internet', 'contrib']) module.includes = '.' module.source = [ - 'ipv4-nix-vector-routing.cc', + 'model/ipv4-nix-vector-routing.cc', + 'helper/ipv4-nix-vector-helper.cc', ] headers = bld.new_task_gen('ns3header') headers.module = 'nix-vector-routing' headers.source = [ - 'ipv4-nix-vector-routing.h', + 'model/ipv4-nix-vector-routing.h', + 'helper/ipv4-nix-vector-helper.h', ] + if bld.env['ENABLE_EXAMPLES']: + bld.add_subdirs('examples') diff --git a/test.py b/test.py index f1961c3d2..d521faa9c 100755 --- a/test.py +++ b/test.py @@ -124,14 +124,14 @@ example_tests = [ ("examples/routing/global-injection-slash32", "True", "True"), ("examples/routing/global-routing-slash32", "True", "True"), ("examples/routing/mixed-global-routing", "True", "True"), - ("examples/routing/nix-simple", "True", "True"), - ("examples/routing/nms-p2p-nix", "False", "True"), # Takes too long to run + ("src/routing/nix-vector-routing/examples/routing/nix-simple", "True", "True"), + ("src/routing/nix-vector-routing/examples/routing/nms-p2p-nix", "False", "True"), # Takes too long to run ("examples/routing/simple-alternate-routing", "True", "True"), ("examples/routing/simple-global-routing", "True", "True"), ("src/routing/olsr/examples/simple-point-to-point-olsr", "True", "True"), ("examples/routing/simple-routing-ping6", "True", "True"), ("examples/routing/static-routing-slash32", "True", "True"), - ("examples/routing/aodv", "True", "True"), + ("src/routing/aodv/examples/routing/aodv", "True", "True"), ("src/spectrum/examples/adhoc-aloha-ideal-phy", "True", "True"), ("src/spectrum/examples/adhoc-aloha-ideal-phy-with-microwave-oven", "True", "True"),