initial import for dce submodule default tip
authorHajime Tazaki <tazaki@nict.go.jp>
Tue, 12 Mar 2013 12:03:42 +0900
changeset 02661206e024b
initial import for dce submodule
.hgignore
doc/Makefile
doc/source/conf.py
doc/source/index.rst
example/dce-submod-simple.cc
example/examples-to-run.py
helper/dce-submod-helper.cc
helper/dce-submod-helper.h
test/dce-submod-test.cc
waf
wscript
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.hgignore	Tue Mar 12 12:03:42 2013 +0900
     1.3 @@ -0,0 +1,14 @@
     1.4 +\.rej$
     1.5 +\.orig$
     1.6 +\.o$
     1.7 +~$
     1.8 +^build
     1.9 +^objdir
    1.10 +^elf-cache
    1.11 +^files-
    1.12 +^.waf-
    1.13 +^.lock-
    1.14 +pcap
    1.15 +^doc/build
    1.16 +testpy-output
    1.17 +\.pyc$
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/doc/Makefile	Tue Mar 12 12:03:42 2013 +0900
     2.3 @@ -0,0 +1,153 @@
     2.4 +# Makefile for Sphinx documentation
     2.5 +#
     2.6 +
     2.7 +# You can set these variables from the command line.
     2.8 +SPHINXOPTS    =
     2.9 +SPHINXBUILD   = sphinx-build
    2.10 +PAPER         =
    2.11 +BUILDDIR      = build
    2.12 +
    2.13 +# Internal variables.
    2.14 +PAPEROPT_a4     = -D latex_paper_size=a4
    2.15 +PAPEROPT_letter = -D latex_paper_size=letter
    2.16 +ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
    2.17 +# the i18n builder cannot share the environment and doctrees with the others
    2.18 +I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
    2.19 +
    2.20 +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
    2.21 +
    2.22 +help:
    2.23 +	@echo "Please use \`make <target>' where <target> is one of"
    2.24 +	@echo "  html       to make standalone HTML files"
    2.25 +	@echo "  dirhtml    to make HTML files named index.html in directories"
    2.26 +	@echo "  singlehtml to make a single large HTML file"
    2.27 +	@echo "  pickle     to make pickle files"
    2.28 +	@echo "  json       to make JSON files"
    2.29 +	@echo "  htmlhelp   to make HTML files and a HTML help project"
    2.30 +	@echo "  qthelp     to make HTML files and a qthelp project"
    2.31 +	@echo "  devhelp    to make HTML files and a Devhelp project"
    2.32 +	@echo "  epub       to make an epub"
    2.33 +	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
    2.34 +	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
    2.35 +	@echo "  text       to make text files"
    2.36 +	@echo "  man        to make manual pages"
    2.37 +	@echo "  texinfo    to make Texinfo files"
    2.38 +	@echo "  info       to make Texinfo files and run them through makeinfo"
    2.39 +	@echo "  gettext    to make PO message catalogs"
    2.40 +	@echo "  changes    to make an overview of all changed/added/deprecated items"
    2.41 +	@echo "  linkcheck  to check all external links for integrity"
    2.42 +	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
    2.43 +
    2.44 +clean:
    2.45 +	-rm -rf $(BUILDDIR)/*
    2.46 +
    2.47 +html:
    2.48 +	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
    2.49 +	@echo
    2.50 +	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
    2.51 +
    2.52 +dirhtml:
    2.53 +	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
    2.54 +	@echo
    2.55 +	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
    2.56 +
    2.57 +singlehtml:
    2.58 +	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
    2.59 +	@echo
    2.60 +	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
    2.61 +
    2.62 +pickle:
    2.63 +	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
    2.64 +	@echo
    2.65 +	@echo "Build finished; now you can process the pickle files."
    2.66 +
    2.67 +json:
    2.68 +	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
    2.69 +	@echo
    2.70 +	@echo "Build finished; now you can process the JSON files."
    2.71 +
    2.72 +htmlhelp:
    2.73 +	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
    2.74 +	@echo
    2.75 +	@echo "Build finished; now you can run HTML Help Workshop with the" \
    2.76 +	      ".hhp project file in $(BUILDDIR)/htmlhelp."
    2.77 +
    2.78 +qthelp:
    2.79 +	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
    2.80 +	@echo
    2.81 +	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
    2.82 +	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
    2.83 +	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/DCEsubmodule.qhcp"
    2.84 +	@echo "To view the help file:"
    2.85 +	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/DCEsubmodule.qhc"
    2.86 +
    2.87 +devhelp:
    2.88 +	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
    2.89 +	@echo
    2.90 +	@echo "Build finished."
    2.91 +	@echo "To view the help file:"
    2.92 +	@echo "# mkdir -p $$HOME/.local/share/devhelp/DCEsubmodule"
    2.93 +	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/DCEsubmodule"
    2.94 +	@echo "# devhelp"
    2.95 +
    2.96 +epub:
    2.97 +	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
    2.98 +	@echo
    2.99 +	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
   2.100 +
   2.101 +latex:
   2.102 +	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
   2.103 +	@echo
   2.104 +	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
   2.105 +	@echo "Run \`make' in that directory to run these through (pdf)latex" \
   2.106 +	      "(use \`make latexpdf' here to do that automatically)."
   2.107 +
   2.108 +latexpdf:
   2.109 +	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
   2.110 +	@echo "Running LaTeX files through pdflatex..."
   2.111 +	$(MAKE) -C $(BUILDDIR)/latex all-pdf
   2.112 +	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
   2.113 +
   2.114 +text:
   2.115 +	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
   2.116 +	@echo
   2.117 +	@echo "Build finished. The text files are in $(BUILDDIR)/text."
   2.118 +
   2.119 +man:
   2.120 +	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
   2.121 +	@echo
   2.122 +	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
   2.123 +
   2.124 +texinfo:
   2.125 +	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
   2.126 +	@echo
   2.127 +	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
   2.128 +	@echo "Run \`make' in that directory to run these through makeinfo" \
   2.129 +	      "(use \`make info' here to do that automatically)."
   2.130 +
   2.131 +info:
   2.132 +	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
   2.133 +	@echo "Running Texinfo files through makeinfo..."
   2.134 +	make -C $(BUILDDIR)/texinfo info
   2.135 +	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
   2.136 +
   2.137 +gettext:
   2.138 +	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
   2.139 +	@echo
   2.140 +	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
   2.141 +
   2.142 +changes:
   2.143 +	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
   2.144 +	@echo
   2.145 +	@echo "The overview file is in $(BUILDDIR)/changes."
   2.146 +
   2.147 +linkcheck:
   2.148 +	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
   2.149 +	@echo
   2.150 +	@echo "Link check complete; look for any errors in the above output " \
   2.151 +	      "or in $(BUILDDIR)/linkcheck/output.txt."
   2.152 +
   2.153 +doctest:
   2.154 +	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
   2.155 +	@echo "Testing of doctests in the sources finished, look at the " \
   2.156 +	      "results in $(BUILDDIR)/doctest/output.txt."
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/doc/source/conf.py	Tue Mar 12 12:03:42 2013 +0900
     3.3 @@ -0,0 +1,242 @@
     3.4 +# -*- coding: utf-8 -*-
     3.5 +#
     3.6 +# DCE submodule documentation build configuration file, created by
     3.7 +# sphinx-quickstart on Tue Mar 12 11:59:39 2013.
     3.8 +#
     3.9 +# This file is execfile()d with the current directory set to its containing dir.
    3.10 +#
    3.11 +# Note that not all possible configuration values are present in this
    3.12 +# autogenerated file.
    3.13 +#
    3.14 +# All configuration values have a default; values that are commented out
    3.15 +# serve to show the default.
    3.16 +
    3.17 +import sys, os
    3.18 +
    3.19 +# If extensions (or modules to document with autodoc) are in another directory,
    3.20 +# add these directories to sys.path here. If the directory is relative to the
    3.21 +# documentation root, use os.path.abspath to make it absolute, like shown here.
    3.22 +#sys.path.insert(0, os.path.abspath('.'))
    3.23 +
    3.24 +# -- General configuration -----------------------------------------------------
    3.25 +
    3.26 +# If your documentation needs a minimal Sphinx version, state it here.
    3.27 +#needs_sphinx = '1.0'
    3.28 +
    3.29 +# Add any Sphinx extension module names here, as strings. They can be extensions
    3.30 +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
    3.31 +extensions = []
    3.32 +
    3.33 +# Add any paths that contain templates here, relative to this directory.
    3.34 +templates_path = ['_templates']
    3.35 +
    3.36 +# The suffix of source filenames.
    3.37 +source_suffix = '.rst'
    3.38 +
    3.39 +# The encoding of source files.
    3.40 +#source_encoding = 'utf-8-sig'
    3.41 +
    3.42 +# The master toctree document.
    3.43 +master_doc = 'index'
    3.44 +
    3.45 +# General information about the project.
    3.46 +project = u'DCE submodule'
    3.47 +copyright = u'2013, Hajime Tazaki'
    3.48 +
    3.49 +# The version info for the project you're documenting, acts as replacement for
    3.50 +# |version| and |release|, also used in various other places throughout the
    3.51 +# built documents.
    3.52 +#
    3.53 +# The short X.Y version.
    3.54 +version = '1.0'
    3.55 +# The full version, including alpha/beta/rc tags.
    3.56 +release = '1.0'
    3.57 +
    3.58 +# The language for content autogenerated by Sphinx. Refer to documentation
    3.59 +# for a list of supported languages.
    3.60 +#language = None
    3.61 +
    3.62 +# There are two options for replacing |today|: either, you set today to some
    3.63 +# non-false value, then it is used:
    3.64 +#today = ''
    3.65 +# Else, today_fmt is used as the format for a strftime call.
    3.66 +#today_fmt = '%B %d, %Y'
    3.67 +
    3.68 +# List of patterns, relative to source directory, that match files and
    3.69 +# directories to ignore when looking for source files.
    3.70 +exclude_patterns = []
    3.71 +
    3.72 +# The reST default role (used for this markup: `text`) to use for all documents.
    3.73 +#default_role = None
    3.74 +
    3.75 +# If true, '()' will be appended to :func: etc. cross-reference text.
    3.76 +#add_function_parentheses = True
    3.77 +
    3.78 +# If true, the current module name will be prepended to all description
    3.79 +# unit titles (such as .. function::).
    3.80 +#add_module_names = True
    3.81 +
    3.82 +# If true, sectionauthor and moduleauthor directives will be shown in the
    3.83 +# output. They are ignored by default.
    3.84 +#show_authors = False
    3.85 +
    3.86 +# The name of the Pygments (syntax highlighting) style to use.
    3.87 +pygments_style = 'sphinx'
    3.88 +
    3.89 +# A list of ignored prefixes for module index sorting.
    3.90 +#modindex_common_prefix = []
    3.91 +
    3.92 +
    3.93 +# -- Options for HTML output ---------------------------------------------------
    3.94 +
    3.95 +# The theme to use for HTML and HTML Help pages.  See the documentation for
    3.96 +# a list of builtin themes.
    3.97 +html_theme = 'sphinxdoc'
    3.98 +
    3.99 +# Theme options are theme-specific and customize the look and feel of a theme
   3.100 +# further.  For a list of options available for each theme, see the
   3.101 +# documentation.
   3.102 +#html_theme_options = {}
   3.103 +
   3.104 +# Add any paths that contain custom themes here, relative to this directory.
   3.105 +#html_theme_path = []
   3.106 +
   3.107 +# The name for this set of Sphinx documents.  If None, it defaults to
   3.108 +# "<project> v<release> documentation".
   3.109 +#html_title = None
   3.110 +
   3.111 +# A shorter title for the navigation bar.  Default is the same as html_title.
   3.112 +#html_short_title = None
   3.113 +
   3.114 +# The name of an image file (relative to this directory) to place at the top
   3.115 +# of the sidebar.
   3.116 +#html_logo = None
   3.117 +
   3.118 +# The name of an image file (within the static path) to use as favicon of the
   3.119 +# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
   3.120 +# pixels large.
   3.121 +#html_favicon = None
   3.122 +
   3.123 +# Add any paths that contain custom static files (such as style sheets) here,
   3.124 +# relative to this directory. They are copied after the builtin static files,
   3.125 +# so a file named "default.css" will overwrite the builtin "default.css".
   3.126 +html_static_path = ['_static']
   3.127 +
   3.128 +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
   3.129 +# using the given strftime format.
   3.130 +#html_last_updated_fmt = '%b %d, %Y'
   3.131 +
   3.132 +# If true, SmartyPants will be used to convert quotes and dashes to
   3.133 +# typographically correct entities.
   3.134 +#html_use_smartypants = True
   3.135 +
   3.136 +# Custom sidebar templates, maps document names to template names.
   3.137 +#html_sidebars = {}
   3.138 +
   3.139 +# Additional templates that should be rendered to pages, maps page names to
   3.140 +# template names.
   3.141 +#html_additional_pages = {}
   3.142 +
   3.143 +# If false, no module index is generated.
   3.144 +#html_domain_indices = True
   3.145 +
   3.146 +# If false, no index is generated.
   3.147 +#html_use_index = True
   3.148 +
   3.149 +# If true, the index is split into individual pages for each letter.
   3.150 +#html_split_index = False
   3.151 +
   3.152 +# If true, links to the reST sources are added to the pages.
   3.153 +#html_show_sourcelink = True
   3.154 +
   3.155 +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
   3.156 +#html_show_sphinx = True
   3.157 +
   3.158 +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
   3.159 +#html_show_copyright = True
   3.160 +
   3.161 +# If true, an OpenSearch description file will be output, and all pages will
   3.162 +# contain a <link> tag referring to it.  The value of this option must be the
   3.163 +# base URL from which the finished HTML is served.
   3.164 +#html_use_opensearch = ''
   3.165 +
   3.166 +# This is the file name suffix for HTML files (e.g. ".xhtml").
   3.167 +#html_file_suffix = None
   3.168 +
   3.169 +# Output file base name for HTML help builder.
   3.170 +htmlhelp_basename = 'DCEsubmoduledoc'
   3.171 +
   3.172 +
   3.173 +# -- Options for LaTeX output --------------------------------------------------
   3.174 +
   3.175 +latex_elements = {
   3.176 +# The paper size ('letterpaper' or 'a4paper').
   3.177 +#'papersize': 'letterpaper',
   3.178 +
   3.179 +# The font size ('10pt', '11pt' or '12pt').
   3.180 +#'pointsize': '10pt',
   3.181 +
   3.182 +# Additional stuff for the LaTeX preamble.
   3.183 +#'preamble': '',
   3.184 +}
   3.185 +
   3.186 +# Grouping the document tree into LaTeX files. List of tuples
   3.187 +# (source start file, target name, title, author, documentclass [howto/manual]).
   3.188 +latex_documents = [
   3.189 +  ('index', 'DCEsubmodule.tex', u'DCE submodule Documentation',
   3.190 +   u'Hajime Tazaki', 'manual'),
   3.191 +]
   3.192 +
   3.193 +# The name of an image file (relative to this directory) to place at the top of
   3.194 +# the title page.
   3.195 +#latex_logo = None
   3.196 +
   3.197 +# For "manual" documents, if this is true, then toplevel headings are parts,
   3.198 +# not chapters.
   3.199 +#latex_use_parts = False
   3.200 +
   3.201 +# If true, show page references after internal links.
   3.202 +#latex_show_pagerefs = False
   3.203 +
   3.204 +# If true, show URL addresses after external links.
   3.205 +#latex_show_urls = False
   3.206 +
   3.207 +# Documents to append as an appendix to all manuals.
   3.208 +#latex_appendices = []
   3.209 +
   3.210 +# If false, no module index is generated.
   3.211 +#latex_domain_indices = True
   3.212 +
   3.213 +
   3.214 +# -- Options for manual page output --------------------------------------------
   3.215 +
   3.216 +# One entry per manual page. List of tuples
   3.217 +# (source start file, name, description, authors, manual section).
   3.218 +man_pages = [
   3.219 +    ('index', 'dcesubmodule', u'DCE submodule Documentation',
   3.220 +     [u'Hajime Tazaki'], 1)
   3.221 +]
   3.222 +
   3.223 +# If true, show URL addresses after external links.
   3.224 +#man_show_urls = False
   3.225 +
   3.226 +
   3.227 +# -- Options for Texinfo output ------------------------------------------------
   3.228 +
   3.229 +# Grouping the document tree into Texinfo files. List of tuples
   3.230 +# (source start file, target name, title, author,
   3.231 +#  dir menu entry, description, category)
   3.232 +texinfo_documents = [
   3.233 +  ('index', 'DCEsubmodule', u'DCE submodule Documentation',
   3.234 +   u'Hajime Tazaki', 'DCEsubmodule', 'One line description of project.',
   3.235 +   'Miscellaneous'),
   3.236 +]
   3.237 +
   3.238 +# Documents to append as an appendix to all manuals.
   3.239 +#texinfo_appendices = []
   3.240 +
   3.241 +# If false, no module index is generated.
   3.242 +#texinfo_domain_indices = True
   3.243 +
   3.244 +# How to display URL addresses: 'footnote', 'no', or 'inline'.
   3.245 +#texinfo_show_urls = 'footnote'
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/doc/source/index.rst	Tue Mar 12 12:03:42 2013 +0900
     4.3 @@ -0,0 +1,22 @@
     4.4 +.. DCE submodule documentation master file, created by
     4.5 +   sphinx-quickstart on Tue Mar 12 11:59:39 2013.
     4.6 +   You can adapt this file completely to your liking, but it should at least
     4.7 +   contain the root `toctree` directive.
     4.8 +
     4.9 +Welcome to DCE submodule's documentation!
    4.10 +=========================================
    4.11 +
    4.12 +Contents:
    4.13 +
    4.14 +.. toctree::
    4.15 +   :maxdepth: 2
    4.16 +
    4.17 +
    4.18 +
    4.19 +Indices and tables
    4.20 +==================
    4.21 +
    4.22 +* :ref:`genindex`
    4.23 +* :ref:`modindex`
    4.24 +* :ref:`search`
    4.25 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/example/dce-submod-simple.cc	Tue Mar 12 12:03:42 2013 +0900
     5.3 @@ -0,0 +1,31 @@
     5.4 +#include "ns3/network-module.h"
     5.5 +#include "ns3/core-module.h"
     5.6 +#include "ns3/internet-module.h"
     5.7 +#include "ns3/dce-module.h"
     5.8 +#include "ns3/dce-submod-module.h"
     5.9 +
    5.10 +using namespace ns3;
    5.11 +
    5.12 +int main (int argc, char *argv[])
    5.13 +{
    5.14 +  CommandLine cmd;
    5.15 +  cmd.Parse (argc, argv);
    5.16 +
    5.17 +  NodeContainer nodes;
    5.18 +  nodes.Create (1);
    5.19 +
    5.20 +  InternetStackHelper stack;
    5.21 +  stack.Install (nodes);
    5.22 +
    5.23 +  DceManagerHelper dceManager;
    5.24 +  dceManager.Install (nodes);
    5.25 +
    5.26 +  DceSubModuleHelper sub;
    5.27 +  sub.Install (nodes.Get (0));
    5.28 +
    5.29 +  Simulator::Stop (Seconds (100.0));
    5.30 +  Simulator::Run ();
    5.31 +  Simulator::Destroy ();
    5.32 +
    5.33 +  return 0;
    5.34 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/example/examples-to-run.py	Tue Mar 12 12:03:42 2013 +0900
     6.3 @@ -0,0 +1,20 @@
     6.4 +#! /usr/bin/env python
     6.5 +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
     6.6 +
     6.7 +# A list of C++ examples to run in order to ensure that they remain
     6.8 +# buildable and runnable over time.  Each tuple in the list contains
     6.9 +#
    6.10 +#     (example_name, do_run, do_valgrind_run).
    6.11 +#
    6.12 +# See test.py for more information.
    6.13 +cpp_examples = [
    6.14 +    ("some-your-example", "True", "True"),
    6.15 +]
    6.16 +
    6.17 +# A list of Python examples to run in order to ensure that they remain
    6.18 +# runnable over time.  Each tuple in the list contains
    6.19 +#
    6.20 +#     (example_name, do_run).
    6.21 +#
    6.22 +# See test.py for more information.
    6.23 +python_examples = []
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/helper/dce-submod-helper.cc	Tue Mar 12 12:03:42 2013 +0900
     7.3 @@ -0,0 +1,177 @@
     7.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     7.5 +/*
     7.6 + * Copyright (c) 2013 Hajime Tazaki, NICT
     7.7 + *
     7.8 + * This program is free software; you can redistribute it and/or modify
     7.9 + * it under the terms of the GNU General Public License version 2 as
    7.10 + * published by the Free Software Foundation;
    7.11 + *
    7.12 + * This program is distributed in the hope that it will be useful,
    7.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.15 + * GNU General Public License for more details.
    7.16 + *
    7.17 + * You should have received a copy of the GNU General Public License
    7.18 + * along with this program; if not, write to the Free Software
    7.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    7.20 + *
    7.21 + * Author: Hajime Tazaki <tazaki@nict.go.jp>
    7.22 + */
    7.23 +
    7.24 +#include "ns3/object-factory.h"
    7.25 +#include "ns3/names.h"
    7.26 +#include "ns3/log.h"
    7.27 +#include "dce-submod-helper.h"
    7.28 +#include <sys/stat.h>
    7.29 +#include <fstream>
    7.30 +
    7.31 +NS_LOG_COMPONENT_DEFINE ("DceSubModuleHelper");
    7.32 +
    7.33 +namespace ns3 {
    7.34 +
    7.35 +class DceSubModuleConfig : public Object
    7.36 +{
    7.37 +private:
    7.38 +  static int index;
    7.39 +  std::string router_id;
    7.40 +  std::map<std::string, uint32_t> *networks;
    7.41 +public:
    7.42 +  DceSubModuleConfig ()
    7.43 +  {
    7.44 +  }
    7.45 +  ~DceSubModuleConfig ()
    7.46 +  {
    7.47 +  }
    7.48 +
    7.49 +  static TypeId
    7.50 +  GetTypeId (void)
    7.51 +  {
    7.52 +    static TypeId tid = TypeId ("ns3::DceSubModuleConfig")
    7.53 +      .SetParent<Object> ()
    7.54 +      .AddConstructor<DceSubModuleConfig> ()
    7.55 +    ;
    7.56 +    return tid;
    7.57 +  }
    7.58 +  TypeId
    7.59 +  GetInstanceTypeId (void) const
    7.60 +  {
    7.61 +    return GetTypeId ();
    7.62 +  }
    7.63 +
    7.64 +  void
    7.65 +  SetFilename (const std::string &filename)
    7.66 +  {
    7.67 +    m_filename = filename;
    7.68 +  }
    7.69 +
    7.70 +  std::string
    7.71 +  GetFilename () const
    7.72 +  {
    7.73 +    return m_filename;
    7.74 +  }
    7.75 +
    7.76 +  std::string m_filename;
    7.77 +
    7.78 +  virtual void
    7.79 +  Print (std::ostream& os) const
    7.80 +  {
    7.81 +    os << "hostname localhost" << std::endl
    7.82 +       << "password deadbeaf" << std::endl
    7.83 +       << "log stdout" << std::endl;
    7.84 +  }
    7.85 +};
    7.86 +std::ostream& operator << (std::ostream& os, DceSubModuleConfig const& config)
    7.87 +{
    7.88 +  config.Print (os);
    7.89 +  return os;
    7.90 +}
    7.91 +
    7.92 +
    7.93 +DceSubModuleHelper::DceSubModuleHelper ()
    7.94 +{
    7.95 +}
    7.96 +
    7.97 +void
    7.98 +DceSubModuleHelper::SetAttribute (std::string name, const AttributeValue &value)
    7.99 +{
   7.100 +}
   7.101 +
   7.102 +
   7.103 +void
   7.104 +DceSubModuleHelper::GenerateConfig (Ptr<Node> node)
   7.105 +{
   7.106 +  Ptr<DceSubModuleConfig> conf = node->GetObject<DceSubModuleConfig> ();
   7.107 +
   7.108 +  // config generation
   7.109 +  std::stringstream conf_dir, conf_file;
   7.110 +  // FIXME XXX
   7.111 +  conf_dir << "files-" << node->GetId () << "";
   7.112 +  ::mkdir (conf_dir.str ().c_str (), S_IRWXU | S_IRWXG);
   7.113 +  conf_dir << "/usr/";
   7.114 +  ::mkdir (conf_dir.str ().c_str (), S_IRWXU | S_IRWXG);
   7.115 +  conf_dir << "/local/";
   7.116 +  ::mkdir (conf_dir.str ().c_str (), S_IRWXU | S_IRWXG);
   7.117 +  conf_dir << "/etc/";
   7.118 +  ::mkdir (conf_dir.str ().c_str (), S_IRWXU | S_IRWXG);
   7.119 +
   7.120 +  conf_file << conf_dir.str () << "/sample_app.conf";
   7.121 +  conf->SetFilename ("/usr/local/etc/sample_app.conf");
   7.122 +
   7.123 +  std::ofstream conff;
   7.124 +  conff.open (conf_file.str ().c_str ());
   7.125 +  conff << *conf;
   7.126 +
   7.127 +  conff << "additional config 1: True" << std::endl;
   7.128 +
   7.129 +  conff.close ();
   7.130 +}
   7.131 +
   7.132 +ApplicationContainer
   7.133 +DceSubModuleHelper::Install (Ptr<Node> node)
   7.134 +{
   7.135 +  return ApplicationContainer (InstallPriv (node));
   7.136 +}
   7.137 +
   7.138 +ApplicationContainer
   7.139 +DceSubModuleHelper::Install (std::string nodeName)
   7.140 +{
   7.141 +  Ptr<Node> node = Names::Find<Node> (nodeName);
   7.142 +  return ApplicationContainer (InstallPriv (node));
   7.143 +}
   7.144 +
   7.145 +ApplicationContainer
   7.146 +DceSubModuleHelper::Install (NodeContainer c)
   7.147 +{
   7.148 +  ApplicationContainer apps;
   7.149 +  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
   7.150 +    {
   7.151 +      apps.Add (InstallPriv (*i));
   7.152 +    }
   7.153 +
   7.154 +  return apps;
   7.155 +}
   7.156 +
   7.157 +ApplicationContainer
   7.158 +DceSubModuleHelper::InstallPriv (Ptr<Node> node)
   7.159 +{
   7.160 +  DceApplicationHelper process;
   7.161 +  ApplicationContainer apps;
   7.162 +
   7.163 +  Ptr<DceSubModuleConfig> conf = node->GetObject<DceSubModuleConfig> ();
   7.164 +  if (!conf)
   7.165 +    {
   7.166 +      conf = new DceSubModuleConfig ();
   7.167 +      node->AggregateObject (conf);
   7.168 +    }
   7.169 +  GenerateConfig (node);
   7.170 +  process.SetBinary ("sample_app");
   7.171 +  process.AddArguments ("-f", conf->GetFilename ());
   7.172 +  process.SetStackSize (1 << 16);
   7.173 +  apps.Add (process.Install (node));
   7.174 +  apps.Get (0)->SetStartTime (Seconds (1.0 + 0.01 * node->GetId ()));
   7.175 +  node->AddApplication (apps.Get (0));
   7.176 +
   7.177 +  return apps;
   7.178 +}
   7.179 +
   7.180 +} // namespace ns3
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/helper/dce-submod-helper.h	Tue Mar 12 12:03:42 2013 +0900
     8.3 @@ -0,0 +1,94 @@
     8.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     8.5 +/*
     8.6 + * Copyright (c) 2013 Hajime Tazaki, NICT
     8.7 + *
     8.8 + * This program is free software; you can redistribute it and/or modify
     8.9 + * it under the terms of the GNU General Public License version 2 as
    8.10 + * published by the Free Software Foundation;
    8.11 + *
    8.12 + * This program is distributed in the hope that it will be useful,
    8.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8.15 + * GNU General Public License for more details.
    8.16 + *
    8.17 + * You should have received a copy of the GNU General Public License
    8.18 + * along with this program; if not, write to the Free Software
    8.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    8.20 + *
    8.21 + * Author: Hajime Tazaki <tazaki@sfc.wide.ad.jp>
    8.22 + */
    8.23 +#ifndef QUAGGA_HELPER_H
    8.24 +#define QUAGGA_HELPER_H
    8.25 +
    8.26 +#include "ns3/dce-manager-helper.h"
    8.27 +#include "ns3/dce-application-helper.h"
    8.28 +
    8.29 +namespace ns3 {
    8.30 +
    8.31 +/**
    8.32 + * \brief create a sample application daemon as an application and associate it to a node
    8.33 + *
    8.34 + * This class creates one or multiple instances of ns3::SampleApplication and associates
    8.35 + * it/them to one/multiple node(s).
    8.36 + */
    8.37 +class DceSubModuleHelper
    8.38 +{
    8.39 +public:
    8.40 +  /**
    8.41 +   * Create a DceSubModuleHelper which is used to make life easier for people wanting
    8.42 +   * to use quagga Applications.
    8.43 +   *
    8.44 +   */
    8.45 +  DceSubModuleHelper ();
    8.46 +
    8.47 +  /**
    8.48 +   * Install a quagga application on each Node in the provided NodeContainer.
    8.49 +   *
    8.50 +   * \param nodes The NodeContainer containing all of the nodes to get a quagga
    8.51 +   *              application via ProcessManager.
    8.52 +   *
    8.53 +   * \returns A list of quagga applications, one for each input node
    8.54 +   */
    8.55 +  ApplicationContainer Install (NodeContainer nodes);
    8.56 +
    8.57 +  /**
    8.58 +   * Install a quagga application on the provided Node.  The Node is specified
    8.59 +   * directly by a Ptr<Node>
    8.60 +   *
    8.61 +   * \param node The node to install the DceSubModuleApplication on.
    8.62 +   *
    8.63 +   * \returns An ApplicationContainer holding the quagga application created.
    8.64 +   */
    8.65 +  ApplicationContainer Install (Ptr<Node> node);
    8.66 +
    8.67 +  /**
    8.68 +   * Install a quagga application on the provided Node.  The Node is specified
    8.69 +   * by a string that must have previosly been associated with a Node using the
    8.70 +   * Object Name Service.
    8.71 +   *
    8.72 +   * \param nodeName The node to install the ProcessApplication on.
    8.73 +   *
    8.74 +   * \returns An ApplicationContainer holding the quagga application created.
    8.75 +   */
    8.76 +  ApplicationContainer Install (std::string nodeName);
    8.77 +
    8.78 +  /**
    8.79 +   * \brief Configure ping applications attribute
    8.80 +   *
    8.81 +   * \param name   attribute's name
    8.82 +   * \param value  attribute's value
    8.83 +   */
    8.84 +  void SetAttribute (std::string name, const AttributeValue &value);
    8.85 +
    8.86 +
    8.87 +private:
    8.88 +  /**
    8.89 +   * \internal
    8.90 +   */
    8.91 +  ApplicationContainer InstallPriv (Ptr<Node> node);
    8.92 +  void GenerateConfig (Ptr<Node> node);
    8.93 +};
    8.94 +
    8.95 +} // namespace ns3
    8.96 +
    8.97 +#endif /* QUAGGA_HELPER_H */
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/test/dce-submod-test.cc	Tue Mar 12 12:03:42 2013 +0900
     9.3 @@ -0,0 +1,310 @@
     9.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     9.5 +/*
     9.6 + * Copyright (c) 2013 Hajime Tazaki, NICT
     9.7 + *
     9.8 + * This program is free software; you can redistribute it and/or modify
     9.9 + * it under the terms of the GNU General Public License version 2 as
    9.10 + * published by the Free Software Foundation;
    9.11 + *
    9.12 + * This program is distributed in the hope that it will be useful,
    9.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9.15 + * GNU General Public License for more details.
    9.16 + *
    9.17 + * You should have received a copy of the GNU General Public License
    9.18 + * along with this program; if not, write to the Free Software
    9.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    9.20 + *
    9.21 + * Author: Hajime Tazaki <tazaki@nict.go.jp>
    9.22 + */
    9.23 +
    9.24 +#include "ns3/network-module.h"
    9.25 +#include "ns3/core-module.h"
    9.26 +#include "ns3/internet-module.h"
    9.27 +#include "ns3/dce-module.h"
    9.28 +#include "ns3/dce-submod-helper.h"
    9.29 +#include "ns3/csma-helper.h"
    9.30 +#include "ns3/v4ping.h"
    9.31 +#include "ns3/ping6.h"
    9.32 +#include "ns3/ethernet-header.h"
    9.33 +#include "ns3/icmpv4.h"
    9.34 +
    9.35 +#define OUTPUT(x)                                                       \
    9.36 +  {                                                                     \
    9.37 +    std::ostringstream oss;                                             \
    9.38 +    oss << "file=" << __FILE__ << " line=" << __LINE__ << " "           \
    9.39 +        << x << std::endl;                                              \
    9.40 +    std::string s = oss.str ();                                         \
    9.41 +    std::cerr << s.c_str ();                                            \
    9.42 +  }
    9.43 +
    9.44 +
    9.45 +static std::string g_testError;
    9.46 +
    9.47 +extern "C" void dce_manager_test_store_test_error (const char *s)
    9.48 +{
    9.49 +  g_testError = s;
    9.50 +}
    9.51 +
    9.52 +using namespace ns3;
    9.53 +namespace ns3 {
    9.54 +
    9.55 +static void RunIp (Ptr<Node> node, Time at, std::string str)
    9.56 +{
    9.57 +  DceApplicationHelper process;
    9.58 +  ApplicationContainer apps;
    9.59 +  process.SetBinary ("ip");
    9.60 +  process.SetStackSize (1 << 16);
    9.61 +  process.ResetArguments ();
    9.62 +  process.ParseArguments (str.c_str ());
    9.63 +  apps = process.Install (node);
    9.64 +  apps.Start (at);
    9.65 +}
    9.66 +
    9.67 +static void AddAddress (Ptr<Node> node, Time at, const char *name, const char *address)
    9.68 +{
    9.69 +  std::ostringstream oss;
    9.70 +  oss << "-f inet6 addr add " << address << " dev " << name;
    9.71 +  RunIp (node, at, oss.str ());
    9.72 +}
    9.73 +
    9.74 +class DceDceSubModuleTestCase : public TestCase
    9.75 +{
    9.76 +public:
    9.77 +  DceDceSubModuleTestCase (std::string testname, Time maxDuration, bool useK, bool skip);
    9.78 +  void CsmaRxCallback (std::string context, Ptr<const Packet> packet);
    9.79 +private:
    9.80 +  virtual void DoRun (void);
    9.81 +  static void Finished (int *pstatus, uint16_t pid, int status);
    9.82 +
    9.83 +  std::string m_testname;
    9.84 +  Time m_maxDuration;
    9.85 +  bool m_useKernel;
    9.86 +  bool m_pingStatus;
    9.87 +  bool m_debug;
    9.88 +  bool m_skip;
    9.89 +};
    9.90 +
    9.91 +void
    9.92 +DceDceSubModuleTestCase::CsmaRxCallback (std::string context, Ptr<const Packet> originalPacket)
    9.93 +{
    9.94 +  if (m_pingStatus)
    9.95 +    {
    9.96 +      return;
    9.97 +    }
    9.98 +  uint16_t protocol;
    9.99 +  Ptr<Packet> packet = originalPacket->Copy ();
   9.100 +  EthernetHeader header (false);
   9.101 +  packet->RemoveHeader (header);
   9.102 +  protocol = header.GetLengthType ();
   9.103 +  Ipv4Header v4hdr;
   9.104 +  Icmpv4Header icmphdr;
   9.105 +  Ipv6Header v6hdr;
   9.106 +  Icmpv6Header icmp6hdr;
   9.107 +  switch (protocol)
   9.108 +    {
   9.109 +    case 0x0800:   //IPv4
   9.110 +      packet->RemoveHeader (v4hdr);
   9.111 +      packet->RemoveHeader (icmphdr);
   9.112 +      if (icmphdr.GetType () == Icmpv4Header::ECHO_REPLY)
   9.113 +        {
   9.114 +          m_pingStatus = true;
   9.115 +        }
   9.116 +      break;
   9.117 +    case 0x86DD:   //IPv6
   9.118 +      packet->RemoveHeader (v6hdr);
   9.119 +      packet->RemoveHeader (icmp6hdr);
   9.120 +      if (icmp6hdr.GetType () == Icmpv6Header::ICMPV6_ECHO_REPLY)
   9.121 +        {
   9.122 +          m_pingStatus = true;
   9.123 +        }
   9.124 +      break;
   9.125 +    default:
   9.126 +      break;
   9.127 +    }
   9.128 +
   9.129 +  //  std::cout << context << " " << packet << " protocol " << protocol << std::endl;
   9.130 +}
   9.131 +
   9.132 +DceDceSubModuleTestCase::DceDceSubModuleTestCase (std::string testname, Time maxDuration, bool useK, bool skip)
   9.133 +  : TestCase (skip ? "(SKIP) " + testname + (useK ? " (kernel)" : " (ns3)") : "" "Check that process \"" + testname
   9.134 +              + (useK ? " (kernel)" : " (ns3)") + "\" completes correctly."),
   9.135 +    m_testname (testname),
   9.136 +    m_maxDuration (maxDuration),
   9.137 +    m_useKernel (useK),
   9.138 +    m_pingStatus (false),
   9.139 +    m_debug (false),
   9.140 +    m_skip (skip)
   9.141 +{
   9.142 +}
   9.143 +void
   9.144 +DceDceSubModuleTestCase::Finished (int *pstatus, uint16_t pid, int status)
   9.145 +{
   9.146 +  *pstatus = status;
   9.147 +}
   9.148 +void
   9.149 +DceDceSubModuleTestCase::DoRun (void)
   9.150 +{
   9.151 +  if (m_skip)
   9.152 +    {
   9.153 +      return;
   9.154 +    }
   9.155 +
   9.156 +  //
   9.157 +  //  Step 1
   9.158 +  //  Node Basic Configuration
   9.159 +  //
   9.160 +  std::string routerPort;
   9.161 +
   9.162 +  NodeContainer nodes;
   9.163 +  nodes.Create (2);
   9.164 +
   9.165 +  CsmaHelper csma;
   9.166 +
   9.167 +  NetDeviceContainer devices, dev1, dev2;
   9.168 +  devices = csma.Install (nodes);
   9.169 +  dev1 = csma.Install (nodes.Get (0));
   9.170 +  dev2 = csma.Install (nodes.Get (1));
   9.171 +  DceManagerHelper processManager;
   9.172 +
   9.173 +  //  processManager.SetLoader ("ns3::DlmLoaderFactory");
   9.174 +  processManager.SetTaskManagerAttribute ("FiberManagerType",
   9.175 +                                          EnumValue (0));
   9.176 +  //
   9.177 +  // Step 2
   9.178 +  // Address Configuration
   9.179 +  //
   9.180 +  //
   9.181 +  if (m_useKernel == false)
   9.182 +    {
   9.183 +      Ipv4AddressHelper ipv4AddrHelper;
   9.184 +      Ipv6AddressHelper ipv6AddrHelper;
   9.185 +      // Internet stack install
   9.186 +      InternetStackHelper stack;    // IPv4 is required for GlobalRouteMan
   9.187 +      Ipv4DceRoutingHelper ipv4RoutingHelper;
   9.188 +      stack.SetRoutingHelper (ipv4RoutingHelper);
   9.189 +      stack.Install (nodes);
   9.190 +
   9.191 +      ipv4AddrHelper.SetBase ("10.0.0.0", "255.255.255.0");
   9.192 +      ipv4AddrHelper.Assign (devices);
   9.193 +      ipv6AddrHelper.NewNetwork ("2001:db8:0:1::", Ipv6Prefix (64));
   9.194 +      ipv6AddrHelper.Assign (devices);
   9.195 +
   9.196 +      ipv4AddrHelper.SetBase ("11.0.0.0", "255.255.255.0");
   9.197 +      ipv4AddrHelper.Assign (dev1);
   9.198 +      ipv6AddrHelper.NewNetwork ("2001:db8:0:2::", Ipv6Prefix (64));
   9.199 +      ipv6AddrHelper.Assign (dev1);
   9.200 +
   9.201 +      ipv4AddrHelper.SetBase ("12.0.0.0", "255.255.255.0");
   9.202 +      ipv4AddrHelper.Assign (dev2);
   9.203 +      ipv6AddrHelper.NewNetwork ("2001:db8:0:3::", Ipv6Prefix (64));
   9.204 +      ipv6AddrHelper.Assign (dev2);
   9.205 +
   9.206 +      processManager.SetNetworkStack ("ns3::Ns3SocketFdFactory");
   9.207 +      processManager.Install (nodes);
   9.208 +
   9.209 +      routerPort = "ns3-device0";
   9.210 +      if (m_debug)
   9.211 +        {
   9.212 +          Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ("routes-" + m_testname + ".log", std::ios::out);
   9.213 +          ipv4RoutingHelper.PrintRoutingTableAllEvery (Seconds (10), routingStream);
   9.214 +        }
   9.215 +    }
   9.216 +  else if (m_useKernel == true)
   9.217 +    {
   9.218 +      processManager.SetNetworkStack ("ns3::LinuxSocketFdFactory",
   9.219 +                                      "Library", StringValue ("liblinux.so"));
   9.220 +      processManager.Install (nodes);
   9.221 +
   9.222 +      // IP address configuration
   9.223 +      AddAddress (nodes.Get (0), Seconds (0.1), "sim0", "2001:db8:0:1::1/64");
   9.224 +      AddAddress (nodes.Get (0), Seconds (0.1), "sim1", "2001:db8:0:2::1/64");
   9.225 +      RunIp (nodes.Get (0), Seconds (0.11), "-f inet addr add 10.0.0.1/24 dev sim0");
   9.226 +      RunIp (nodes.Get (0), Seconds (0.11), "-f inet addr add 11.0.0.1/24 dev sim1");
   9.227 +      RunIp (nodes.Get (0), Seconds (0.11), "link set lo up");
   9.228 +      RunIp (nodes.Get (0), Seconds (0.11), "link set sim0 up");
   9.229 +      RunIp (nodes.Get (0), Seconds (0.11), "link set sim1 up");
   9.230 +
   9.231 +      AddAddress (nodes.Get (1), Seconds (0.1), "sim0", "2001:db8:0:1::2/64");
   9.232 +      AddAddress (nodes.Get (1), Seconds (0.1), "sim1", "2001:db8:0:3::2/64");
   9.233 +      RunIp (nodes.Get (1), Seconds (0.11), "-f inet addr add 10.0.0.2/24 dev sim0");
   9.234 +      RunIp (nodes.Get (1), Seconds (0.11), "-f inet addr add 12.0.0.1/24 dev sim1");
   9.235 +      RunIp (nodes.Get (1), Seconds (0.11), "link set lo up");
   9.236 +      RunIp (nodes.Get (1), Seconds (0.11), "link set sim0 up");
   9.237 +      RunIp (nodes.Get (1), Seconds (0.11), "link set sim1 up");
   9.238 +      if (m_debug)
   9.239 +        {
   9.240 +          RunIp (nodes.Get (0), Seconds (0.2), "link show");
   9.241 +          RunIp (nodes.Get (0), Seconds (60.3), "route show table all");
   9.242 +          RunIp (nodes.Get (1), Seconds (60.3), "route show table all");
   9.243 +          RunIp (nodes.Get (0), Seconds (0.4), "addr list");
   9.244 +        }
   9.245 +
   9.246 +      routerPort = "sim0";
   9.247 +    }
   9.248 +  DceSubModuleHelper submod;
   9.249 +  submod.Install (nodes);
   9.250 +
   9.251 +  if (m_debug)
   9.252 +    {
   9.253 +      csma.EnablePcapAll ("dce-submodule-test-" + m_testname + "-" + (m_useKernel ? "kern" : "ns3"));
   9.254 +    }
   9.255 +
   9.256 +  //
   9.257 +  // Step 3
   9.258 +  // Set up test application if you have
   9.259 +  //
   9.260 +
   9.261 +  //
   9.262 +  // Step 4
   9.263 +  // Now It's ready to GO!
   9.264 +  //
   9.265 +  if (m_maxDuration.IsStrictlyPositive ())
   9.266 +    {
   9.267 +      Simulator::Stop (m_maxDuration);
   9.268 +    }
   9.269 +  Simulator::Run ();
   9.270 +  Simulator::Destroy ();
   9.271 +
   9.272 +
   9.273 +  //
   9.274 +  // Step 5
   9.275 +  // Vetify the test
   9.276 +  //
   9.277 +  NS_TEST_ASSERT_MSG_EQ (m_pingStatus, true, "DceSubModule test " << m_testname  << " with " <<
   9.278 +                         (m_useKernel ? "kernel" : "ns3") << " did not return successfully: " << g_testError);
   9.279 +}
   9.280 +
   9.281 +static class DceDceSubModuleTestSuite : public TestSuite
   9.282 +{
   9.283 +public:
   9.284 +  DceDceSubModuleTestSuite ();
   9.285 +private:
   9.286 +} g_processTests;
   9.287 +//
   9.288 +
   9.289 +
   9.290 +DceDceSubModuleTestSuite::DceDceSubModuleTestSuite ()
   9.291 +  : TestSuite ("dce-submodule", UNIT)
   9.292 +{
   9.293 +  typedef struct
   9.294 +  {
   9.295 +    const char *name;
   9.296 +    int duration;
   9.297 +    bool useKernel;
   9.298 +  } testPair;
   9.299 +
   9.300 +  const testPair tests[] = {
   9.301 +    { "test1", 120, false},
   9.302 +    { "test2", 120, false},
   9.303 +  };
   9.304 + 
   9.305 +  for (unsigned int i = 0; i < sizeof(tests) / sizeof(testPair); i++)
   9.306 +    {
   9.307 +      AddTestCase (new DceDceSubModuleTestCase (std::string (tests[i].name),
   9.308 +                                                Seconds (tests[i].duration), tests[i].useKernel,
   9.309 +                                                tests[i].useKernel));
   9.310 +    }
   9.311 +}
   9.312 +
   9.313 +} // namespace ns3
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/waf	Tue Mar 12 12:03:42 2013 +0900
    10.3 @@ -0,0 +1,2 @@
    10.4 +exec "`dirname "$0"`"/../../waf "$@"
    10.5 +
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/wscript	Tue Mar 12 12:03:42 2013 +0900
    11.3 @@ -0,0 +1,66 @@
    11.4 +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
    11.5 +
    11.6 +import os
    11.7 +import Options
    11.8 +import os.path
    11.9 +import ns3waf
   11.10 +import sys
   11.11 +# local modules
   11.12 +
   11.13 +
   11.14 +def options(opt):
   11.15 +    opt.tool_options('compiler_cc') 
   11.16 +    ns3waf.options(opt)
   11.17 +
   11.18 +def configure(conf):
   11.19 +    ns3waf.check_modules(conf, ['core', 'network', 'internet'], mandatory = True)
   11.20 +    ns3waf.check_modules(conf, ['point-to-point', 'tap-bridge', 'netanim'], mandatory = False)
   11.21 +    ns3waf.check_modules(conf, ['wifi', 'point-to-point', 'csma', 'mobility'], mandatory = False)
   11.22 +    ns3waf.check_modules(conf, ['point-to-point-layout'], mandatory = False)
   11.23 +    ns3waf.check_modules(conf, ['topology-read', 'applications', 'visualizer'], mandatory = False)
   11.24 +    conf.check_tool('compiler_cc')
   11.25 +
   11.26 +    conf.env.append_value('CXXFLAGS', '-I/usr/include/python2.6')
   11.27 +    conf.env.append_value('LINKFLAGS', '-pthread')
   11.28 +    conf.check (lib='dl', mandatory = True)
   11.29 +
   11.30 +    conf.env['ENABLE_PYTHON_BINDINGS'] = True
   11.31 +    conf.env['NS3_ENABLED_MODULES'] = []
   11.32 +    ns3waf.print_feature_summary(conf)
   11.33 +
   11.34 +
   11.35 +
   11.36 +def build_dce_tests(module, bld):
   11.37 +    module.add_runner_test(needed=['core', 'dce-submod', 'internet', 'csma'],
   11.38 +                           source=['test/dce-submod-test.cc'])
   11.39 +
   11.40 +def build_dce_examples(module):
   11.41 +    dce_examples = [
   11.42 +                   ]
   11.43 +    for name,lib in dce_examples:
   11.44 +        module.add_example(**dce_kw(target = 'bin/' + name, 
   11.45 +                                    source = ['example/' + name + '.cc'],
   11.46 +                                    lib = lib))
   11.47 +
   11.48 +    module.add_example(needed = ['core', 'internet', 'dce-submod', 'point-to-point'],
   11.49 +                       target='bin/dce-submod-simple',
   11.50 +                       source=['example/dce-submod-simple.cc'])
   11.51 +
   11.52 +def build(bld):
   11.53 +    module_source = [
   11.54 +        'helper/dce-submod-helper.cc',
   11.55 +        ]
   11.56 +    module_headers = [
   11.57 +        'helper/dce-submod-helper.h',
   11.58 +        ]
   11.59 +    module_source = module_source
   11.60 +    module_headers = module_headers
   11.61 +    uselib = ns3waf.modules_uselib(bld, ['core', 'network', 'internet', 'netlink', 'dce'])
   11.62 +    module = ns3waf.create_module(bld, name='dce-submod',
   11.63 +                                  source=module_source,
   11.64 +                                  headers=module_headers,
   11.65 +                                  use=uselib,
   11.66 +                                  lib=['dl'])
   11.67 +
   11.68 +    build_dce_tests(module,bld)
   11.69 +    build_dce_examples(module)