merged ns-3-lena-dev with ns-3-dev

Nicola Baldo 2012-04-11 13:49:33 +02:00
commit 8b4f20d0c9
181 changed files with 15232 additions and 3605 deletions

View File

@ -29,9 +29,6 @@
^doc/manual/figures/.*pdf
^doc/manual/figures/.*png
^src/.*/doc/build
^src/.*/doc/source/figures/.*.eps
^src/.*/doc/source/figures/.*.pdf
^src/.*/doc/source/figures/.*.png
^bindings/python/pybindgen/
ms_print.*
massif.*

View File

@ -41,11 +41,17 @@ This file is a best-effort approach to solving this issue; we will do
our best but can guarantee that there will be things that fall through
the cracks, unfortunately. If you, as a user, can suggest improvements
to this file based on your experience, please contribute a patch or drop
us a note on ns-developers mailing list. </p>
us a note on ns-developers mailing list.</p>
<hr>
<h1>Changes from ns-3.13 to ns-3-dev</h1>
<h2>New API:</h2>
<ul>
<li>The new class AntennaModel provides an API for modeling the radiation pattern of antennas.
</li>
</ul>
<h2>Changes to existing API:</h2>
<ul>
<li> The Ipv6RawSocketImpl "IcmpFilter" attribute has been removed. Six
@ -74,6 +80,19 @@ It now includes the destination IPv6 address of the end point which was
needed for TCP. This lead to a small change in the UDP and ICMPv6 L4
protocols as well.
</li>
<li>
Ipv6RoutingHelper can now print the IPv6 Routing Tables at specific
intervals or time. Exactly like Ipv4RoutingHelper do.
</li>
<li>
New "SendIcmpv6Redirect" attribute (and getter/setter functions) to
Ipv6L3Protocol. The behavior is similar to Linux's conf "send_redirects",
i.e., enable/disable the ICMPv6 Redirect sending.
</li>
<li> The SpectrumPhy abstract class now has a new method
<pre>virtual Ptr&#60;AntennaModel&#62; GetRxAntenna () = 0;</pre>
that all derived classes need to implement in order to integrate properly with the newly added antenna model. In addition, a new member variable "Ptr&#60;AntennaModel&#62; txAntenna" has been added to SpectrumSignalParameters in order to allow derived SpectrumPhy classes to provide information about the antenna model used for the transmission of a waveform.
</li>
</ul>
<h2>Changes to build system:</h2>

View File

@ -24,14 +24,26 @@ New user-visible features
- Dual-stacked IPv6 sockets are implemented. An IPv6 socket can accept an IPv4
connection, returning the senders address as an IPv4-mapped address
(IPV6_V6ONLY socket option is not implemented).
- Ipv6RoutingHelper is now in-line with Ipv4RoutingHelper concerning the RT
print functions. Various minor changes made in Ipv6RoutingProtocol and derived
classes to make this possible.
- New "SendIcmpv6Redirect" attribute (and getter/setter functions) to
Ipv6L3Protocol. The behavior is similar to Linux's conf "send_redirects",
i.e., enable/disable the ICMPv6 Redirect sending.
- An antenna module is now included, which includes different
radiation pattern models. See the corresponding new section of the
ns-3 models library documentation for details.
Bugs fixed
----------
- bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
- bug 1318 - Asserts for IPv6 malformed packets
- bug 1357 - IPv6 fragmentation fails due to checks about malformed extensions
- bug 1378 - UdpEchoClient::SetFill () does not set packet size correctly
- bug 1351 and 1333 - TCP not able to take RTT samples on long delay network
- bug 1362 - ICMPv6 does not forward ICMPs to upper layers (and minor fixes to ICMPv6)
- bug 1395 - AODV DeferredRouteOutputTag missing constructor
Known issues
------------
In general, known issues are tracked on the project tracker available

View File

@ -488,7 +488,7 @@ follows:::
ConfigStore::ConfigStore ()
{
ObjectBase::ConstructSelf (AttributeList ());
ObjectBase::ConstructSelf (AttributeConstructionList ());
// continue on with constructor.
}

View File

@ -239,7 +239,7 @@ Here is an example of the usage::
class A
{
public:
A (int ao) : a (a0) {}
A (int a0) : a (a0) {}
int Hello (int b0)
{
std::cout << "Hello from A, a = " << a << " b0 = " << b0 << std::endl;

View File

@ -200,6 +200,7 @@ IMAGES_EPS = \
# rescale pdf figures as necessary
$(FIGURES)/testbed.pdf_width = 5in
$(FIGURES)/emulated-channel.pdf_width = 6in
$(FIGURES)/antenna-coordinate-system.pdf_width = 7cm
$(FIGURES)/node.pdf_width = 5in
$(FIGURES)/packet.pdf_width = 4in
$(FIGURES)/buffer.pdf_width = 15cm

150
doc/tutorial-pt-br/Makefile Normal file
View File

@ -0,0 +1,150 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# Additional variables for figures, not sphinx default:
DIA = dia
EPSTOPDF = epstopdf
FIGURES = source/figures
IMAGES_EPS = \
IMAGES_PNG = ${IMAGES_EPS:.eps=.png}
IMAGES_PDF = ${IMAGES_EPS:.eps=.pdf}
IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF)
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
%.eps : %.dia; $(DIA) -t eps $< -e $@
%.png : %.dia; $(DIA) -t png $< -e $@
%.pdf : %.eps; $(EPSTOPDF) $< -o=$@
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
frag: pickle
@if test ! -d $(BUILDDIR)/frag; then mkdir $(BUILDDIR)/frag; fi
pushd $(BUILDDIR)/frag && ../../pickle-to-xml.py ../pickle/index.fpickle > navigation.xml && popd
cp -r $(BUILDDIR)/pickle/_images $(BUILDDIR)/frag
html: $(IMAGES)
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml: $(IMAGES)
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml: $(IMAGES)
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle: $(IMAGES)
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json: $(IMAGES)
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp: $(IMAGES)
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp: $(IMAGES)
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ns-3.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ns-3.qhc"
devhelp: $(IMAGES)
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/ns-3"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ns-3"
@echo "# devhelp"
epub: $(IMAGES)
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex: $(IMAGES)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf: $(IMAGES)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text: $(IMAGES)
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man: $(IMAGES)
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
changes: $(IMAGES)
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck: $(IMAGEs)
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest: $(IMAGES)
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

View File

@ -0,0 +1,18 @@
Please write image files in a vector graphics format, when possible, and
generate the .png and .pdf versions on the fly (see ../Makefile).
The currently supported tool is dia. xfig could be added similarly
if someone wants to add it. The main requirement for adding another format
is that the tool to edit it is freely available and that a cron script can
autogenerate the pdf and png from the figure source. Tgif (.obj) files
were once used but the file conversions require a valid X display to
be running, and are therefore to be avoided since our code server
does not run such a server. Tgif pdf conversions were also cumbersome.
Store the .dia versions in mercurial, but not the .png or .pdfs.
If the figure is not available in a vector graphics format, store both
a .png and a .pdf version in this directory.
If you add a source (.dia) file here, remember to add it to
the list of figure sources in the Makefile in the directory above

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,42 @@
#!/usr/bin/python
# output xml format:
# <pages>
# <page url="xx"><prev url="yyy">zzz</prev><next url="hhh">lll</next><fragment>file.frag</fragment></page>
# ...
# </pages>
import pickle
import os
import codecs
def dump_pickles(out, dirname, filename, path):
f = open(os.path.join(dirname, filename), 'r')
data = pickle.load(f)
fragment_file = codecs.open(data['current_page_name'] + '.frag', mode='w', encoding='utf-8')
fragment_file.write(data['body'])
fragment_file.close()
out.write(' <page url="%s">\n' % path)
out.write(' <fragment>%s.frag</fragment>\n' % data['current_page_name'])
if data['prev'] is not None:
out.write(' <prev url="%s">%s</prev>\n' %
(os.path.normpath(os.path.join(path, data['prev']['link'])),
data['prev']['title']))
if data['next'] is not None:
out.write(' <next url="%s">%s</next>\n' %
(os.path.normpath(os.path.join(path, data['next']['link'])),
data['next']['title']))
out.write(' </page>\n')
f.close()
if data['next'] is not None:
next_path = os.path.normpath(os.path.join(path, data['next']['link']))
next_filename = os.path.basename(next_path) + '.fpickle'
dump_pickles(out, dirname, next_filename, next_path)
return
import sys
sys.stdout.write('<pages>\n')
dump_pickles(sys.stdout, os.path.dirname(sys.argv[1]), os.path.basename(sys.argv[1]), '/')
sys.stdout.write('</pages>')

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,89 @@
.. include:: replace.txt
..
========================================================================================
Translated for portuguese by the students of the inter-institutional doctorate program of IME-USP/UTFPR-CM.
Traduzido para o português pelos alunos do programa de doutorado inter institucional do Instituto de Matemática e Estatística da Universidade de São Paulo --- IME-USP em parceria com a Universidade Tecnológica Federal do Paraná - Campus Campo Mourão --- UTFPR-CM:
* Frank Helbert (frank@ime.usp.br);
* Luiz Arthur Feitosa dos Santos (luizsan@ime.usp.br);
* Rodrigo Campiolo (campiolo@ime.usp.br).
========================================================================================
.. Conclusion
Conclusão
---------
.. Futures
Para o futuro
*************
..
This document is a work in process. We hope and expect it to grow over time
to cover more and more of the nuts and bolts of |ns3|.
Este documento é um trabalho em andamento. Espera-se que cresça com o tempo e cubra mais e mais funcionalidades do |ns3|.
..
We hope to add the following chapters over the next few releases:
Para as próximas versões, os seguintes capítulos são esperados:
..
* The Callback System
* The Object System and Memory Management
* The Routing System
* Adding a New NetDevice and Channel
* Adding a New Protocol
* Working with Real Networks and Hosts
* O sistema de `callback`
* O sistema de objetos e o gerenciamento de memória
* O sistema de roteamento
* Adicionando novos dispositivos de rede e canais de comunicação
* Adicionando novos protocolos
* Trabalhando com redes e `hosts` reais
..
Writing manual and tutorial chapters is not something we all get excited about,
but it is very important to the project. If you are an expert in one of these
areas, please consider contributing to |ns3| by providing one of these
chapters; or any other chapter you may think is important.
Escrever capítulos de manuais e tutoriais não é fácil, mas é muito importante para o projeto. Se você, leitor, é especialista em uma dessas áreas, por favor, considere contribuir com o |ns3| escrevendo um desses capítulos; ou com qualquer outro capítulo que julgue importante.
.. Closing
Finalizando
***********
..
|ns3| is a large and complicated system. It is impossible to cover all
of the things you will need to know in one small tutorial.
O |ns3| é um sistema grande e muito complexo. Por isto, é impossível cobrir todos os aspectos relevantes em um tutorial.
..
We have really just scratched the surface of |ns3| in this tutorial,
but we hope to have covered enough to get you started doing useful networking
research using our favorite simulator.
Ao leitor foi apresentada apenas uma introdução ao |ns3|, entretanto, espera-se que tenha abordado o suficiente para o início de trabalhos e pesquisas relevantes com o simulador.
.. -- The |ns3| development team.
-- Atenciosamente, equipe de desenvolvimento do |ns3|.
**Tradução**
*Traduzido para o português pelos alunos do programa de doutorado inter institucional do Instituto de Matemática e Estatística da Universidade de São Paulo --- IME-USP em parceria com a Universidade Tecnológica Federal do Paraná - Câmpus Campo Mourão --- UTFPR-CM:*
* Frank Helbert (frank@ime.usp.br);
* Luiz Arthur Feitosa dos Santos (luizsan@ime.usp.br);
* Rodrigo Campiolo (campiolo@ime.usp.br).

View File

@ -0,0 +1,218 @@
# -*- coding: utf-8 -*-
#
# ns-3 documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 14 09:00:39 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.pngmath']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
source_encoding = 'latin1'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'ns-3'
copyright = u'2008-11, ns-3 project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = 'ns-3-dev'
# The full version, including alpha/beta/rc tags.
release = 'ns-3-dev'
# The language for content autogenerated by . Refer to babel documentation
# for a list of supported languages.
language = 'pt-br'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'ns-3doc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'ns-3-tutorial.tex', u'ns-3 Tutorial',
u'ns-3 project', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'ns-3-tutorial', u'ns-3 Tutorial',
[u'ns-3 project'], 1)
]

View File

@ -0,0 +1,746 @@
.. include:: replace.txt
..
========================================================================================
Translated for portuguese by the students of the inter-institutional doctorate program of IME-USP/UTFPR-CM.
Traduzido para o português pelos alunos do programa de doutorado inter institucional do Instituto de Matemática e Estatística da Universidade de São Paulo --- IME-USP em parceria com a Universidade Tecnológica Federal do Paraná - Campus Campo Mourão --- UTFPR-CM:
* Frank Helbert (frank@ime.usp.br);
* Luiz Arthur Feitosa dos Santos (luizsan@ime.usp.br);
* Rodrigo Campiolo (campiolo@ime.usp.br).
========================================================================================
.. Getting Started
Iniciando
---------------
.. Downloading ns-3
Baixando o ns-3
****************
..
The |ns3| system as a whole is a fairly complex system and has a
number of dependencies on other components. Along with the systems you will
most likely deal with every day (the GNU toolchain, Mercurial, you programmer
editor) you will need to ensure that a number of additional libraries are
present on your system before proceeding. |ns3| provides a wiki
for your reading pleasure that includes pages with many useful hints and tips.
One such page is the "Installation" page,
http://www.nsnam.org/wiki/index.php/Installation.
O |ns3|, como um todo, é bastante complexo e possui várias dependências. Isto também é verdade para as ferramentas que fornecem suporte ao |ns3| (exemplos, `"GNU toolchain"`, Mercurial e um editor para a programação), desta forma é necessário assegurar que várias bibliotecas estejam presentes no sistema. O |ns3| fornece um Wiki com várias dicas sobre o sistema. Uma das páginas do Wiki é a página de instalação (`"Installation"`) que está disponível em: http://www.nsnam.org/wiki/index.php/Installation.
..
The "Prerequisites" section of this wiki page explains which packages are
required to support common |ns3| options, and also provides the
commands used to install them for common Linux variants. Cygwin users will
have to use the Cygwin installer (if you are a Cygwin user, you used it to
install Cygwin).
A seção de pré-requisitos (`"Prerequisites"`) do Wiki explica quais pacotes são necessários para a instalação básica do |ns3| e também fornece os comandos usados para a instalação nas variantes mais comuns do Linux. Os usuários do Cygwin devem utilizar o ``Cygwin installer``.
..
You may want to take this opportunity to explore the |ns3| wiki
a bit since there really is a wealth of information there.
Seria interessante explorar um pouco o Wiki, pois lá existe uma grande variedade de informações.
..
From this point forward, we are going to assume that the reader is working in
Linux or a Linux emulation environment (Linux, Cygwin, etc.) and has the GNU
toolchain installed and verified along with the prerequisites mentioned
above. We are also going to assume that you have Mercurial and Waf installed
and running on the target system.
A partir deste ponto considera-se que o leitor está trabalhando com Linux ou em um ambiente que o emule (Linux, Cygwin, etc), que tenha o `"GNU toolchain"` instalado, bem como os pré-requisitos mencionados anteriormente. Também assume-se que o leitor tenha o Mercurial e o Waf instalados e funcionando em seu sistema.
..
The |ns3| code is available in Mercurial repositories on the server
http://code.nsnam.org. You can also download a tarball release at
http://www.nsnam.org/releases/, or you can work with repositories
using Mercurial. We recommend using Mercurial unless there's a good reason
not to. See the end of this section for instructions on how to get a tarball
release.
Os códigos fonte do |ns3| estão disponíveis através dos repositórios do Mercurial no servidor http://code.nsnam.org. Os fontes compactados podem ser obtidos em http://www.nsnam.org/releases/. No final desta seção há instruções de como obter uma versão compactada. No entanto, a não ser que se tenha uma boa razão, recomenda-se o uso do Mercurial para acesso ao código.
..
The simplest way to get started using Mercurial repositories is to use the
``ns-3-allinone`` environment. This is a set of scripts that manages the
downloading and building of various subsystems of |ns3| for you. We
recommend that you begin your |ns3| adventures in this environment
as it can really simplify your life at this point.
A maneira mais simples de iniciar com o Mercurial é usando o ambiente ``ns-3-allinone``. Trata-se de um conjunto de `scripts` que gerencia o baixar e o construir de vários sub-sistemas do |ns3|. Recomenda-se que os pouco experientes iniciem sua aventura neste ambiente, pois irá realmente facilitar a jornada.
.. Downloading ns-3 Using Mercurial
Obtendo o ns-3 usando o Mercurial
++++++++++++++++++++++++++++++++++
..
One practice is to create a directory called ``repos`` in one's home
directory under which one can keep local Mercurial repositories.
*Hint: we will assume you do this later in the tutorial.* If you adopt
that approach, you can get a copy of ``ns-3-allinone`` by typing the
following into your Linux shell (assuming you have installed Mercurial):
Para iniciar, uma boa prática é criar um diretório chamado ``repos`` no diretório `home` sobre o qual será mantido o repositório local do Mercurial. *Dica: iremos assumir que o leitor fez isto no restante deste tutorial, então é bom executar este passo!* Se o leitor adotar esta abordagem é possível obter a cópia do ``ns-3-allinone`` executando os comandos a seguir no `shell` Linux (assumindo que o Mercurial está instalado):
::
cd
mkdir repos
cd repos
hg clone http://code.nsnam.org/ns-3-allinone
..
As the hg (Mercurial) command executes, you should see something like the
following displayed,
Quando executarmos o comando `hg` (Mercurial), teremos como saída algo como:
::
destination directory: ns-3-allinone
requesting all changes
adding changesets
adding manifests
adding file changes
added 31 changesets with 45 changes to 7 files
7 files updated, 0 files merged, 0 files removed, 0 files unresolved
..
After the clone command completes, you should have a directory called
``ns-3-allinone`` under your ``~/repos`` directory, the contents of which should
look something like the following:
Depois que o comando `clone` for executado com sucesso, teremos um diretório chamado ``ns-3-allinone`` dentro do diretório ``~/repos``. O conteúdo deste diretório deve ser algo como:
::
build.py* constants.py dist.py* download.py* README util.py
..
Notice that you really just downloaded some Python scripts. The next step
will be to use those scripts to download and build the |ns3|
distribution of your choice.
Até agora foram baixados alguns `scripts` em Python. O próximo passo será usar estes `scripts` para baixar e construir a distribuição |ns3| de sua escolha.
..
If you go to the following link: http://code.nsnam.org/,
you will see a number of repositories. Many are the private repositories of
the |ns3| development team. The repositories of interest to you will
be prefixed with "ns-3". Official releases of |ns3| will be
numbered as ``ns-3.<release>.<hotfix>``. For example, a second hotfix to a
still hypothetical release forty two of |ns3| would be numbered as
``ns-3.42.2``.
Acessando o endereço: http://code.nsnam.org/, observa-se vários repositórios. Alguns são privados à equipe de desenvolvimento do |ns3|. Os repositórios de interesse ao leitor estarão prefixados com "ns-3". As `releases` oficiais do |ns3| estarão enumeradas da seguinte forma: ``ns-3.<release>.<hotfix>``. Por exemplo, uma segunda atualização de pequeno porte (`hotfix`) de uma hipotética `release` 42, seria enumerada da seguinte maneira: ``ns-3.42.2``.
..
The current development snapshot (unreleased) of |ns3| may be found
at http://code.nsnam.org/ns-3-dev/. The
developers attempt to keep these repository in consistent, working states but
they are in a development area with unreleased code present, so you may want
to consider staying with an official release if you do not need newly-
introduced features.
A versão em desenvolvimento (que ainda não é uma `release` oficial) pode ser encontrada em http://code.nsnam.org/ns-3-dev/. Os desenvolvedores tentam manter este repositório em um estado consistente, mas podem existir códigos instáveis. Recomenda-se o uso de uma `release` oficial, a não ser que se necessite das novas funcionalidades introduzidas.
..
Since the release numbers are going to be changing, I will stick with
the more constant ns-3-dev here in the tutorial, but you can replace the
string "ns-3-dev" with your choice of release (e.g., ns-3.10) in the
text below. You can find the latest version of the
code either by inspection of the repository list or by going to the
`"ns-3 Releases"
<http://www.nsnam.org/releases>`_
web page and clicking on the latest release link.
Uma vez que o número das versões fica mudando constantemente, neste tutorial será utilizada a versão ns-3-dev, mas o leitor pode escolher outra (por exemplo, ns-3.10). A última versão pode ser encontrada inspecionando a lista de repositórios ou acessando a página `"ns-3 Releases" <http://www.nsnam.org/releases>`_ e clicando em `latest release`.
..
Go ahead and change into the ``ns-3-allinone`` directory you created when
you cloned that repository. We are now going to use the ``download.py``
script to pull down the various pieces of |ns3| you will be using.
Entre no diretório ``ns-3-allinone`` criado anteriormente. O arquivo ``download.py`` será usado para baixar as várias partes do |ns3| que serão utilizadas.
..
Go ahead and type the following into your shell (remember you can substitute
the name of your chosen release number instead of ``ns-3-dev`` -- like
``"ns-3.10"`` if you want to work with a
stable release).
Execute os seguintes comandos no `shell` (lembre-se de substituir o número da versão no lugar de ``ns-3-dev`` pela que escolheu, por exemplo, se você optou por usar a décima `release` estável, então deve usar o nome ``"ns-3.10"``).
::
./download.py -n ns-3-dev
..
Note that the default for the ``-n`` option is ``ns-3-dev`` and so the
above is actually redundant. We provide this example to illustrate how to
specify alternate repositories. In order to download ``ns-3-dev`` you
can actually use the defaults and simply type,
O ``ns-3-dev`` é o padrão quando usamos a opção ``-n``, assim o comando poderia ser ``./download.py -n``. O exemplo redundante é apenas para ilustra como especificar repositórios alternativos. Um comando mais simples para obter o ``ns-3-dev`` seria:
::
./download.py
..
As the hg (Mercurial) command executes, you should see something like the
following,
Com o comando `hg` (Mercurial) em execução devemos ver a seguinte saída:
::
#
# Get NS-3
#
Cloning ns-3 branch
=> hg clone http://code.nsnam.org/ns-3-dev ns-3-dev
requesting all changes
adding changesets
adding manifests
adding file changes
added 4634 changesets with 16500 changes to 1762 files
870 files updated, 0 files merged, 0 files removed, 0 files unresolved
..
This is output by the download script as it fetches the actual ``ns-3``
code from the repository.
Esta é a saída do `script` de download obtendo o código atual do repositório ``ns-3``.
..
The download script is smart enough to know that on some platforms various
pieces of ns-3 are not supported. On your platform you may not see some
of these pieces come down. However, on most platforms, the process should
continue with something like,
O `script` de download reconhece que partes do ns-3 não são suportadas na plataforma. Dependendo do sistema, pode ser que a saída não seja exatamente como a mostrada a seguir. Porém, a maioria dos sistemas apresentarão algo como:
::
#
# Get PyBindGen
#
Required pybindgen version: 0.10.0.640
Trying to fetch pybindgen; this will fail if no network connection is available.
Hit Ctrl-C to skip.
=> bzr checkout -rrevno:640 https://launchpad.net/pybindgen pybindgen
Fetch was successful.
..
This was the download script getting the Python bindings generator for you.
Note that you will need bazaar (bzr), a version control system, to download
PyBindGen. Next you should see (modulo platform variations) something along
the lines of,
Este é o `script` de download obtendo um gerador de `bindings` Python --- um `binding` é literalmente a ligação ou ponte entre dois sistemas, chamaremos aqui de extensões Python. Também será necessário o Bazaar (brz) para baixar o PyBindGen. O Bazaar é um sistema de controle de versões. Em seguida, o leitor deve ver (com algumas variações devido as plataformas) algo parecido com as seguintes linhas:
::
#
# Get NSC
#
Required NSC version: nsc-0.5.0
Retrieving nsc from https://secure.wand.net.nz/mercurial/nsc
=> hg clone https://secure.wand.net.nz/mercurial/nsc nsc
requesting all changes
adding changesets
adding manifests
adding file changes
added 273 changesets with 17565 changes to 15175 files
10622 files updated, 0 files merged, 0 files removed, 0 files unresolved
..
This part of the process is the script downloading the Network Simulation
Cradle for you. Note that NSC is not supported on OSX or Cygwin and works
best with gcc-3.4 or gcc-4.2 or greater series.
Neste momento, o `script` de download baixa o `Network Simulation Cradle` - NSC. Note que o NSC não é suportado no OSX ou Cygwin e trabalha melhor com o gcc-3.4, gcc-4.2 ou superiores.
..
After the download.py script completes, you should have several new directories
under ``~/repos/ns-3-allinone``:
Depois que o `script` ``download.py`` tiver completado sua tarefa, veremos vários diretórios novos dentro de ``~/repos/ns-3-allinone``:
::
build.py* constants.pyc download.py* nsc/ README util.pyc
constants.py dist.py* ns-3-dev/ pybindgen/ util.py
..
Go ahead and change into ``ns-3-dev`` under your ``~/repos/ns-3-allinone``
directory. You should see something like the following there:
Por fim, no diretório ``ns-3-dev`` que está dentro do diretório ``~/repos/ns-3-allinone`` deve existir, depois dos passos anteriores, o seguinte conteúdo:
::
AUTHORS doc ns3 scratch testpy.supp VERSION waf-tools
bindings examples README src utils waf* wscript
CHANGES.html LICENSE RELEASE_NOTES test.py* utils.py waf.bat* wutils.py
..
You are now ready to build the |ns3| distribution.
Agora está tudo pronto para a construção da distribuição do |ns3|.
.. Downloading ns-3 Using a Tarball
Obtendo o ns-3 compactado (`Tarball`)
+++++++++++++++++++++++++++++++++++++++
..
The process for downloading |ns3| via tarball is simpler than the
Mercurial process since all of the pieces are pre-packaged for you. You just
have to pick a release, download it and decompress it.
O processo de download do |ns3| compactado é mais simples do que o processo usando o Mercurial, porque tudo que precisamos já vem empacotado. Basta escolher a versão, baixá-la e extraí-la.
..
As mentioned above, one practice is to create a directory called ``repos``
in one's home directory under which one can keep local Mercurial repositories.
One could also keep a ``tarballs`` directory. *Hint: the tutorial
will assume you downloaded into a ``repos`` directory, so remember the
placekeeper.``* If you adopt the ``tarballs`` directory approach, you can
get a copy of a release by typing the following into your Linux shell
(substitute the appropriate version numbers, of course):
Como mencionado anteriormente, uma boa prática é criar um diretório chamado ``repos`` no diretório `home` para manter a cópia local dos repositórios do Mercurial. Da mesma forma, pode-se manter também um diretório chamado ``tarballs`` para manter as versões obtidas via arquivo compactado. *Dica: o tutorial irá assumir que o download foi feito dentro do diretório ``repos``*. Se a opção for pelo método do arquivo compactado, pode-se obter a cópia de uma versão digitando os seguintes comandos no `shell` Linux (obviamente, substitua os números de versões do comando para o valor apropriado):
::
cd
mkdir tarballs
cd tarballs
wget http://www.nsnam.org/releases/ns-allinone-3.10.tar.bz2
tar xjf ns-allinone-3.10.tar.bz2
..
If you change into the directory ``ns-allinone-3.10`` you should see a
number of files:
Dentro do diretório ``ns-allinone-3.10`` extraído, deverá haver algo como:
::
build.py ns-3.10/ pybindgen-0.15.0/ util.py
constants.py nsc-0.5.2/ README
..
You are now ready to build the |ns3| distribution.
Agora está tudo pronto para a construção da distribuição do |ns3|.
.. Building ns-3
Construindo o ns-3
******************
.. Building with build.py
Construindo com o ``build.py``
++++++++++++++++++++++++++++++
..
The first time you build the |ns3| project you should build using the
``allinone`` environment. This will get the project configured for you
in the most commonly useful way.
A primeira construção do |ns3| deve ser feita usando o ambiente ``allinone``. Isto fará com que o projeto seja configurado da maneira mais funcional.
..
Change into the directory you created in the download section above. If you
downloaded using Mercurial you should have a directory called
``ns-3-allinone`` under your ``~/repos`` directory. If you downloaded
using a tarball you should have a directory called something like
``ns-allinone-3.10`` under your ``~/tarballs`` directory. Take a deep
breath and type the following:
Entre no diretório criado na seção "Obtendo o ns-3". Se o Mercurial foi utilizado, então haverá um diretório chamado ``ns-3-allinone`` localizado dentro de ``~/repos``. Se foi utilizado o arquivo compactado, haverá um diretório chamado ``ns-allinone-3.10`` dentro do diretório ``~/tarballs``. Lembre-se de adequar os nomes conforme os arquivos obtidos e diretórios criados. Agora, digite o seguinte comando:
::
./build.py --enable-examples --enable-tests
..
Because we are working with examples and tests in this tutorial, and
because they are not built by default in |ns3|, the arguments for
build.py tells it to build them for us. In the future you can build
|ns3| without examples and tests if you wish.
Foram utilizadas as opções ``--enable-examples`` e ``--enable-tests`` pois o tutorial irá trabalhar com exemplos e testes, e, por padrão, eles não são construídos. Futuramente, o leitor poderá construir sem estas opções.
..
You will see lots of typical compiler output messages displayed as the build
script builds the various pieces you downloaded. Eventually you should see the
following magic words:
Serão exibidas muitas saídas típicas de um compilador conforme o código é construído. Finalmente, no final do processo, deverá aparecer uma saída como esta:
::
Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone/ns-3-dev/build'
'build' finished successfully (2m30.586s)
Modules built:
aodv applications bridge
click config-store core
csma csma-layout dsdv
emu energy flow-monitor
internet lte mesh
mobility mpi netanim
network nix-vector-routing ns3tcp
ns3wifi olsr openflow
point-to-point point-to-point-layout propagation
spectrum stats tap-bridge
template test tools
topology-read uan virtual-net-device
visualizer wifi wimax
..
Once the project has built you can say goodbye to your old friends, the
``ns-3-allinone`` scripts. You got what you needed from them and will now
interact directly with Waf and we do it in the ``ns-3-dev`` directory,
not in the ``ns-3-allinone`` directory. Go ahead and change into the
``ns-3-dev`` directory (or the directory for the appropriate release you
downloaded.
Uma vez que o projeto foi construído, pode-se deixar de lado os `scripts` ``ns-3-allinone``. O leitor já obteve o que precisava e agora irá interagir diretamente com o Waf no diretório ``ns-3-dev``. Mude para o diretório ``ns-3-dev`` (ou para o diretório apropriado de sua versão).
::
cd ns-3-dev
.. Building with Waf
Construindo com o Waf
+++++++++++++++++++++
..
We use Waf to configure and build the |ns3| project. It's not
strictly required at this point, but it will be valuable to take a slight
detour and look at how to make changes to the configuration of the project.
Probably the most useful configuration change you can make will be to
build the optimized version of the code. By default you have configured
your project to build the debug version. Let's tell the project to
make an optimized build. To explain to Waf that it should do optimized
builds that include the examples and tests, you will need to execute the
following command,
O Waf é utilizado para configurar e construir o projeto do |ns3|. Não é estritamente necessário neste ponto, mas será valioso quando se forem necessárias alterações nas configurações do projeto. Provavelmente a mudança mais útil que será feita futuramente é a construção de uma versão do código otimizado. Por padrão, o projeto é construído com a opção de depuração (`debug`), para verificação de erros. Então, para construir um projeto otimizado, deve-se executar o seguinte comando (ainda com suporte a testes e exemplos):
::
./waf -d optimized --enable-examples --enable-tests configure
..
This runs Waf out of the local directory (which is provided as a convenience
for you). As the build system checks for various dependencies you should see
output that looks similar to the following,
Isto executa o Waf fora do diretório local (o que é bem conveniente). Como o sistema em construção verifica várias dependências, deverá aparecer uma saída similar com a que segue:
::
Checking for program g++ : ok /usr/bin/g++
Checking for program cpp : ok /usr/bin/cpp
Checking for program ar : ok /usr/bin/ar
Checking for program ranlib : ok /usr/bin/ranlib
Checking for g++ : ok
Checking for program pkg-config : ok /usr/bin/pkg-config
Checking for -Wno-error=deprecated-declarations support : yes
Checking for -Wl,--soname=foo support : yes
Checking for header stdlib.h : ok
Checking for header signal.h : ok
Checking for header pthread.h : ok
Checking for high precision time implementation : 128-bit integer
Checking for header stdint.h : ok
Checking for header inttypes.h : ok
Checking for header sys/inttypes.h : not found
Checking for library rt : ok
Checking for header netpacket/packet.h : ok
Checking for pkg-config flags for GSL : ok
Checking for header linux/if_tun.h : ok
Checking for pkg-config flags for GTK_CONFIG_STORE : ok
Checking for pkg-config flags for LIBXML2 : ok
Checking for library sqlite3 : ok
Checking for NSC location : ok ../nsc (guessed)
Checking for library dl : ok
Checking for NSC supported architecture x86_64 : ok
Checking for program python : ok /usr/bin/python
Checking for Python version >= 2.3 : ok 2.5.2
Checking for library python2.5 : ok
Checking for program python2.5-config : ok /usr/bin/python2.5-config
Checking for header Python.h : ok
Checking for -fvisibility=hidden support : yes
Checking for pybindgen location : ok ../pybindgen (guessed)
Checking for Python module pybindgen : ok
Checking for pybindgen version : ok 0.10.0.640
Checking for Python module pygccxml : ok
Checking for pygccxml version : ok 0.9.5
Checking for program gccxml : ok /usr/local/bin/gccxml
Checking for gccxml version : ok 0.9.0
Checking for program sudo : ok /usr/bin/sudo
Checking for program hg : ok /usr/bin/hg
Checking for program valgrind : ok /usr/bin/valgrind
---- Summary of optional NS-3 features:
Threading Primitives : enabled
Real Time Simulator : enabled
Emulated Net Device : enabled
GNU Scientific Library (GSL) : enabled
Tap Bridge : enabled
GtkConfigStore : enabled
XmlIo : enabled
SQlite stats data output : enabled
Network Simulation Cradle : enabled
Python Bindings : enabled
Python API Scanning Support : enabled
Use sudo to set suid bit : not enabled (option --enable-sudo not selected)
Build tests : enabled
Build examples : enabled
Static build : not enabled (option --enable-static not selected)
'configure' finished successfully (2.870s)
..
Note the last part of the above output. Some ns-3 options are not enabled by
default or require support from the underlying system to work properly.
For instance, to enable XmlTo, the library libxml-2.0 must be found on the
system. If this library were not found, the corresponding |ns3| feature
would not be enabled and a message would be displayed. Note further that there is
a feature to use the program ``sudo`` to set the suid bit of certain programs.
This is not enabled by default and so this feature is reported as "not enabled."
Repare a última parte da saída. Algumas opções do ns-3 não estão habilitadas por padrão ou necessitam de algum suporte do sistema para funcionar corretamente. Por exemplo, para habilitar XmlTo, a biblioteca libxml-2.0 deve estar presente no sistema. Se a biblioteca não estiver instalada esta funcionalidade não é habilitada no |ns3| e uma mensagem é apresentada. Note também que existe uma funcionalidade que utiliza o Sudo para configurar o `suid` de certos programas. Isto não está habilitado por padrão, então esta funcionalidade é reportada como não habilitada (``not enabled``).
..
Now go ahead and switch back to the debug build that includes the examples and tests.
Vamos configurar uma construção do |ns3| com suporte a depuração, bem como, vamos incluir exemplos e testes. Para isto devemos executar:
::
./waf -d debug --enable-examples --enable-tests configure
..
The build system is now configured and you can build the debug versions of
the |ns3| programs by simply typing,
Pronto o sistema está configurado, agora podemos construir nossa versão digitando:
::
./waf
..
Some waf commands are meaningful during the build phase and some commands are valid
in the configuration phase. For example, if you wanted to use the emulation
features of |ns3|, you might want to enable setting the suid bit using
sudo as described above. This turns out to be a configuration-time command, and so
you could reconfigure using the following command that also includes the examples and tests
Alguns comandos do Waf são válidos apenas na fase de construção e outros são válidos na fase de configuração do sistema. Por exemplo, se o leitor espera usar características de emulação do |ns3|, deve habilitar o `suid` usando o Sudo como descrito anteriormente, isto na fase de configuração. O comando utilizado, incluindo exemplos e testes, será:
::
./waf -d debug --enable-sudo --enable-examples --enable-tests configure
..
If you do this, waf will have run sudo to change the socket creator programs of the
emulation code to run as root. There are many other configure- and build-time options
available in waf. To explore these options, type:
Com esta configuração, o Waf executará o Sudo para alterar programas que criam soquetes para executar o código de emulação como `root`. Existem várias outras opções de configuração e construção disponíveis no Waf. Para explorar estas opções, digite:
::
./waf --help
..
We'll use some of the testing-related commands in the next section.
Alguns comandos de teste serão utilizados na próxima seção.
..
Okay, sorry, I made you build the |ns3| part of the system twice,
but now you know how to change the configuration and build optimized code.
Como pôde ser notado, a construção do |ns3| foi feita duas vezes. Isto para que o leitor saiba como trocar a configuração para construir código otimizado no futuro.
.. Testing ns-3
Testando o ns-3
***************
..
You can run the unit tests of the |ns3| distribution by running the
"./test.py -c core" script,
Para executar os testes de unidade do |ns3|, basta chamar o arquivo ``./test.py`` da seguinte forma:
::
./test.py -c core
..
These tests are run in parallel by waf. You should eventually
see a report saying that,
Estes testes são executados em paralelo pelo Waf. No final, uma mensagem como a que segue deve aparecer.
::
47 of 47 tests passed (47 passed, 0 failed, 0 crashed, 0 valgrind errors)
..
This is the important message.
Esta é uma mensagem importante.
..
You will also see output from the test runner and the output will actually look something like,
Também haverá saídas da execução do teste e estas geralmente são algo como:
::
Waf: Entering directory `/home/craigdo/repos/ns-3-allinone/ns-3-dev/build'
Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone/ns-3-dev/build'
'build' finished successfully (1.799s)
Modules built:
aodv applications bridge
click config-store core
csma csma-layout dsdv
emu energy flow-monitor
internet lte mesh
mobility mpi netanim
network nix-vector-routing ns3tcp
ns3wifi olsr openflow
point-to-point point-to-point-layout propagation
spectrum stats tap-bridge
template test tools
topology-read uan virtual-net-device
visualizer wifi wimax
PASS: TestSuite ns3-wifi-interference
PASS: TestSuite histogram
PASS: TestSuite sample
PASS: TestSuite ipv4-address-helper
PASS: TestSuite devices-wifi
PASS: TestSuite propagation-loss-model
...
PASS: TestSuite attributes
PASS: TestSuite config
PASS: TestSuite global-value
PASS: TestSuite command-line
PASS: TestSuite basic-random-number
PASS: TestSuite object
PASS: TestSuite random-number-generators
95 of 95 tests passed (95 passed, 0 failed, 0 crashed, 0 valgrind errors)
..
This command is typically run by ``users`` to quickly verify that an
|ns3| distribution has built correctly.
Este comando é normalmente executado pelos usuários para verificar se o |ns3| foi construído corretamente.
.. Running a Script
Executando um código (`Script`)
*******************************
..
We typically run scripts under the control of Waf. This allows the build
system to ensure that the shared library paths are set correctly and that
the libraries are available at run time. To run a program, simply use the
``--run`` option in Waf. Let's run the |ns3| equivalent of the
ubiquitous hello world program by typing the following:
Os códigos normalmente são executados sob o controle do Waf. Isto assegura que os caminhos das bibliotecas compartilhadas estejam corretas e que estarão disponíveis em tempo de execução. Para executar um programa, basta usar a opção ``--run`` no Waf. Para executar um equivalente ao "Olá mundo" (`Hello world`) no |ns3|, utilizamos o comando:
::
./waf --run hello-simulator
..
Waf first checks to make sure that the program is built correctly and
executes a build if required. Waf then executes the program, which
produces the following output.
O Waf primeiro verifica se o programa foi construído corretamente e se necessário, o constrói. Então executa o programa, que fornece a seguinte saída:
::
Hello Simulator
..
*Congratulations. You are now an ns-3 user.*
*Parabéns. Você agora é um usuário ns-3*
..
*What do I do if I don't see the output?*
*O que fazer se o comando não gerar uma saída?*
..
If you see ``waf`` messages indicating that the build was
completed successfully, but do not see the "Hello Simulator" output,
chances are that you have switched your build mode to "optimized" in
the "Building with Waf" section, but have missed the change back to
"debug" mode. All of the console output used in this tutorial uses a
special |ns3| logging component that is useful for printing
user messages to the console. Output from this component is
automatically disabled when you compile optimized code -- it is
"optimized out." If you don't see the "Hello Simulator" output,
type the following,
Se a mensagem ``Hello Simulator`` não aparece, mas o Waf gera saídas indicando que a construção do sistema foi executada com sucesso, é possível que o leitor tenha trocado o sistema para o modo otimizado na seção `Construindo com o Waf`, e tenha esquecido de voltar ao modo de depuração. Todas as saídas utilizadas neste tutorial são feitas com um componente especial de registro (`logging`) do |ns3| que é muito útil para mostrar mensagens na tela. As saídas deste componente são automaticamente desabilitadas quando o código é contruído na forma otimizada. Para produzir as saídas, digite o seguinte comando,
::
./waf -d debug --enable-examples --enable-tests configure
..
to tell ``waf`` to build the debug versions of the |ns3|
programs that includes the examples and tests. You must still build
the actual debug version of the code by typing,
para dizer ao Waf para construir o |ns3| com a versão de depuração e incluir exemplos e testes. Ainda é necessário digitar o seguinte comando para a construção:
::
./waf
..
Now, if you run the ``hello-simulator`` program, you should see the
expected output.
Agora, ao executar o programa ``hello-simulator`` devemos ter a seguinte a saída.
..
If you want to run programs under another tool such as gdb or valgrind,
see this `wiki entry
<http://www.nsnam.org/wiki/index.php/User_FAQ#How_to_run_NS-3_programs_under_another_tool>`_.
Se o leitor for executar seus programas sob outras ferramentas, tais como Gdb ou Valgrind, é recomendável que leia a seguinte `entrada no Wiki <http://www.nsnam.org/wiki/index.php/User_FAQ#How_to_run_NS-3_programs_under_another_tool>`_.

View File

@ -0,0 +1,51 @@
.. only:: html or latex
..
========================================================================================
Translated for portuguese by the students of doctorate inter institutional program of IME-USP/UTFPR-CM.
Traduzido para o português pelos alunos do programa de doutorado inter institucional do Instituto de Matemática e Estatística da Universidade de São Paulo --- IME-USP em parceria com a Universidade Tecnológica Federal do Paraná - Campus Campo Mourão --- UTFPR-CM:
* Frank Helbert (frank@ime.usp.br);
* Luiz Arthur Feitosa dos Santos (luizsan@ime.usp.br);
* Rodrigo Campiolo (rcampiol@ime.usp.br).
========================================================================================
ns-3 Tutorial
===========================
..
This is the *ns-3 Tutorial*. Primary documentation for the ns-3 project is
available in five forms:
Este é o *Tutorial do ns-3* baseado no *ns-3 Tutorial* (inglês). A documentação para o projeto ns-3 esta disponível da seguinte forma:
..
* `ns-3 Doxygen <http://www.nsnam.org/doxygen/index.html>`_: Documentation of the public APIs of the simulator
* `ns-3 Doxygen <http://www.nsnam.org/doxygen/index.html>`_: Documentação das APIs públicas do simulador;
..
* Tutorial *(this document)*, Manual, and Model Library for the `latest release <http://www.nsnam.org/documentation/latest/>`_ and `development tree <http://www.nsnam.org/ns-3-dev/documentation/>`_
* Tutorial *(este documento)*, manual, modelos de bibliotecas para a `última release <http://www.nsnam.org/documentation/latest/>`_ e `árvore de desenvolvimento <http://www.nsnam.org/ns-3-dev/documentation/>`_;
* `ns-3 wiki <http://www.nsnam.org/wiki/index.php/Main_Page>`_.
..
This document is written in `reStructuredText <http://docutils.sourceforge.net/rst.html>`_ for `Sphinx <http://sphinx.pocoo.org/>`_ and is maintained in the
``doc/tutorial`` directory of ns-3's source code.
Este documento é escrito em `reStructuredText <http://docutils.sourceforge.net/rst.html>`_ para `Sphinx <http://sphinx.pocoo.org/>`_ e é mantido no diretório ``doc/tutorial-pt-br`` do código fonte do ns-3.
.. toctree::
:maxdepth: 2
introduction
resources
getting-started
conceptual-overview
tweaking
building-topologies
tracing
conclusion

View File

@ -0,0 +1,192 @@
.. include:: replace.txt
..
========================================================================================
Translated for portuguese by the students of the inter-institutional doctorate program of IME-USP/UTFPR-CM.
Traduzido para o português pelos alunos do programa de doutorado inter institucional do Instituto de Matemática e Estatística da Universidade de São Paulo --- IME-USP em parceria com a Universidade Tecnológica Federal do Paraná - Campus Campo Mourão --- UTFPR-CM:
* Frank Helbert (frank@ime.usp.br);
* Luiz Arthur Feitosa dos Santos (luizsan@ime.usp.br);
* Rodrigo Campiolo (campiolo@ime.usp.br).
========================================================================================
Introdução
-----------
..
The |ns3| simulator is a discrete-event network simulator targeted
primarily for research and educational use. The
`ns-3 project
<http://www.nsnam.org>`_,
started in 2006, is an open-source project developing |ns3|.
O |ns3| é um simulador de redes baseado em eventos discretos desenvolvido especialmente para pesquisa e uso educacional. O `projeto ns-3 <http://www.nsnam.org>`_ iniciou em 2006 e tem seu código aberto.
..
The purpose of this tutorial is to introduce new |ns3| users to the
system in a structured way. It is sometimes difficult for new users to
glean essential information from detailed manuals and to convert this
information into working simulations. In this tutorial, we will build
several example simulations, introducing and explaining key concepts and
features as we go.
O objetivo deste tutorial é apresentar o |ns3| de forma estruturada aos usuários iniciantes. Algumas vezes torna-se difícil obter informações básicas de manuais detalhados e converter em informações úteis para as simulações. Neste tutorial são ilustrados vários exemplos de simulações, introduzindo e explicando os principais conceitos necessários ao longo do texto.
..
As the tutorial unfolds, we will introduce the full |ns3| documentation
and provide pointers to source code for those interested in delving deeper
into the workings of the system.
A documentação completa do |ns3| e trechos do código fonte são apresentados para os interessados em aprofundar-se no funcionamento do sistema.
..
A few key points are worth noting at the onset:
Alguns pontos importantes para se observar:
..
* Ns-3 is not an extension of `ns-2
<http://www.isi.edu/nsnam/ns>`_;
it is a new simulator. The two simulators are both written in C++ but
|ns3| is a new simulator that does not support the ns-2 APIs. Some
models from ns-2 have already been ported from ns-2 to |ns3|. The
project will continue to maintain ns-2 while |ns3| is being built,
and will study transition and integration mechanisms.
* O |ns3| não é uma extensão do `ns-2 <http://www.isi.edu/nsnam/ns>`_; O |ns3| é um simulador novo. Ambos são escritos em C++, mas o |ns3| é totalmente novo e não suporta as APIs da versão anterior. Algumas funcionalidades do ns-2 já foram portadas para o |ns3|. O projeto continuará mantendo o ns-2 enquanto o |ns3| estiver em fase de desenvolvimento e formas de integração e transição estão em estudo.
..
* |ns3| is open-source, and the project strives to maintain an
open environment for researchers to contribute and share their software.
* O |ns3| é código aberto e existe um grande esforço para manter um ambiente aberto para pesquisadores que queiram contribuir e compartilhar software com o projeto.
..
For ns-2 Users
Para os usuários do ns-2
*************************
..
For those familiar with ns-2, the most visible outward change when moving to
|ns3| is the choice of scripting language. Ns-2 is
scripted in OTcl and results of simulations can be visualized using the
Network Animator nam. It is not possible to run a simulation
in ns-2 purely from C++ (i.e., as a main() program without any OTcl).
Moreover, some components of ns-2 are written in C++ and others in OTcl.
In |ns3|, the simulator is written entirely in C++, with optional
Python bindings. Simulation scripts can therefore be written in C++
or in Python. The results of some simulations can be visualized by
nam, but new animators are under development. Since |ns3|
generates pcap packet trace files, other utilities can be used to
analyze traces as well.
In this tutorial, we will first concentrate on scripting
directly in C++ and interpreting results via trace files.
Para aqueles familiarizados com o ns-2 a mudança mais visível é a escolha da linguagem de codificação (*scripting*). O ns-2 utiliza a linguagem OTcl e os resultados das simulações podem ser visualizados utilizando o *Network Animator - nam*. Entretanto, não é possível executar uma simulação escrita inteira em C++ no ns-2 (por exemplo, com um ``main()`` sem nenhum código OTcl). Assim sendo, no ns-2 alguns componentes são escritos em C++ e outros em OTcl. No |ns3|, todo o simulador é escrito em C++ com suporte opcional a Python. Desta forma, os códigos de simulação podem ser escritos somente em C++ ou Python. Os resultados de algumas simulações podem ser visualizados pelo *nam*, mas novas formas de visualização estão sendo desenvolvidas. O |ns3| gera arquivos de rastreamento de pacotes *(packet trace)* no formato *pcap*, assim, é possível utilizar outras ferramentas para a análise de pacotes. Neste tutorial iremos nos concentrar inicialmente nos códigos de simulação escritos em C++ e na interpretação dos pacotes nos arquivos de rastreamento.
..
But there are similarities as well (both, for example, are based on C++
objects, and some code from ns-2 has already been ported to |ns3|).
We will try to highlight differences between ns-2 and |ns3|
as we proceed in this tutorial.
Também existem semelhanças entre o ns-2 e o |ns3|. Ambos, por exemplo, são orientados a objeto e parte do código do ns-2 já foi portado para o |ns3|. As diferenças entre as versões serão destacadas ao longo deste tutorial.
..
A question that we often hear is "Should I still use ns-2 or move to
|ns3|?" The answer is that it depends. |ns3| does not have
all of the models that ns-2 currently has, but on the other hand, |ns3|
does have new capabilities (such as handling multiple interfaces on nodes
correctly, use of IP addressing and more alignment with Internet
protocols and designs, more detailed 802.11 models, etc.). ns-2
models can usually be ported to |ns3| (a porting guide is under
development). There is active development on multiple fronts for
|ns3|. The |ns3| developers believe (and certain early users
have proven) that |ns3| is ready for active use, and should be an
attractive alternative for users looking to start new simulation projects.
Uma questão que frequentemente aparece é: "Eu devo continuar usando o ns-2 ou devo migrar para o |ns3|?". A resposta é: depende. O |ns3| não tem todos os modelos do ns-2, contudo, possui novas funcionalidades (tais como: trabalha corretamente com nós de rede com múltiplas interfaces de rede (por exemplo, computadores com várias placas de rede), usa endereçamento IP, é mais consistente com arquiteturas e protocolos da Internet, detalha mais o modelo 802.11, etc.). Em todo o caso, os modelos do ns-2 podem ser portados para o |ns3| (um guia está em desenvolvimento). Atualmente existem várias frentes de trabalho para o desenvolvimento do simulador. Os desenvolvedores acreditam (e os primeiros usuários concordam) que o |ns3| está pronto para o uso e é uma ótima alternativa para usuários que querem iniciar novos projetos de simulação.
..
Contributing
Contribuindo
************
..
|ns3| is a research and educational simulator, by and for the
research community. It will rely on the ongoing contributions of the
community to develop new models, debug or maintain existing ones, and share
results. There are a few policies that we hope will encourage people to
contribute to |ns3| like they have for ns-2:
O |ns3| é um simulador para pesquisas e de uso educacional, feito por e para pesquisadores. Este conta com contribuições da comunidade para desenvolver novos modelos, corrigir erros ou manter códigos e compartilhar os resultados. Existem políticas de incentivo para que as pessoas contribuam com o projeto, assim como foi feito no ns-2, tais como:
..
* Open source licensing based on GNU GPLv2 compatibility
* Licença de código aberto compatível com GNU GPLv2;
* `Wiki <http://www.nsnam.org/wiki/index.php>`_;
..
* `Contributed Code
<http://www.nsnam.org/wiki/index.php/Contributed_Code>`_ page, similar to ns-2's popular Contributed Code
`page
<http://nsnam.isi.edu/nsnam/index.php/Contributed_Code>`_
* Página para `contribuição com o código <http://www.nsnam.org/wiki/index.php/Contributed_Code>`_, similar a página de contribuição do `ns-2 <http://nsnam.isi.edu/nsnam/index.php/Contributed_Code>`_;
..
* Open `bug tracker
<http://www.nsnam.org/bugzilla>`_
* `Registro de erros (bugs) <http://www.nsnam.org/bugzilla>`_ aberto.
..
We realize that if you are reading this document, contributing back to
the project is probably not your foremost concern at this point, but
we want you to be aware that contributing is in the spirit of the project and
that even the act of dropping us a note about your early experience
with |ns3| (e.g. "this tutorial section was not clear..."),
reports of stale documentation, etc. are much appreciated.
Se você está lendo este documento, provavelmente contribuir diretamente não seja o foco neste momento, mas esteja ciente que contribuir está no espírito do projeto, mesmo que seja deixando uma mensagem descrevendo suas experiências com o |ns3| (por exemplo, você pode relatar qual seção deste tutorial não esta clara), reportar a desatualização da documentação, etc. Toda ajuda será muita bem vinda.
..
Tutorial Organization
Organização do Tutorial
***********************
..
The tutorial assumes that new users might initially follow a path such as the
following:
Este tutorial assume que os novos usuários podem iniciar da seguinte forma:
..
* Try to download and build a copy;
* Baixar e compilar uma cópia do |ns3|;
..
* Try to run a few sample programs;
* Executar alguns programas exemplo;
..
* Look at simulation output, and try to adjust it.
* Analisar as saídas de simulação e ajustá-las.
..
As a result, we have tried to organize the tutorial along the above
broad sequences of events.
Assim, tentamos organizar este tutorial nesta sequência.

View File

@ -0,0 +1,3 @@
.. |ns3| replace:: *ns-3*
.. |ns2| replace:: *ns-2*

View File

@ -0,0 +1,227 @@
.. include:: replace.txt
..
========================================================================================
Translated for portuguese by the students of the inter-institutional doctorate program of IME-USP/UTFPR-CM.
Traduzido para o português pelos alunos do programa de doutorado inter institucional do Instituto de Matemática e Estatística da Universidade de São Paulo --- IME-USP em parceria com a Universidade Tecnológica Federal do Paraná - Campus Campo Mourão --- UTFPR-CM:
* Frank Helbert (frank@ime.usp.br);
* Luiz Arthur Feitosa dos Santos (luizsan@ime.usp.br);
* Rodrigo Campiolo (campiolo@ime.usp.br).
========================================================================================
.. Resources
Recursos
---------
.. The Web
A Internet
**********
..
There are several important resources of which any |ns3| user must be
aware. The main web site is located at http://www.nsnam.org and
provides access to basic information about the |ns3| system. Detailed
documentation is available through the main web site at
http://www.nsnam.org/documents.html. You can also find documents
relating to the system architecture from this page.
Há vários recursos importantes que um usuário do |ns3| deve conhecer. O principal está em http://www.nsnam.org e fornece acesso a informações básicas sobre o |ns3|. A documentação detalhada esta disponível no sítio principal através do endereço http://www.nsnam.org/documents.html. Nesta página, também podem ser encontrados documentos relacionados a arquitetura do sistema.
..
There is a Wiki that complements the main |ns3| web site which you will
find at http://www.nsnam.org/wiki/. You will find user and developer
FAQs there, as well as troubleshooting guides, third-party contributed code,
papers, etc.
Também existe um *Wiki* que completa o sítio do |ns3| e pode ser encontrado em http://www.nsnam.org/wiki/. Nesta página são encontradas perguntas freqüentes - FAQs (do inglês, *Frequently Asked Questions*) para usuários e desenvolvedores, guias para resolução de problemas, código de terceiros, artigos, etc.
..
The source code may be found and browsed at http://code.nsnam.org/.
There you will find the current development tree in the repository named
``ns-3-dev``. Past releases and experimental repositories of the core
developers may also be found there.
O código fonte também pode ser encontrado e explorado em http://code.nsnam.org/. Neste encontra-se a árvore de código em desenvolvimento em um repositório chamado ``ns-3-dev``. Repositórios antigos e experimentais do núcleo de desenvolvimento podem ser encontrados neste sítio também.
Mercurial
*********
..
Complex software systems need some way to manage the organization and
changes to the underlying code and documentation. There are many ways to
perform this feat, and you may have heard of some of the systems that are
currently used to do this. The Concurrent Version System (CVS) is probably
the most well known.
Sistemas complexos precisam gerenciar a organização e alterações do código, bem como a documentação. Existem várias maneiras de fazer isto e o leitor provavelmente já ouviu falar de algumas. O *Concurrent Version System (CVS)* --- em português, Sistema de Versões Concorrentes --- é provavelmente o mais conhecido.
..
The |ns3| project uses Mercurial as its source code management system.
Although you do not need to know much about Mercurial in order to complete
this tutorial, we recommend becoming familiar with Mercurial and using it
to access the source code. Mercurial has a web site at
http://www.selenic.com/mercurial/,
from which you can get binary or source releases of this Software
Configuration Management (SCM) system. Selenic (the developer of Mercurial)
also provides a tutorial at
http://www.selenic.com/mercurial/wiki/index.cgi/Tutorial/,
and a QuickStart guide at
http://www.selenic.com/mercurial/wiki/index.cgi/QuickStart/.
O |ns3| utiliza o Mercurial para isto. Embora não seja necessário conhecer muito sobre o Mercurial para entender este tutorial, recomenda-se a familiarização com o uso da ferramenta para acessar o código fonte do sistema. O Mercurial tem um sítio em http://www.selenic.com/mercurial/, no qual pode-se baixar diretamente os executáveis ou o código fonte deste sistema de *Software Configuration Management (SCM)* --- em português, Software de Gerenciamento de Configuração. Selenic (o desenvolvedor do Mercurial), também fornece tutoriais em http://www.selenic.com/mercurial/wiki/index.cgi/Tutorial/, e um guia rápido em http://www.selenic.com/mercurial/wiki/index.cgi/QuickStart/.
..
You can also find vital information about using Mercurial and |ns3|
on the main |ns3| web site.
Informações vitais de como usar o Mercurial e o |ns3| são encontradas no sítio principal do projeto.
Waf
***
..
Once you have source code downloaded to your local system, you will need
to compile that source to produce usable programs. Just as in the case of
source code management, there are many tools available to perform this
function. Probably the most well known of these tools is ``make``. Along
with being the most well known, ``make`` is probably the most difficult to
use in a very large and highly configurable system. Because of this, many
alternatives have been developed. Recently these systems have been developed
using the Python language.
Uma vez baixado o código fonte para o seu sistema de arquivos local, será necessário compilar estes fontes para criar os executáveis. Para esta tarefa existem várias ferramentas disponíveis. Provavelmente a mais conhecida é o Make. Além de mais conhecido, também deve ser o mais difícil de usar em grandes sistemas e com muitas opções de configuração. Por este motivo, muitas alternativas foram desenvolvidas, utilizando principalmente a linguagem Python.
..
The build system Waf is used on the |ns3| project. It is one
of the new generation of Python-based build systems. You will not need to
understand any Python to build the existing |ns3| system, and will
only have to understand a tiny and intuitively obvious subset of Python in
order to extend the system in most cases.
O Waf é utilizado para gerar os binários no projeto |ns3|. Ele faz parte da nova geração de sistemas de compilação e contrução baseados em Python. O leitor não precisa entender nada de Python para compilar o |ns3|, e terá que entender um pequeno e intuitivo subconjunto da linguagem se quiser estender o sistema.
..
For those interested in the gory details of Waf, the main web site can be
found at http://code.google.com/p/waf/.
Para os interessados em mais detalhes sobre o Waf, basta acessar o sítio http://code.google.com/p/waf/.
.. Development Environment
Ambiente de Desenvolvimento
***************************
..
As mentioned above, scripting in |ns3| is done in C++ or Python.
As of ns-3.2, most of the |ns3| API is available in Python, but the
models are written in C++ in either case. A working
knowledge of C++ and object-oriented concepts is assumed in this document.
We will take some time to review some of the more advanced concepts or
possibly unfamiliar language features, idioms and design patterns as they
appear. We don't want this tutorial to devolve into a C++ tutorial, though,
so we do expect a basic command of the language. There are an almost
unimaginable number of sources of information on C++ available on the web or
in print.
Como mencionado anteriormente, a programação no |ns3| é feita em C++ ou Python. A partir do ns-3.2, a maioria das APIs já estão disponíveis em Python, mas os modelos continuam sendo escritos em C++. Considera-se que o leitor possui conhecimento básico de C++ e conceitos de orientação a objetos neste documento. Somente serão revistos conceitos avançados, possíveis características pouco utilizadas da linguagem, dialetos e padrões de desenvolvimento. O objetivo não é tornar este um tutorial de C++, embora seja necessário saber o básico da linguagem. Para isto, existe um número muito grande de fontes de informação na Web e em materiais impressos (livros, tutoriais, revistas, etc).
..
If you are new to C++, you may want to find a tutorial- or cookbook-based
book or web site and work through at least the basic features of the language
before proceeding. For instance, `this tutorial
<http://www.cplusplus.com/doc/tutorial/>`_.
Se você é inexperiente em C++, pode encontrar tutoriais, livros e sítios Web para obter o mínimo de conhecimento sobre a linguagem antes de continuar. Por exemplo, pode utilizar `este tutorial <http://www.cplusplus.com/doc/tutorial/>`_.
..
The |ns3| system uses several components of the GNU "toolchain"
for development. A
software toolchain is the set of programming tools available in the given
environment. For a quick review of what is included in the GNU toolchain see,
http://en.wikipedia.org/wiki/GNU_toolchain. |ns3| uses gcc,
GNU binutils, and gdb. However, we do not use the GNU build system tools,
neither make nor autotools. We use Waf for these functions.
O |ns3| utiliza vários componentes do conjunto de ferramentas GNU --- `"GNU toolchain"` --- para o desenvolvimento. Um `software toolchain` é um conjunto de ferramentas de programação para um determinado ambiente. Para uma breve visão do que consiste o `GNU toolchain` veja http://en.wikipedia.org/wiki/GNU_toolchain. O |ns3| usa o `gcc`, `GNU binutils` e `gdb`. Porém, não usa as ferramentas GNU para compilar o sistema, nem o Make e nem o Autotools. Para estas funções é utilizado o Waf.
..
Typically an |ns3| author will work in Linux or a Linux-like
environment. For those running under Windows, there do exist environments
which simulate the Linux environment to various degrees. The |ns3|
project supports development in the Cygwin environment for
these users. See http://www.cygwin.com/
for details on downloading (MinGW is presently not officially supported,
although some of the project maintainers to work with it). Cygwin provides
many of the popular Linux system commands. It can, however, sometimes be
problematic due to the way it actually does its emulation, and sometimes
interactions with other Windows software can cause problems.
Normalmente um usuário do |ns3| irá trabalhar no Linux ou um ambiente baseado nele. Para aqueles que usam Windows, existem ambientes que simulam o Linux em vários níveis. Para estes usuários, o projeto |ns3| fornece suporte ao ambiente Cygwin. Veja o sítio http://www.cygwin.com/ para detalhes de como baixá-lo (o MinGW não é suportado oficialmente, embora alguns mantenedores do projeto trabalhem com ele). O Cygwin fornece vários comandos populares do Linux, entretanto podemos ter problemas com a emulação, às vezes a interação com outros programas do Windows pode causar problemas.
..
If you do use Cygwin or MinGW; and use Logitech products, we will save you
quite a bit of heartburn right off the bat and encourage you to take a look
at the `MinGW FAQ
<http://oldwiki.mingw.org/index.php/FAQ>`_.
Se você usa o Cygwin ou MinGW e usa produtos da Logitech, evite dores de cabeça e dê uma olhada em `MinGW FAQ <http://oldwiki.mingw.org/index.php/FAQ>`_.
..
Search for "Logitech" and read the FAQ entry, "why does make often
crash creating a sh.exe.stackdump file when I try to compile my source code."
Believe it or not, the ``Logitech Process Monitor`` insinuates itself into
every DLL in the system when it is running. It can cause your Cygwin or
MinGW DLLs to die in mysterious ways and often prevents debuggers from
running. Beware of Logitech software when using Cygwin.
Busque por "Logitech" e leia a entrada com o assunto: "why does make often crash creating a sh.exe.stackdump file when I try to compile my source code.". Acredite ou não, o ``Logitech Process Monitor`` influencia todas as DLLs do sistema. Isto pode ocasionar problemas misteriosos durante a execução do Cygwin ou do MinGW. Muita cautela quando utilizar software da Logitech junto com o Cygwin.
..
Another alternative to Cygwin is to install a virtual machine environment
such as VMware server and install a Linux virtual machine.
Uma alternativa ao Cygwin é instalar um ambiente de máquina virtual, tal como o VMware server e criar uma máquina virtual Linux.
.. Socket Programming
Programando com Soquetes (Sockets)
**********************************
..
We will assume a basic facility with the Berkeley Sockets API in the examples
used in this tutorial. If you are new to sockets, we recommend reviewing the
API and some common usage cases. For a good overview of programming TCP/IP
sockets we recommend `TCP/IP Sockets in C, Donahoo and Calvert
<http://www.elsevier.com/wps/find/bookdescription.
cws_home/717656/description#description>`_.
Neste tutorial assume-se, nos exemplos utilizados, que o leitor está familiarizado com as funcionalidades básicas da API dos soquetes de Berkeley. Se este não for o caso, recomendamos a leitura das APIs e alguns casos de uso comuns. Uma API --- do Inglês, `Application Programming Interface` --- é um é um conjunto de rotinas e padrões estabelecidos por um software para a utilização das suas funcionalidades. Para uma boa visão geral sobre a programação de soquetes TCP/IP sugerimos `TCP/IP Sockets in C, Donahoo and Calvert
<http://www.elsevier.com/wps/find/bookdescription.cws_home/717656/description#description>`_.
..
There is an associated web site that includes source for the examples in the
book, which you can find at:
http://cs.baylor.edu/~donahoo/practical/CSockets/.
O sítio http://cs.baylor.edu/~donahoo/practical/CSockets/ contém os códigos fontes dos exemplos do livro.
..
If you understand the first four chapters of the book (or for those who do
not have access to a copy of the book, the echo clients and servers shown in
the website above) you will be in good shape to understand the tutorial.
There is a similar book on Multicast Sockets,
`Multicast Sockets, Makofske and Almeroth
<http://www.elsevier.com/wps/find/bookdescription.cws_home/700736/description#description>`_.
that covers material you may need to understand if you look at the multicast
examples in the distribution.
Se o leitor entender os primeiros quatro capítulos do livro (ou para aqueles que não têm acesso ao livro, os exemplos de cliente e servidor de eco mostrado no sítio anterior) estará apto para compreender o tutorial. Existe também um livro sobre soquetes multidifusão, `Multicast Sockets, Makofske and Almeroth <http://www.elsevier.com/wps/find/bookdescription.cws_home/700736/description#description>`_. que é um material que cobre o necessário sobre multidifusão caso o leitor se interesse.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -808,12 +808,13 @@ to the Wifi module and the mobility module which we will discuss below.
::
#include "ns3/core-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mobility-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/ipv4-global-routing-helper.h"
The network topology illustration follows:
@ -1006,17 +1007,13 @@ requirements of the AP.
::
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
"Ssid", SsidValue (ssid));
In this case, the ``NqosWifiMacHelper`` is going to create MAC
layers of the "ns3::ApWifiMac", the latter specifying that a MAC
instance configured as an AP should be created, with the helper type
implying that the "QosSupported" ``Attribute`` should be set to
false - disabling 802.11e/WMM-style QoS support at created APs. We
set the "BeaconGeneration" ``Attribute`` to true and also set an
interval between beacons of 2.5 seconds.
false - disabling 802.11e/WMM-style QoS support at created APs.
The next lines create the single AP which shares the same set of PHY-level
``Attributes`` (and channel) as the stations:
@ -1236,34 +1233,23 @@ You should see some wifi-looking contents you haven't seen here before:
::
reading from file third-0-1.pcap, link-type IEEE802_11 (802.11)
0.000025 Beacon () [6.0* 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit] IBSS
0.000263 Assoc Request () [6.0 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit]
0.000279 Acknowledgment RA:00:00:00:00:00:07
0.000357 Assoc Response AID(0) :: Succesful
0.000501 Acknowledgment RA:00:00:00:00:00:0a
0.000748 Assoc Request () [6.0 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit]
0.000764 Acknowledgment RA:00:00:00:00:00:08
0.000842 Assoc Response AID(0) :: Succesful
0.000986 Acknowledgment RA:00:00:00:00:00:0a
0.001242 Assoc Request () [6.0 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit]
0.001258 Acknowledgment RA:00:00:00:00:00:09
0.001336 Assoc Response AID(0) :: Succesful
0.001480 Acknowledgment RA:00:00:00:00:00:0a
2.000112 arp who-has 10.1.3.4 (ff:ff:ff:ff:ff:ff) tell 10.1.3.3
2.000128 Acknowledgment RA:00:00:00:00:00:09
2.000206 arp who-has 10.1.3.4 (ff:ff:ff:ff:ff:ff) tell 10.1.3.3
2.000487 arp reply 10.1.3.4 is-at 00:00:00:00:00:0a
2.000659 Acknowledgment RA:00:00:00:00:00:0a
2.002169 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP, length 1024
2.002185 Acknowledgment RA:00:00:00:00:00:09
2.009771 arp who-has 10.1.3.3 (ff:ff:ff:ff:ff:ff) tell 10.1.3.4
2.010029 arp reply 10.1.3.3 is-at 00:00:00:00:00:09
2.010045 Acknowledgment RA:00:00:00:00:00:09
2.010231 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP, length 1024
2.011767 Acknowledgment RA:00:00:00:00:00:0a
2.500000 Beacon () [6.0* 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit] IBSS
5.000000 Beacon () [6.0* 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit] IBSS
7.500000 Beacon () [6.0* 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit] IBSS
0.000025 Beacon (ns-3-ssid) [6.0* 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit] IBSS
0.000263 Assoc Request (ns-3-ssid) [6.0 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit]
0.000279 Acknowledgment RA:00:00:00:00:00:09
0.000552 Assoc Request (ns-3-ssid) [6.0 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit]
0.000568 Acknowledgment RA:00:00:00:00:00:07
0.000664 Assoc Response AID(0) :: Succesful
0.001001 Assoc Response AID(0) :: Succesful
0.001145 Acknowledgment RA:00:00:00:00:00:0a
0.001233 Assoc Response AID(0) :: Succesful
0.001377 Acknowledgment RA:00:00:00:00:00:0a
0.001597 Assoc Request (ns-3-ssid) [6.0 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit]
0.001613 Acknowledgment RA:00:00:00:00:00:08
0.001691 Assoc Response AID(0) :: Succesful
0.001835 Acknowledgment RA:00:00:00:00:00:0a
0.102400 Beacon (ns-3-ssid) [6.0* 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit] IBSS
0.204800 Beacon (ns-3-ssid) [6.0* 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit] IBSS
0.307200 Beacon (ns-3-ssid) [6.0* 9.0 12.0 18.0 24.0 36.0 48.0 54.0 Mbit] IBSS
You can see that the link type is now 802.11 as you would expect. You can
probably understand what is going on and find the IP echo request and response
@ -1281,8 +1267,8 @@ Again, you should see some familiar looking contents:
::
reading from file third-0-0.pcap, link-type PPP (PPP)
2.002169 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP, length 1024
2.009771 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP, length 1024
2.002160 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP, length 1024
2.009767 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP, length 1024
This is the echo packet going from left to right (from Wifi to CSMA) and back
again across the point-to-point link.
@ -1298,8 +1284,8 @@ Again, you should see some familiar looking contents:
::
reading from file third-1-0.pcap, link-type PPP (PPP)
2.005855 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP, length 1024
2.006084 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP, length 1024
2.005846 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP, length 1024
2.006081 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP, length 1024
This is also the echo packet going from left to right (from Wifi to CSMA) and
back again across the point-to-point link with slightly different timings
@ -1317,12 +1303,12 @@ You should see some familiar looking contents:
::
reading from file third-1-1.pcap, link-type EN10MB (Ethernet)
2.005855 arp who-has 10.1.2.4 (ff:ff:ff:ff:ff:ff) tell 10.1.2.1
2.005877 arp reply 10.1.2.4 is-at 00:00:00:00:00:06
2.005877 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP, length 1024
2.005980 arp who-has 10.1.2.1 (ff:ff:ff:ff:ff:ff) tell 10.1.2.4
2.005980 arp reply 10.1.2.1 is-at 00:00:00:00:00:03
2.006084 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP, length 1024
2.005846 ARP, Request who-has 10.1.2.4 (ff:ff:ff:ff:ff:ff) tell 10.1.2.1, length 50
2.005870 ARP, Reply 10.1.2.4 is-at 00:00:00:00:00:06, length 50
2.005870 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP, length 1024
2.005975 ARP, Request who-has 10.1.2.1 (ff:ff:ff:ff:ff:ff) tell 10.1.2.4, length 50
2.005975 ARP, Reply 10.1.2.1 is-at 00:00:00:00:00:03, length 50
2.006081 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP, length 1024
This should be easily understood. If you've forgotten, go back and look at
the discussion in ``second.cc``. This is the same sequence.

View File

@ -95,7 +95,7 @@ int main (int argc, char *argv[])
std::string tr_name ("n-node-ppp.tr");
std::string pcap_name ("n-node-ppp");
std::string flow_name ("n-node-ppp.xml");
std::string anim_name ("n-node-ppp.anim");
std::string anim_name ("n-node-ppp.anim.xml");
std::string adj_mat_file_name ("examples/matrix-topology/adjacency_matrix.txt");
std::string node_coordinates_file_name ("examples/matrix-topology/node_coordinates.txt");
@ -275,24 +275,12 @@ int main (int argc, char *argv[])
// Configure animator with default settings
bool animEnabled = false;
AnimationInterface anim;
if (anim.SetServerPort (9) && anim.SetOutputFile (anim_name.c_str ()))
{
NS_LOG_INFO ("Animation Interface Enabled.");
animEnabled = true;
anim.StartAnimation ();
}
AnimationInterface anim (anim_name.c_str ());
NS_LOG_INFO ("Run Simulation.");
Simulator::Stop (Seconds (SimTime));
Simulator::Run ();
// flowmon->SerializeToXmlFile (flow_name.c_str(), true, true);
if (animEnabled)
{
anim.StopAnimation ();
}
Simulator::Destroy ();
// ---------- End of Simulation Monitoring ---------------------------------

View File

@ -113,6 +113,7 @@ main (int argc, char *argv[])
//
// Now, do the actual simulation.
//
Simulator::Stop (Seconds (11.0));
NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();
Simulator::Destroy ();

View File

@ -105,8 +105,7 @@ antenna.
References
++++++++++
.. [Balanis] C.A. Balanis, "Antenna Theory - Analysis and Design", Wiley, 2nd Ed.

View File

@ -55,7 +55,7 @@ values.
ParabolicAntennaModel
------------------
---------------------
The unit test suite ``parabolic-antenna-model`` checks that the
``ParabolicAntennaModel`` class works properly. Several test cases are

View File

@ -57,7 +57,7 @@ std::istream &operator >> (std::istream &is, Angles &a)
return is;
}
Angles::Angles ()
: phi (0),
theta (0)

View File

@ -58,8 +58,8 @@ double RadiansToDegrees (double radians);
* ^
* z |
* |_ theta
* | \
* | /|
* | \
* | /|
* |/ | y
* +-------->
* / \|
@ -128,7 +128,7 @@ struct Angles
* \return a reference to the output stream
*/
std::ostream& operator<< ( std::ostream& os, const Angles& a);
/**
* initialize a struct Angles from input
*

View File

@ -34,7 +34,7 @@ NS_OBJECT_ENSURE_REGISTERED (AntennaModel);
AntennaModel::AntennaModel ()
{
}
AntennaModel::~AntennaModel ()
{
}
@ -44,11 +44,11 @@ AntennaModel::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::AntennaModel")
.SetParent<Object> ()
;
;
return tid;
}
}

View File

@ -53,7 +53,7 @@ public:
static TypeId GetTypeId ();
/**
/**
* this method is expected to be re-implemented by each antenna model
*
* \param the spherical angles at which the radiation pattern should

View File

@ -57,7 +57,7 @@ CosineAntennaModel::GetTypeId ()
DoubleValue (0.0),
MakeDoubleAccessor (&CosineAntennaModel::m_maxGain),
MakeDoubleChecker<double> ())
;
;
return tid;
}
@ -66,7 +66,7 @@ CosineAntennaModel::SetBeamwidth (double beamwidthDegrees)
{
NS_LOG_FUNCTION (this << beamwidthDegrees);
m_beamwidthRadians = DegreesToRadians (beamwidthDegrees);
m_exponent = - 3.0 / (20*log10 (cos (m_beamwidthRadians / 4.0)));
m_exponent = -3.0 / (20*log10 (cos (m_beamwidthRadians / 4.0)));
NS_LOG_LOGIC (this << " m_exponent = " << m_exponent);
}
@ -107,15 +107,15 @@ CosineAntennaModel::GetGainDb (Angles a)
}
NS_LOG_LOGIC ("phi = " << phi );
// element factor: amplitude gain of a single antenna element in linear units
double ef = pow (cos (phi / 2.0), m_exponent);
// the array factor is not considered. Note that if we did consider
// the array factor, the actual beamwidth would change, and in
// particular it would be different from the one specified by the
// user. Hence it is not desirable to use the array factor, for the
// ease of use of this model.
// ease of use of this model.
double gainDb = 20*log10 (ef);
NS_LOG_LOGIC ("gain = " << gainDb << " + " << m_maxGain << " dB");

View File

@ -38,7 +38,7 @@ IsotropicAntennaModel::GetTypeId ()
static TypeId tid = TypeId ("ns3::IsotropicAntennaModel")
.SetParent<AntennaModel> ()
.AddConstructor<IsotropicAntennaModel> ()
;
;
return tid;
}

View File

@ -57,7 +57,7 @@ ParabolicAntennaModel::GetTypeId ()
DoubleValue (20.0),
MakeDoubleAccessor (&ParabolicAntennaModel::m_maxAttenuation),
MakeDoubleChecker<double> ())
;
;
return tid;
}
@ -107,7 +107,7 @@ ParabolicAntennaModel::GetGainDb (Angles a)
NS_LOG_LOGIC ("phi = " << phi );
double gainDb = -std::min (12 * pow (phi / m_beamwidthRadians, 2), m_maxAttenuation);
NS_LOG_LOGIC ("gain = " << gainDb);
return gainDb;
}

View File

@ -44,7 +44,7 @@ private:
std::string OneVectorConstructorTestCase::BuildNameString (Vector v)
{
std::ostringstream oss;
oss << " v = " << v ;
oss << " v = " << v;
return oss.str ();
}
@ -133,7 +133,7 @@ AnglesTestSuite::AnglesTestSuite ()
AddTestCase (new OneVectorConstructorTestCase (Vector (0, -2, 0), Angles (-M_PI_2, M_PI_2)));
AddTestCase (new OneVectorConstructorTestCase (Vector (0, 0, 2), Angles (0, 0)));
AddTestCase (new OneVectorConstructorTestCase (Vector (0, 0, -2), Angles (0, M_PI)));
AddTestCase (new OneVectorConstructorTestCase (Vector (1, 0, 1), Angles (0, M_PI_4)));
AddTestCase (new OneVectorConstructorTestCase (Vector (1, 0, -1), Angles (0, 3*M_PI_4)));
AddTestCase (new OneVectorConstructorTestCase (Vector (1, 1, 0), Angles (M_PI_4, M_PI_2)));
@ -168,7 +168,7 @@ AnglesTestSuite::AnglesTestSuite ()
AddTestCase (new TwoVectorsConstructorTestCase (Vector (0, -2, 0), Vector (0, 0, 0), Angles (-M_PI_2, M_PI_2)));
AddTestCase (new TwoVectorsConstructorTestCase (Vector (0, 0, 2), Vector (0, 0, 0), Angles (0, 0)));
AddTestCase (new TwoVectorsConstructorTestCase (Vector (0, 0, -2), Vector (0, 0, 0), Angles (0, M_PI)));
AddTestCase (new TwoVectorsConstructorTestCase (Vector (1, 0, 1), Vector (0, 0, 0), Angles (0, M_PI_4)));
AddTestCase (new TwoVectorsConstructorTestCase (Vector (1, 0, -1), Vector (0, 0, 0), Angles (0, 3*M_PI_4)));
AddTestCase (new TwoVectorsConstructorTestCase (Vector (1, 1, 0), Vector (0, 0, 0), Angles (M_PI_4, M_PI_2)));
@ -197,7 +197,7 @@ AnglesTestSuite::AnglesTestSuite ()
AddTestCase (new TwoVectorsConstructorTestCase (Vector (-2, 2, -1), Vector (-4, 2, -1), Angles (0, M_PI_2)));
AddTestCase (new TwoVectorsConstructorTestCase (Vector (2, 2, 0), Vector (4, 2, 0), Angles (M_PI, M_PI_2)));
AddTestCase (new TwoVectorsConstructorTestCase (Vector (-1, 4, 4), Vector (-2, 4, 3), Angles (0, M_PI_4)));
AddTestCase (new TwoVectorsConstructorTestCase (Vector (0, -2, -6), Vector (-1, -2, -5), Angles (0, 3*M_PI_4)));
AddTestCase (new TwoVectorsConstructorTestCase (Vector (77, 3, 43), Vector (78, 2, 43), Angles (3*M_PI_4, M_PI_2)));

View File

@ -165,7 +165,7 @@ CosineAntennaModelTestSuite::CosineAntennaModelTestSuite ()
AddTestCase (new CosineAntennaModelTestCase (Angles (DegreesToRadians (54.677), 0), 150, -150, 0, -20, EQUAL));
AddTestCase (new CosineAntennaModelTestCase (Angles (DegreesToRadians (30), 0), 150, -150, 0, -20, LESSTHAN));
AddTestCase (new CosineAntennaModelTestCase (Angles (DegreesToRadians (20), 0), 150, -150, 0, -20, LESSTHAN));
// test maxGain
AddTestCase (new CosineAntennaModelTestCase (Angles (DegreesToRadians (0), 0), 60, 0, 10, 10, EQUAL));
AddTestCase (new CosineAntennaModelTestCase (Angles (DegreesToRadians (30), 0), 60, 0, 22, 19, EQUAL));
@ -200,7 +200,7 @@ CosineAntennaModelTestSuite::CosineAntennaModelTestSuite ()
AddTestCase (new CosineAntennaModelTestCase (Angles (DegreesToRadians (-150), 9.5), 100, -150, 2, 2, EQUAL));
AddTestCase (new CosineAntennaModelTestCase (Angles (DegreesToRadians (-100), 9.5), 100, -150, 4, 1, EQUAL));
AddTestCase (new CosineAntennaModelTestCase (Angles (DegreesToRadians (-200), 9.5), 100, -150, -1, -4, EQUAL));
};
static CosineAntennaModelTestSuite staticCosineAntennaModelTestSuiteInstance;

View File

@ -128,7 +128,7 @@ DegreesRadiansTestSuite::DegreesRadiansTestSuite ()
AddTestCase (new RadiansToDegreesTestCase (M_PI + M_PI, 360));
AddTestCase (new RadiansToDegreesTestCase (-M_PI_2, -90));
AddTestCase (new RadiansToDegreesTestCase (4.5*M_PI, 810));
};
static DegreesRadiansTestSuite staticDegreesRadiansTestSuiteInstance;

View File

@ -154,7 +154,7 @@ ParabolicAntennaModelTestSuite::ParabolicAntennaModelTestSuite ()
AddTestCase (new ParabolicAntennaModelTestCase (Angles (DegreesToRadians (60), 0), 80, -150, 10, -10, EQUAL));
AddTestCase (new ParabolicAntennaModelTestCase (Angles (DegreesToRadians (90), 0), 80, -150, 10, -10, EQUAL));
AddTestCase (new ParabolicAntennaModelTestCase (Angles (DegreesToRadians (30), 0), 80, -150, 10, -10, EQUAL));
// test elevation angle
@ -179,7 +179,7 @@ ParabolicAntennaModelTestSuite::ParabolicAntennaModelTestSuite ()
AddTestCase (new ParabolicAntennaModelTestCase (Angles (DegreesToRadians (-150), 9.5), 100, -150, 30, 0, EQUAL));
AddTestCase (new ParabolicAntennaModelTestCase (Angles (DegreesToRadians (-100), 9.5), 100, -150, 30, -3, EQUAL));
AddTestCase (new ParabolicAntennaModelTestCase (Angles (DegreesToRadians (-200), 9.5), 100, -150, 30, -3, EQUAL));
};
static ParabolicAntennaModelTestSuite staticParabolicAntennaModelTestSuiteInstance;

View File

@ -3263,6 +3263,11 @@ def register_Ns3Socket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',

View File

@ -3263,6 +3263,11 @@ def register_Ns3Socket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',

View File

@ -53,16 +53,19 @@ const uint32_t RoutingProtocol::AODV_PORT = 654;
//-----------------------------------------------------------------------------
/// Tag used by AODV implementation
struct DeferredRouteOutputTag : public Tag
{
/// Positive if output device is fixed in RouteOutput
int32_t oif;
DeferredRouteOutputTag (int32_t o = -1) : Tag (), oif (o) {}
class DeferredRouteOutputTag : public Tag
{
public:
DeferredRouteOutputTag (int32_t o = -1) : Tag (), m_oif (o) {}
static TypeId GetTypeId ()
{
static TypeId tid = TypeId ("ns3::aodv::DeferredRouteOutputTag").SetParent<Tag> ();
static TypeId tid = TypeId ("ns3::aodv::DeferredRouteOutputTag").SetParent<Tag> ()
.SetParent<Tag> ()
.AddConstructor<DeferredRouteOutputTag> ()
;
return tid;
}
@ -71,6 +74,16 @@ struct DeferredRouteOutputTag : public Tag
return GetTypeId ();
}
int32_t GetInterface() const
{
return m_oif;
}
void SetInterface(int32_t oif)
{
m_oif = oif;
}
uint32_t GetSerializedSize () const
{
return sizeof(int32_t);
@ -78,20 +91,27 @@ struct DeferredRouteOutputTag : public Tag
void Serialize (TagBuffer i) const
{
i.WriteU32 (oif);
i.WriteU32 (m_oif);
}
void Deserialize (TagBuffer i)
{
oif = i.ReadU32 ();
m_oif = i.ReadU32 ();
}
void Print (std::ostream &os) const
{
os << "DeferredRouteOutputTag: output interface = " << oif;
os << "DeferredRouteOutputTag: output interface = " << m_oif;
}
private:
/// Positive if output device is fixed in RouteOutput
int32_t m_oif;
};
NS_OBJECT_ENSURE_REGISTERED (DeferredRouteOutputTag);
//-----------------------------------------------------------------------------
RoutingProtocol::RoutingProtocol () :
RreqRetries (2),
@ -1577,8 +1597,8 @@ RoutingProtocol::SendPacketFromQueue (Ipv4Address dst, Ptr<Ipv4Route> route)
DeferredRouteOutputTag tag;
Ptr<Packet> p = ConstCast<Packet> (queueEntry.GetPacket ());
if (p->RemovePacketTag (tag) &&
tag.oif != -1 &&
tag.oif != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
tag.GetInterface() != -1 &&
tag.GetInterface() != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
{
NS_LOG_DEBUG ("Output device doesn't match. Dropped.");
return;

View File

@ -62,6 +62,8 @@ def register_types(module):
module.add_class('CallbackBase', import_from_module='ns.core')
## channel-list.h (module 'network'): ns3::ChannelList [class]
module.add_class('ChannelList', import_from_module='ns.network')
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback [class]
module.add_class('DataOutputCallback', allow_subclassing=True, import_from_module='ns.stats')
## data-rate.h (module 'network'): ns3::DataRate [class]
module.add_class('DataRate', import_from_module='ns.network')
## event-id.h (module 'core'): ns3::EventId [class]
@ -158,6 +160,8 @@ def register_types(module):
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simulator.h (module 'core'): ns3::Simulator [class]
module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core')
## data-calculator.h (module 'stats'): ns3::StatisticalSummary [class]
module.add_class('StatisticalSummary', allow_subclassing=True, import_from_module='ns.stats')
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs [class]
module.add_class('SystemWallClockMs', import_from_module='ns.core')
## tag.h (module 'network'): ns3::Tag [class]
@ -328,6 +332,10 @@ def register_types(module):
module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## channel.h (module 'network'): ns3::Channel [class]
module.add_class('Channel', import_from_module='ns.network', parent=root_module['ns3::Object'])
## data-calculator.h (module 'stats'): ns3::DataCalculator [class]
module.add_class('DataCalculator', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface [class]
module.add_class('DataOutputInterface', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-rate.h (module 'network'): ns3::DataRateChecker [class]
module.add_class('DataRateChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## data-rate.h (module 'network'): ns3::DataRateValue [class]
@ -368,6 +376,8 @@ def register_types(module):
module.add_class('Mac48AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue [class]
module.add_class('Mac48AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double> [class]
module.add_class('MinMaxAvgTotalCalculator', import_from_module='ns.stats', template_parameters=['double'], parent=[root_module['ns3::DataCalculator'], root_module['ns3::StatisticalSummary']])
## net-device.h (module 'network'): ns3::NetDevice [class]
module.add_class('NetDevice', import_from_module='ns.network', parent=root_module['ns3::Object'])
## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration]
@ -519,6 +529,7 @@ def register_methods(root_module):
register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item'])
register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase'])
register_Ns3ChannelList_methods(root_module, root_module['ns3::ChannelList'])
register_Ns3DataOutputCallback_methods(root_module, root_module['ns3::DataOutputCallback'])
register_Ns3DataRate_methods(root_module, root_module['ns3::DataRate'])
register_Ns3EventId_methods(root_module, root_module['ns3::EventId'])
register_Ns3Inet6SocketAddress_methods(root_module, root_module['ns3::Inet6SocketAddress'])
@ -558,6 +569,7 @@ def register_methods(root_module):
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
register_Ns3StatisticalSummary_methods(root_module, root_module['ns3::StatisticalSummary'])
register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs'])
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
@ -634,6 +646,8 @@ def register_methods(root_module):
register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase'])
register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue'])
register_Ns3Channel_methods(root_module, root_module['ns3::Channel'])
register_Ns3DataCalculator_methods(root_module, root_module['ns3::DataCalculator'])
register_Ns3DataOutputInterface_methods(root_module, root_module['ns3::DataOutputInterface'])
register_Ns3DataRateChecker_methods(root_module, root_module['ns3::DataRateChecker'])
register_Ns3DataRateValue_methods(root_module, root_module['ns3::DataRateValue'])
register_Ns3DropTailQueue_methods(root_module, root_module['ns3::DropTailQueue'])
@ -653,6 +667,7 @@ def register_methods(root_module):
register_Ns3ListErrorModel_methods(root_module, root_module['ns3::ListErrorModel'])
register_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker'])
register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue'])
register_Ns3MinMaxAvgTotalCalculator__Double_methods(root_module, root_module['ns3::MinMaxAvgTotalCalculator< double >'])
register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice'])
register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector'])
register_Ns3Node_methods(root_module, root_module['ns3::Node'])
@ -1468,6 +1483,43 @@ def register_Ns3ChannelList_methods(root_module, cls):
is_static=True)
return
def register_Ns3DataOutputCallback_methods(root_module, cls):
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback::DataOutputCallback() [constructor]
cls.add_constructor([])
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback::DataOutputCallback(ns3::DataOutputCallback const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataOutputCallback const &', 'arg0')])
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, int val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('int', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, uint32_t val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('uint32_t', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, double val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('double', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, std::string val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('std::string', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, ns3::Time val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::Time', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputStatistic(std::string key, std::string variable, ns3::StatisticalSummary const * statSum) [member function]
cls.add_method('OutputStatistic',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::StatisticalSummary const *', 'statSum')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3DataRate_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('!=')
@ -3267,6 +3319,53 @@ def register_Ns3Simulator_methods(root_module, cls):
is_static=True)
return
def register_Ns3StatisticalSummary_methods(root_module, cls):
## data-calculator.h (module 'stats'): ns3::StatisticalSummary::StatisticalSummary() [constructor]
cls.add_constructor([])
## data-calculator.h (module 'stats'): ns3::StatisticalSummary::StatisticalSummary(ns3::StatisticalSummary const & arg0) [copy constructor]
cls.add_constructor([param('ns3::StatisticalSummary const &', 'arg0')])
## data-calculator.h (module 'stats'): long int ns3::StatisticalSummary::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3SystemWallClockMs_methods(root_module, cls):
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs(ns3::SystemWallClockMs const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemWallClockMs const &', 'arg0')])
@ -4925,6 +5024,11 @@ def register_Ns3Socket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',
@ -5739,6 +5843,90 @@ def register_Ns3Channel_methods(root_module, cls):
is_static=True)
return
def register_Ns3DataCalculator_methods(root_module, cls):
## data-calculator.h (module 'stats'): ns3::DataCalculator::DataCalculator(ns3::DataCalculator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataCalculator const &', 'arg0')])
## data-calculator.h (module 'stats'): ns3::DataCalculator::DataCalculator() [constructor]
cls.add_constructor([])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## data-calculator.h (module 'stats'): std::string ns3::DataCalculator::GetContext() const [member function]
cls.add_method('GetContext',
'std::string',
[],
is_const=True)
## data-calculator.h (module 'stats'): bool ns3::DataCalculator::GetEnabled() const [member function]
cls.add_method('GetEnabled',
'bool',
[],
is_const=True)
## data-calculator.h (module 'stats'): std::string ns3::DataCalculator::GetKey() const [member function]
cls.add_method('GetKey',
'std::string',
[],
is_const=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::SetContext(std::string const context) [member function]
cls.add_method('SetContext',
'void',
[param('std::string const', 'context')])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::SetKey(std::string const key) [member function]
cls.add_method('SetKey',
'void',
[param('std::string const', 'key')])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Start(ns3::Time const & startTime) [member function]
cls.add_method('Start',
'void',
[param('ns3::Time const &', 'startTime')],
is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Stop(ns3::Time const & stopTime) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'stopTime')],
is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DataOutputInterface_methods(root_module, cls):
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface::DataOutputInterface(ns3::DataOutputInterface const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataOutputInterface const &', 'arg0')])
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface::DataOutputInterface() [constructor]
cls.add_constructor([])
## data-output-interface.h (module 'stats'): std::string ns3::DataOutputInterface::GetFilePrefix() const [member function]
cls.add_method('GetFilePrefix',
'std::string',
[],
is_const=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::Output(ns3::DataCollector & dc) [member function]
cls.add_method('Output',
'void',
[param('ns3::DataCollector &', 'dc')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::SetFilePrefix(std::string const prefix) [member function]
cls.add_method('SetFilePrefix',
'void',
[param('std::string const', 'prefix')])
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DataRateChecker_methods(root_module, cls):
## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker() [constructor]
cls.add_constructor([])
@ -6282,6 +6470,71 @@ def register_Ns3Mac48AddressValue_methods(root_module, cls):
[param('ns3::Mac48Address const &', 'value')])
return
def register_Ns3MinMaxAvgTotalCalculator__Double_methods(root_module, cls):
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double>::MinMaxAvgTotalCalculator(ns3::MinMaxAvgTotalCalculator<double> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::MinMaxAvgTotalCalculator< double > const &', 'arg0')])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double>::MinMaxAvgTotalCalculator() [constructor]
cls.add_constructor([])
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Update(double const i) [member function]
cls.add_method('Update',
'void',
[param('double const', 'i')])
## basic-data-calculators.h (module 'stats'): long int ns3::MinMaxAvgTotalCalculator<double>::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3NetDevice_methods(root_module, cls):
## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor]
cls.add_constructor([])

View File

@ -62,6 +62,8 @@ def register_types(module):
module.add_class('CallbackBase', import_from_module='ns.core')
## channel-list.h (module 'network'): ns3::ChannelList [class]
module.add_class('ChannelList', import_from_module='ns.network')
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback [class]
module.add_class('DataOutputCallback', allow_subclassing=True, import_from_module='ns.stats')
## data-rate.h (module 'network'): ns3::DataRate [class]
module.add_class('DataRate', import_from_module='ns.network')
## event-id.h (module 'core'): ns3::EventId [class]
@ -158,6 +160,8 @@ def register_types(module):
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simulator.h (module 'core'): ns3::Simulator [class]
module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core')
## data-calculator.h (module 'stats'): ns3::StatisticalSummary [class]
module.add_class('StatisticalSummary', allow_subclassing=True, import_from_module='ns.stats')
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs [class]
module.add_class('SystemWallClockMs', import_from_module='ns.core')
## tag.h (module 'network'): ns3::Tag [class]
@ -328,6 +332,10 @@ def register_types(module):
module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## channel.h (module 'network'): ns3::Channel [class]
module.add_class('Channel', import_from_module='ns.network', parent=root_module['ns3::Object'])
## data-calculator.h (module 'stats'): ns3::DataCalculator [class]
module.add_class('DataCalculator', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface [class]
module.add_class('DataOutputInterface', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-rate.h (module 'network'): ns3::DataRateChecker [class]
module.add_class('DataRateChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## data-rate.h (module 'network'): ns3::DataRateValue [class]
@ -368,6 +376,8 @@ def register_types(module):
module.add_class('Mac48AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue [class]
module.add_class('Mac48AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double> [class]
module.add_class('MinMaxAvgTotalCalculator', import_from_module='ns.stats', template_parameters=['double'], parent=[root_module['ns3::DataCalculator'], root_module['ns3::StatisticalSummary']])
## net-device.h (module 'network'): ns3::NetDevice [class]
module.add_class('NetDevice', import_from_module='ns.network', parent=root_module['ns3::Object'])
## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration]
@ -519,6 +529,7 @@ def register_methods(root_module):
register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item'])
register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase'])
register_Ns3ChannelList_methods(root_module, root_module['ns3::ChannelList'])
register_Ns3DataOutputCallback_methods(root_module, root_module['ns3::DataOutputCallback'])
register_Ns3DataRate_methods(root_module, root_module['ns3::DataRate'])
register_Ns3EventId_methods(root_module, root_module['ns3::EventId'])
register_Ns3Inet6SocketAddress_methods(root_module, root_module['ns3::Inet6SocketAddress'])
@ -558,6 +569,7 @@ def register_methods(root_module):
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
register_Ns3StatisticalSummary_methods(root_module, root_module['ns3::StatisticalSummary'])
register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs'])
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
@ -634,6 +646,8 @@ def register_methods(root_module):
register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase'])
register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue'])
register_Ns3Channel_methods(root_module, root_module['ns3::Channel'])
register_Ns3DataCalculator_methods(root_module, root_module['ns3::DataCalculator'])
register_Ns3DataOutputInterface_methods(root_module, root_module['ns3::DataOutputInterface'])
register_Ns3DataRateChecker_methods(root_module, root_module['ns3::DataRateChecker'])
register_Ns3DataRateValue_methods(root_module, root_module['ns3::DataRateValue'])
register_Ns3DropTailQueue_methods(root_module, root_module['ns3::DropTailQueue'])
@ -653,6 +667,7 @@ def register_methods(root_module):
register_Ns3ListErrorModel_methods(root_module, root_module['ns3::ListErrorModel'])
register_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker'])
register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue'])
register_Ns3MinMaxAvgTotalCalculator__Double_methods(root_module, root_module['ns3::MinMaxAvgTotalCalculator< double >'])
register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice'])
register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector'])
register_Ns3Node_methods(root_module, root_module['ns3::Node'])
@ -1468,6 +1483,43 @@ def register_Ns3ChannelList_methods(root_module, cls):
is_static=True)
return
def register_Ns3DataOutputCallback_methods(root_module, cls):
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback::DataOutputCallback() [constructor]
cls.add_constructor([])
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback::DataOutputCallback(ns3::DataOutputCallback const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataOutputCallback const &', 'arg0')])
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, int val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('int', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, uint32_t val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('uint32_t', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, double val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('double', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, std::string val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('std::string', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, ns3::Time val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::Time', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputStatistic(std::string key, std::string variable, ns3::StatisticalSummary const * statSum) [member function]
cls.add_method('OutputStatistic',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::StatisticalSummary const *', 'statSum')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3DataRate_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('!=')
@ -3267,6 +3319,53 @@ def register_Ns3Simulator_methods(root_module, cls):
is_static=True)
return
def register_Ns3StatisticalSummary_methods(root_module, cls):
## data-calculator.h (module 'stats'): ns3::StatisticalSummary::StatisticalSummary() [constructor]
cls.add_constructor([])
## data-calculator.h (module 'stats'): ns3::StatisticalSummary::StatisticalSummary(ns3::StatisticalSummary const & arg0) [copy constructor]
cls.add_constructor([param('ns3::StatisticalSummary const &', 'arg0')])
## data-calculator.h (module 'stats'): long int ns3::StatisticalSummary::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3SystemWallClockMs_methods(root_module, cls):
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs(ns3::SystemWallClockMs const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemWallClockMs const &', 'arg0')])
@ -4925,6 +5024,11 @@ def register_Ns3Socket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',
@ -5739,6 +5843,90 @@ def register_Ns3Channel_methods(root_module, cls):
is_static=True)
return
def register_Ns3DataCalculator_methods(root_module, cls):
## data-calculator.h (module 'stats'): ns3::DataCalculator::DataCalculator(ns3::DataCalculator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataCalculator const &', 'arg0')])
## data-calculator.h (module 'stats'): ns3::DataCalculator::DataCalculator() [constructor]
cls.add_constructor([])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## data-calculator.h (module 'stats'): std::string ns3::DataCalculator::GetContext() const [member function]
cls.add_method('GetContext',
'std::string',
[],
is_const=True)
## data-calculator.h (module 'stats'): bool ns3::DataCalculator::GetEnabled() const [member function]
cls.add_method('GetEnabled',
'bool',
[],
is_const=True)
## data-calculator.h (module 'stats'): std::string ns3::DataCalculator::GetKey() const [member function]
cls.add_method('GetKey',
'std::string',
[],
is_const=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::SetContext(std::string const context) [member function]
cls.add_method('SetContext',
'void',
[param('std::string const', 'context')])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::SetKey(std::string const key) [member function]
cls.add_method('SetKey',
'void',
[param('std::string const', 'key')])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Start(ns3::Time const & startTime) [member function]
cls.add_method('Start',
'void',
[param('ns3::Time const &', 'startTime')],
is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Stop(ns3::Time const & stopTime) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'stopTime')],
is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DataOutputInterface_methods(root_module, cls):
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface::DataOutputInterface(ns3::DataOutputInterface const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataOutputInterface const &', 'arg0')])
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface::DataOutputInterface() [constructor]
cls.add_constructor([])
## data-output-interface.h (module 'stats'): std::string ns3::DataOutputInterface::GetFilePrefix() const [member function]
cls.add_method('GetFilePrefix',
'std::string',
[],
is_const=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::Output(ns3::DataCollector & dc) [member function]
cls.add_method('Output',
'void',
[param('ns3::DataCollector &', 'dc')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::SetFilePrefix(std::string const prefix) [member function]
cls.add_method('SetFilePrefix',
'void',
[param('std::string const', 'prefix')])
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DataRateChecker_methods(root_module, cls):
## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker() [constructor]
cls.add_constructor([])
@ -6282,6 +6470,71 @@ def register_Ns3Mac48AddressValue_methods(root_module, cls):
[param('ns3::Mac48Address const &', 'value')])
return
def register_Ns3MinMaxAvgTotalCalculator__Double_methods(root_module, cls):
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double>::MinMaxAvgTotalCalculator(ns3::MinMaxAvgTotalCalculator<double> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::MinMaxAvgTotalCalculator< double > const &', 'arg0')])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double>::MinMaxAvgTotalCalculator() [constructor]
cls.add_constructor([])
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Update(double const i) [member function]
cls.add_method('Update',
'void',
[param('double const', 'i')])
## basic-data-calculators.h (module 'stats'): long int ns3::MinMaxAvgTotalCalculator<double>::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3NetDevice_methods(root_module, cls):
## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor]
cls.add_constructor([])

View File

@ -168,7 +168,7 @@ void PacketSink::HandleRead (Ptr<Socket> socket)
NS_LOG_FUNCTION (this << socket);
Ptr<Packet> packet;
Address from;
while (packet = socket->RecvFrom (from))
while ((packet = socket->RecvFrom (from)))
{
if (packet->GetSize () == 0)
{ //EOF

View File

@ -231,7 +231,7 @@ void Ping6::HandleRead (Ptr<Socket> socket)
Ptr<Packet> packet=0;
Address from;
while (packet = socket->RecvFrom (from))
while ((packet = socket->RecvFrom (from)))
{
if (Inet6SocketAddress::IsMatchingType (from))
{

View File

@ -235,7 +235,7 @@ void Radvd::HandleRead (Ptr<Socket> socket)
Ptr<Packet> packet = 0;
Address from;
while (packet = socket->RecvFrom (from))
while ((packet = socket->RecvFrom (from)))
{
if (Inet6SocketAddress::IsMatchingType (from))
{

View File

@ -306,15 +306,15 @@ UdpEchoClient::Send (void)
++m_sent;
if (InetSocketAddress::IsMatchingType (m_peerAddress))
if (Ipv4Address::IsMatchingType (m_peerAddress))
{
NS_LOG_INFO ("Sent " << m_size << " bytes to " <<
InetSocketAddress::ConvertFrom (m_peerAddress));
NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s client sent " << m_size << " bytes to " <<
Ipv4Address::ConvertFrom (m_peerAddress) << " port " << m_peerPort);
}
else if (Inet6SocketAddress::IsMatchingType (m_peerAddress))
else if (Ipv6Address::IsMatchingType (m_peerAddress))
{
NS_LOG_INFO ("Sent " << m_size << " bytes to " <<
Inet6SocketAddress::ConvertFrom (m_peerAddress));
NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s client sent " << m_size << " bytes to " <<
Ipv6Address::ConvertFrom (m_peerAddress) << " port " << m_peerPort);
}
if (m_sent < m_count)
@ -329,17 +329,19 @@ UdpEchoClient::HandleRead (Ptr<Socket> socket)
NS_LOG_FUNCTION (this << socket);
Ptr<Packet> packet;
Address from;
while (packet = socket->RecvFrom (from))
while ((packet = socket->RecvFrom (from)))
{
if (InetSocketAddress::IsMatchingType (from))
{
NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " <<
InetSocketAddress::ConvertFrom (from).GetIpv4 ());
NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s client received " << packet->GetSize () << " bytes from " <<
InetSocketAddress::ConvertFrom (from).GetIpv4 () << " port " <<
InetSocketAddress::ConvertFrom (from).GetPort ());
}
else if (Inet6SocketAddress::IsMatchingType (from))
{
NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " <<
Inet6SocketAddress::ConvertFrom (from).GetIpv6 ());
NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s client received " << packet->GetSize () << " bytes from " <<
Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " port " <<
Inet6SocketAddress::ConvertFrom (from).GetPort ());
}
}
}

View File

@ -143,29 +143,38 @@ UdpEchoServer::HandleRead (Ptr<Socket> socket)
{
Ptr<Packet> packet;
Address from;
while (packet = socket->RecvFrom (from))
while ((packet = socket->RecvFrom (from)))
{
if (InetSocketAddress::IsMatchingType (from))
{
NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " <<
InetSocketAddress::ConvertFrom (from).GetIpv4 ());
packet->RemoveAllPacketTags ();
packet->RemoveAllByteTags ();
NS_LOG_LOGIC ("Echoing packet");
socket->SendTo (packet, 0, from);
NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s server received " << packet->GetSize () << " bytes from " <<
InetSocketAddress::ConvertFrom (from).GetIpv4 () << " port " <<
InetSocketAddress::ConvertFrom (from).GetPort ());
}
else if (Inet6SocketAddress::IsMatchingType (from))
{
NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " <<
Inet6SocketAddress::ConvertFrom (from).GetIpv6 ());
NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s server received " << packet->GetSize () << " bytes from " <<
Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " port " <<
InetSocketAddress::ConvertFrom (from).GetPort ());
}
packet->RemoveAllPacketTags ();
packet->RemoveAllByteTags ();
packet->RemoveAllPacketTags ();
packet->RemoveAllByteTags ();
NS_LOG_LOGIC ("Echoing packet");
socket->SendTo (packet, 0, from);
NS_LOG_LOGIC ("Echoing packet");
socket->SendTo (packet, 0, from);
if (InetSocketAddress::IsMatchingType (from))
{
NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s server sent " << packet->GetSize () << " bytes to " <<
InetSocketAddress::ConvertFrom (from).GetIpv4 () << " port " <<
InetSocketAddress::ConvertFrom (from).GetPort ());
}
else if (Inet6SocketAddress::IsMatchingType (from))
{
NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << "s server sent " << packet->GetSize () << " bytes to " <<
Inet6SocketAddress::ConvertFrom (from).GetIpv6 () << " port " <<
InetSocketAddress::ConvertFrom (from).GetPort ());
}
}
}

View File

@ -152,7 +152,7 @@ UdpServer::HandleRead (Ptr<Socket> socket)
NS_LOG_FUNCTION (this << socket);
Ptr<Packet> packet;
Address from;
while (packet = socket->RecvFrom (from))
while ((packet = socket->RecvFrom (from)))
{
if (packet->GetSize () > 0)
{

View File

@ -1,13 +1,27 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import wutils
from waflib import Options
def options(opt):
opt.add_option('--disable-gtk',
help=('Disable GTK+ support'),
dest='disable_gtk', default=False, action="store_true")
def configure(conf):
have_gtk = conf.pkg_check_modules('GTK_CONFIG_STORE', 'gtk+-2.0 >= 2.12', mandatory=False)
conf.env['ENABLE_GTK_CONFIG_STORE'] = have_gtk
conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
conf.env['ENABLE_GTK_CONFIG_STORE'],
"library 'gtk+-2.0 >= 2.12' not found")
if Options.options.disable_gtk:
conf.env['ENABLE_GTK_CONFIG_STORE'] = False
conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
conf.env['ENABLE_GTK_CONFIG_STORE'],
"--disable-gtk option given")
else:
have_gtk = conf.pkg_check_modules('GTK_CONFIG_STORE', 'gtk+-2.0 >= 2.12', mandatory=False)
conf.env['ENABLE_GTK_CONFIG_STORE'] = have_gtk
conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
conf.env['ENABLE_GTK_CONFIG_STORE'],
"library 'gtk+-2.0 >= 2.12' not found")
have_libxml2 = conf.pkg_check_modules('LIBXML2', 'libxml-2.0 >= 2.6', mandatory=False)
if have_libxml2:
conf.define('HAVE_LIBXML2', 1)

View File

@ -1,4 +1,5 @@
callback_classes = [
['void', 'unsigned char*', 'long', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'std::string', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
]

View File

@ -1,5 +1,6 @@
#include "ns3module.h"
#include "ns3/ref-count-base.h"
#include <unistd.h>
namespace {
@ -72,7 +73,6 @@ public:
} // closes: namespace {
PyObject *
_wrap_Simulator_Schedule (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs,
PyObject **return_exception)
@ -349,58 +349,104 @@ _wrap_CommandLine_AddValue (PyNs3CommandLine *self, PyObject *args, PyObject *kw
return Py_None;
}
class PythonSimulator
{
public:
PythonSimulator();
void Run(void);
bool IsFailed(void) const;
private:
void DoCheckSignals(void);
void DoRun(void);
volatile bool m_stopped;
bool m_failed;
volatile bool m_isCheckPending;
ns3::Ptr<ns3::SystemThread> m_thread;
PyThreadState *m_py_thread_state;
};
PythonSimulator::PythonSimulator()
: m_stopped(false),
m_failed(false),
m_isCheckPending(false)
{
m_thread = ns3::Create<ns3::SystemThread>(ns3::MakeCallback(&PythonSimulator::DoRun, this));
m_py_thread_state = NULL;
}
void
PythonSimulator::Run(void)
{
m_failed = false;
m_stopped = false;
m_isCheckPending = false;
m_thread->Start();
if (PyEval_ThreadsInitialized ())
{
m_py_thread_state = PyEval_SaveThread ();
}
ns3::Simulator::Run ();
m_stopped = true;
m_thread->Join();
if (m_py_thread_state)
{
PyEval_RestoreThread (m_py_thread_state);
}
}
bool
PythonSimulator::IsFailed(void) const
{
return m_failed;
}
void
PythonSimulator::DoCheckSignals(void)
{
if (m_py_thread_state)
{
PyEval_RestoreThread (m_py_thread_state);
}
PyErr_CheckSignals ();
if (PyErr_Occurred ())
{
m_failed = true;
ns3::Simulator::Stop();
}
if (PyEval_ThreadsInitialized ())
{
m_py_thread_state = PyEval_SaveThread ();
}
m_isCheckPending = false;
}
void
PythonSimulator::DoRun(void)
{
while (!m_stopped)
{
if (!m_isCheckPending)
{
m_isCheckPending = true;
ns3::Simulator::ScheduleWithContext(0xffffffff, ns3::Seconds(0.0),
&PythonSimulator::DoCheckSignals, this);
}
usleep(200000);
}
}
PyObject *
_wrap_Simulator_Run (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs,
PyObject **return_exception)
{
const char *keywords[] = { "signal_check_frequency", NULL};
int signal_check_frequency;
ns3::Ptr<ns3::DefaultSimulatorImpl> defaultSim =
ns3::DynamicCast<ns3::DefaultSimulatorImpl> (ns3::Simulator::GetImplementation ());
if (defaultSim) {
signal_check_frequency = 100;
} else {
signal_check_frequency = -1;
}
if (!PyArg_ParseTupleAndKeywords (args, kwargs, (char *) "|i", (char **) keywords, &signal_check_frequency)) {
PyObject *exc_type, *traceback;
PyErr_Fetch (&exc_type, return_exception, &traceback);
Py_XDECREF (exc_type);
Py_XDECREF (traceback);
return NULL;
}
PyThreadState *py_thread_state = NULL;
if (signal_check_frequency == -1)
PythonSimulator simulator;
simulator.Run();
if (simulator.IsFailed())
{
if (PyEval_ThreadsInitialized ())
py_thread_state = PyEval_SaveThread ();
ns3::Simulator::Run ();
if (py_thread_state)
PyEval_RestoreThread (py_thread_state);
} else {
while (!ns3::Simulator::IsFinished ())
{
if (PyEval_ThreadsInitialized ())
py_thread_state = PyEval_SaveThread ();
for (int n = signal_check_frequency; n > 0 && !ns3::Simulator::IsFinished (); --n)
{
ns3::Simulator::RunOneEvent ();
}
if (py_thread_state)
PyEval_RestoreThread (py_thread_state);
PyErr_CheckSignals ();
if (PyErr_Occurred ())
return NULL;
}
return NULL;
}
Py_INCREF (Py_None);
return Py_None;
}

View File

@ -1113,11 +1113,6 @@ def register_Ns3Simulator_methods(root_module, cls):
'bool',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Next() [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_static=True, deprecated=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function]
cls.add_method('Now',
'ns3::Time',
@ -1128,11 +1123,6 @@ def register_Ns3Simulator_methods(root_module, cls):
'void',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_static=True, deprecated=True)
## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function]
cls.add_method('SetImplementation',
'void',
@ -2122,11 +2112,6 @@ def register_Ns3SimulatorImpl_methods(root_module, cls):
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
@ -2142,11 +2127,6 @@ def register_Ns3SimulatorImpl_methods(root_module, cls):
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
@ -2284,20 +2264,22 @@ def register_Ns3Synchronizer_methods(root_module, cls):
def register_Ns3SystemThread_methods(root_module, cls):
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::SystemThread const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemThread const &', 'arg0')])
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [constructor]
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [constructor]
cls.add_constructor([param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
## system-thread.h (module 'core'): bool ns3::SystemThread::Break() [member function]
cls.add_method('Break',
## system-thread.h (module 'core'): static bool ns3::SystemThread::Equals(pthread_t id) [member function]
cls.add_method('Equals',
'bool',
[])
[param('pthread_t', 'id')],
is_static=True)
## system-thread.h (module 'core'): void ns3::SystemThread::Join() [member function]
cls.add_method('Join',
'void',
[])
## system-thread.h (module 'core'): void ns3::SystemThread::Shutdown() [member function]
cls.add_method('Shutdown',
'void',
[])
## system-thread.h (module 'core'): static pthread_t ns3::SystemThread::Self() [member function]
cls.add_method('Self',
'pthread_t',
[],
is_static=True)
## system-thread.h (module 'core'): void ns3::SystemThread::Start() [member function]
cls.add_method('Start',
'void',
@ -2851,11 +2833,6 @@ def register_Ns3DefaultSimulatorImpl_methods(root_module, cls):
'bool',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
@ -2871,11 +2848,6 @@ def register_Ns3DefaultSimulatorImpl_methods(root_module, cls):
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::EventId ns3::DefaultSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
@ -3552,11 +3524,6 @@ def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls):
'bool',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
@ -3577,11 +3544,6 @@ def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls):
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',

View File

@ -1113,11 +1113,6 @@ def register_Ns3Simulator_methods(root_module, cls):
'bool',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Next() [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_static=True, deprecated=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function]
cls.add_method('Now',
'ns3::Time',
@ -1128,11 +1123,6 @@ def register_Ns3Simulator_methods(root_module, cls):
'void',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_static=True, deprecated=True)
## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function]
cls.add_method('SetImplementation',
'void',
@ -2122,11 +2112,6 @@ def register_Ns3SimulatorImpl_methods(root_module, cls):
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
@ -2142,11 +2127,6 @@ def register_Ns3SimulatorImpl_methods(root_module, cls):
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
@ -2284,20 +2264,22 @@ def register_Ns3Synchronizer_methods(root_module, cls):
def register_Ns3SystemThread_methods(root_module, cls):
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::SystemThread const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemThread const &', 'arg0')])
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [constructor]
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [constructor]
cls.add_constructor([param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
## system-thread.h (module 'core'): bool ns3::SystemThread::Break() [member function]
cls.add_method('Break',
## system-thread.h (module 'core'): static bool ns3::SystemThread::Equals(pthread_t id) [member function]
cls.add_method('Equals',
'bool',
[])
[param('pthread_t', 'id')],
is_static=True)
## system-thread.h (module 'core'): void ns3::SystemThread::Join() [member function]
cls.add_method('Join',
'void',
[])
## system-thread.h (module 'core'): void ns3::SystemThread::Shutdown() [member function]
cls.add_method('Shutdown',
'void',
[])
## system-thread.h (module 'core'): static pthread_t ns3::SystemThread::Self() [member function]
cls.add_method('Self',
'pthread_t',
[],
is_static=True)
## system-thread.h (module 'core'): void ns3::SystemThread::Start() [member function]
cls.add_method('Start',
'void',
@ -2851,11 +2833,6 @@ def register_Ns3DefaultSimulatorImpl_methods(root_module, cls):
'bool',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::Time ns3::DefaultSimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
@ -2871,11 +2848,6 @@ def register_Ns3DefaultSimulatorImpl_methods(root_module, cls):
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): void ns3::DefaultSimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_virtual=True)
## default-simulator-impl.h (module 'core'): ns3::EventId ns3::DefaultSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
@ -3552,11 +3524,6 @@ def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls):
'bool',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
@ -3577,11 +3544,6 @@ def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls):
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',

View File

@ -48,7 +48,6 @@ class FakeNetDevice
public:
FakeNetDevice ();
void Doit3 (void);
void Doit4 (void);
};
FakeNetDevice::FakeNetDevice ()
@ -66,25 +65,11 @@ FakeNetDevice::Doit3 (void)
//
// Exercise the realtime relative now path
//
DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ())->ScheduleRealtimeNow (MakeEvent (&inserted_function));
Simulator::ScheduleWithContext(0xffffffff, Seconds(0.0), MakeEvent (&inserted_function));
usleep (1000);
}
}
void
FakeNetDevice::Doit4 (void)
{
NS_LOG_FUNCTION_NOARGS ();
sleep (1);
for (uint32_t i = 0; i < 10000; ++i)
{
//
// Exercise the realtime relative schedule path
//
DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ())->ScheduleRealtime (Seconds (0), MakeEvent (&inserted_function));
usleep (1000);
}
}
void
test (void)
@ -97,7 +82,7 @@ test (void)
//
// Make sure ScheduleNow works when the system isn't running
//
DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ())->ScheduleRealtimeNow (MakeEvent (&first_function));
Simulator::ScheduleWithContext(0xffffffff, Seconds(0.0), MakeEvent (&first_function));
//
// drive the progression of m_currentTs at a ten millisecond rate from the main thread
@ -111,14 +96,9 @@ test (void)
MakeCallback (&FakeNetDevice::Doit3, &fnd));
st3->Start ();
Ptr<SystemThread> st4 = Create<SystemThread> (
MakeCallback (&FakeNetDevice::Doit4, &fnd));
st4->Start ();
Simulator::Stop (Seconds (15.0));
Simulator::Run ();
st3->Join ();
st4->Join ();
Simulator::Destroy ();
}

View File

@ -125,7 +125,7 @@ CalendarScheduler::PeekNext (void) const
NS_ASSERT (!IsEmpty ());
uint32_t i = m_lastBucket;
uint64_t bucketTop = m_bucketTop;
Scheduler::Event minEvent = { 0, { ~0, ~0}};
Scheduler::Event minEvent = { static_cast<uint64_t>(0), { static_cast<uint32_t>(~0), static_cast<uint32_t>(~0)}};
do
{
if (!m_buckets[i].empty ())
@ -154,7 +154,12 @@ CalendarScheduler::DoRemoveNext (void)
{
uint32_t i = m_lastBucket;
uint64_t bucketTop = m_bucketTop;
Scheduler::Event minEvent = { 0, { ~0, ~0}};
int32_t minBucket = -1;
Scheduler::EventKey minKey;
NS_ASSERT(!IsEmpty());
minKey.m_ts = uint64_t(-int64_t(1));
minKey.m_uid = 0;
minKey.m_context = 0xffffffff;
do
{
if (!m_buckets[i].empty ())
@ -168,9 +173,10 @@ CalendarScheduler::DoRemoveNext (void)
m_buckets[i].pop_front ();
return next;
}
if (next.key < minEvent.key)
if (next.key < minKey)
{
minEvent = next;
minKey = next.key;
minBucket = i;
}
}
i++;
@ -179,12 +185,13 @@ CalendarScheduler::DoRemoveNext (void)
}
while (i != m_lastBucket);
m_lastPrio = minEvent.key.m_ts;
m_lastBucket = Hash (minEvent.key.m_ts);
m_bucketTop = (minEvent.key.m_ts / m_width + 1) * m_width;
m_buckets[m_lastBucket].pop_front ();
m_lastPrio = minKey.m_ts;
m_lastBucket = Hash (minKey.m_ts);
m_bucketTop = (minKey.m_ts / m_width + 1) * m_width;
Scheduler::Event next = m_buckets[minBucket].front();
m_buckets[minBucket].pop_front ();
return minEvent;
return next;
}
Scheduler::Event

View File

@ -379,42 +379,49 @@ Resolver::DoResolve (std::string path, Ptr<Object> root)
{
// this is a normal attribute.
TypeId tid = root->GetInstanceTypeId ();
struct TypeId::AttributeInformation info;
if (!tid.LookupAttributeByName (item, &info))
bool foundMatch = false;
for (uint32_t i = 0; i < tid.GetAttributeN(); i++)
{
NS_LOG_DEBUG ("Requested item="<<item<<" does not exist on path="<<GetResolvedPath ());
return;
}
// attempt to cast to a pointer checker.
const PointerChecker *ptr = dynamic_cast<const PointerChecker *> (PeekPointer (info.checker));
if (ptr != 0)
{
NS_LOG_DEBUG ("GetAttribute(ptr)="<<item<<" on path="<<GetResolvedPath ());
PointerValue ptr;
root->GetAttribute (item, ptr);
Ptr<Object> object = ptr.Get<Object> ();
if (object == 0)
struct TypeId::AttributeInformation info;
info = tid.GetAttribute(i);
if (info.name != item && item != "*")
{
NS_LOG_ERROR ("Requested object name=\""<<item<<
"\" exists on path=\""<<GetResolvedPath ()<<"\""
" but is null.");
return;
continue;
}
// attempt to cast to a pointer checker.
const PointerChecker *ptr = dynamic_cast<const PointerChecker *> (PeekPointer (info.checker));
if (ptr != 0)
{
NS_LOG_DEBUG ("GetAttribute(ptr)="<<info.name<<" on path="<<GetResolvedPath ());
PointerValue ptr;
root->GetAttribute (info.name, ptr);
Ptr<Object> object = ptr.Get<Object> ();
if (object == 0)
{
NS_LOG_ERROR ("Requested object name=\""<<item<<
"\" exists on path=\""<<GetResolvedPath ()<<"\""
" but is null.");
continue;
}
foundMatch = true;
m_workStack.push_back (info.name);
DoResolve (pathLeft, object);
m_workStack.pop_back ();
}
// attempt to cast to an object vector.
const ObjectPtrVectorChecker *vectorChecker =
dynamic_cast<const ObjectPtrVectorChecker *> (PeekPointer (info.checker));
if (vectorChecker != 0)
{
NS_LOG_DEBUG ("GetAttribute(vector)="<<info.name<<" on path="<<GetResolvedPath () << pathLeft);
foundMatch = true;
ObjectPtrVectorValue vector;
root->GetAttribute (info.name, vector);
m_workStack.push_back (info.name);
DoArrayResolve (pathLeft, vector);
m_workStack.pop_back ();
}
m_workStack.push_back (item);
DoResolve (pathLeft, object);
m_workStack.pop_back ();
}
// attempt to cast to an object vector.
const ObjectPtrVectorChecker *vectorChecker = dynamic_cast<const ObjectPtrVectorChecker *> (PeekPointer (info.checker));
if (vectorChecker != 0)
{
NS_LOG_DEBUG ("GetAttribute(vector)="<<item<<" on path="<<GetResolvedPath ());
ObjectPtrVectorValue vector;
root->GetAttribute (item, vector);
m_workStack.push_back (item);
DoArrayResolve (pathLeft, vector);
m_workStack.pop_back ();
}
// attempt to cast to an object map.
const ObjectPtrMapChecker *mapChecker = dynamic_cast<const ObjectPtrMapChecker *> (PeekPointer (info.checker));
if (mapChecker != 0)
@ -426,20 +433,27 @@ Resolver::DoResolve (std::string path, Ptr<Object> root)
DoMapResolve (pathLeft, map);
m_workStack.pop_back ();
}
// this could be anything else and we don't know what to do with it.
// So, we just ignore it.
// this could be anything else and we don't know what to do with it.
// So, we just ignore it.
}
if (!foundMatch)
{
NS_LOG_DEBUG ("Requested item="<<item<<" does not exist on path="<<GetResolvedPath ());
return;
}
}
}
void
Resolver::DoArrayResolve (std::string path, const ObjectPtrVectorValue &vector)
{
NS_LOG_FUNCTION(this << path);
NS_ASSERT (path != "");
NS_ASSERT ((path.find ("/")) == 0);
std::string::size_type next = path.find ("/", 1);
if (next == std::string::npos)
{
NS_FATAL_ERROR ("vector path includes no index data on path=\""<<path<<"\"");
return;
}
std::string item = path.substr (1, next-1);
std::string pathLeft = path.substr (next, path.size ()-next);
@ -566,7 +580,7 @@ ConfigImpl::LookupMatches (std::string path)
NS_LOG_FUNCTION (path);
class LookupMatchesResolver : public Resolver
{
public:
public:
LookupMatchesResolver (std::string path)
: Resolver (path)
{}

View File

@ -59,6 +59,8 @@ DefaultSimulatorImpl::DefaultSimulatorImpl ()
m_currentTs = 0;
m_currentContext = 0xffffffff;
m_unscheduledEvents = 0;
m_eventsWithContextEmpty = true;
m_main = SystemThread::Self();
}
DefaultSimulatorImpl::~DefaultSimulatorImpl ()
@ -128,6 +130,8 @@ DefaultSimulatorImpl::ProcessOneEvent (void)
m_currentUid = next.key.m_uid;
next.impl->Invoke ();
next.impl->Unref ();
ProcessEventsWithContext ();
}
bool
@ -136,24 +140,44 @@ DefaultSimulatorImpl::IsFinished (void) const
return m_events->IsEmpty () || m_stop;
}
uint64_t
DefaultSimulatorImpl::NextTs (void) const
void
DefaultSimulatorImpl::ProcessEventsWithContext (void)
{
NS_ASSERT (!m_events->IsEmpty ());
Scheduler::Event ev = m_events->PeekNext ();
return ev.key.m_ts;
}
if (m_eventsWithContextEmpty)
{
return;
}
Time
DefaultSimulatorImpl::Next (void) const
{
return TimeStep (NextTs ());
// swap queues
EventsWithContext eventsWithContext;
{
CriticalSection cs (m_eventsWithContextMutex);
m_eventsWithContext.swap(eventsWithContext);
m_eventsWithContextEmpty = true;
}
while (!eventsWithContext.empty ())
{
EventWithContext event = eventsWithContext.front ();
eventsWithContext.pop_front ();
Scheduler::Event ev;
ev.impl = event.event;
ev.key.m_ts = m_currentTs + event.timestamp;
ev.key.m_context = event.context;
ev.key.m_uid = m_uid;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
}
}
void
DefaultSimulatorImpl::Run (void)
{
// Set the current threadId as the main threadId
m_main = SystemThread::Self();
ProcessEventsWithContext ();
m_stop = false;
while (!m_events->IsEmpty () && !m_stop)
{
ProcessOneEvent ();
@ -164,12 +188,6 @@ DefaultSimulatorImpl::Run (void)
NS_ASSERT (!m_events->IsEmpty () || m_unscheduledEvents == 0);
}
void
DefaultSimulatorImpl::RunOneEvent (void)
{
ProcessOneEvent ();
}
void
DefaultSimulatorImpl::Stop (void)
{
@ -188,6 +206,8 @@ DefaultSimulatorImpl::Stop (Time const &time)
EventId
DefaultSimulatorImpl::Schedule (Time const &time, EventImpl *event)
{
NS_ASSERT_MSG (SystemThread::Equals (m_main), "Simulator::Schedule Thread-unsafe invocation!");
Time tAbsolute = time + TimeStep (m_currentTs);
NS_ASSERT (tAbsolute.IsPositive ());
@ -208,19 +228,37 @@ DefaultSimulatorImpl::ScheduleWithContext (uint32_t context, Time const &time, E
{
NS_LOG_FUNCTION (this << context << time.GetTimeStep () << m_currentTs << event);
Scheduler::Event ev;
ev.impl = event;
ev.key.m_ts = m_currentTs + time.GetTimeStep ();
ev.key.m_context = context;
ev.key.m_uid = m_uid;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
if (SystemThread::Equals (m_main))
{
Time tAbsolute = time + TimeStep (m_currentTs);
Scheduler::Event ev;
ev.impl = event;
ev.key.m_ts = (uint64_t) tAbsolute.GetTimeStep ();
ev.key.m_context = context;
ev.key.m_uid = m_uid;
m_uid++;
m_unscheduledEvents++;
m_events->Insert (ev);
}
else
{
EventWithContext ev;
ev.context = context;
ev.timestamp = time.GetTimeStep ();
ev.event = event;
{
CriticalSection cs (m_eventsWithContextMutex);
m_eventsWithContext.push_back(ev);
m_eventsWithContextEmpty = false;
}
}
}
EventId
DefaultSimulatorImpl::ScheduleNow (EventImpl *event)
{
NS_ASSERT_MSG (SystemThread::Equals (m_main), "Simulator::ScheduleNow Thread-unsafe invocation!");
Scheduler::Event ev;
ev.impl = event;
ev.key.m_ts = m_currentTs;
@ -235,6 +273,8 @@ DefaultSimulatorImpl::ScheduleNow (EventImpl *event)
EventId
DefaultSimulatorImpl::ScheduleDestroy (EventImpl *event)
{
NS_ASSERT_MSG (SystemThread::Equals (m_main), "Simulator::ScheduleDestroy Thread-unsafe invocation!");
EventId id (Ptr<EventImpl> (event, false), m_currentTs, 0xffffffff, 2);
m_destroyEvents.push_back (id);
m_uid++;

View File

@ -24,6 +24,8 @@
#include "simulator-impl.h"
#include "scheduler.h"
#include "event-impl.h"
#include "system-thread.h"
#include "ns3/system-mutex.h"
#include "ptr.h"
@ -41,7 +43,6 @@ public:
virtual void Destroy ();
virtual bool IsFinished (void) const;
virtual Time Next (void) const;
virtual void Stop (void);
virtual void Stop (Time const &time);
virtual EventId Schedule (Time const &time, EventImpl *event);
@ -52,7 +53,6 @@ public:
virtual void Cancel (const EventId &ev);
virtual bool IsExpired (const EventId &ev) const;
virtual void Run (void);
virtual void RunOneEvent (void);
virtual Time Now (void) const;
virtual Time GetDelayLeft (const EventId &id) const;
virtual Time GetMaximumSimulationTime (void) const;
@ -63,12 +63,23 @@ public:
private:
virtual void DoDispose (void);
void ProcessOneEvent (void);
uint64_t NextTs (void) const;
typedef std::list<EventId> DestroyEvents;
void ProcessEventsWithContext (void);
struct EventWithContext {
uint32_t context;
uint64_t timestamp;
EventImpl *event;
};
typedef std::list<struct EventWithContext> EventsWithContext;
EventsWithContext m_eventsWithContext;
bool m_eventsWithContextEmpty;
SystemMutex m_eventsWithContextMutex;
typedef std::list<EventId> DestroyEvents;
DestroyEvents m_destroyEvents;
bool m_stop;
Ptr<Scheduler> m_events;
uint32_t m_uid;
uint32_t m_currentUid;
uint64_t m_currentTs;
@ -76,6 +87,8 @@ private:
// number of events that have been inserted but not yet scheduled,
// not counting the "destroy" events; this is used for validation
int m_unscheduledEvents;
SystemThread::ThreadId m_main;
};
} // namespace ns3

View File

@ -107,7 +107,7 @@ void
FlushStreams (void)
{
std::list<std::ostream*> **pl = PeekStreamList ();
if (pl == 0)
if (*pl == 0)
{
return;
}

View File

@ -80,6 +80,8 @@ RealtimeSimulatorImpl::RealtimeSimulatorImpl ()
m_currentContext = 0xffffffff;
m_unscheduledEvents = 0;
m_main = SystemThread::Self();
// Be very careful not to do anything that would cause a change or assignment
// of the underlying reference counts of m_synchronizer or you will be sorry.
m_synchronizer = CreateObject<WallClockSynchronizer> ();
@ -93,7 +95,7 @@ void
RealtimeSimulatorImpl::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
while (m_events->IsEmpty () == false)
while (!m_events->IsEmpty ())
{
Scheduler::Event next = m_events->RemoveNext ();
next.impl->Unref ();
@ -406,16 +408,6 @@ RealtimeSimulatorImpl::NextTs (void) const
return ev.key.m_ts;
}
//
// Calls NextTs(). Should be called with critical section locked.
//
Time
RealtimeSimulatorImpl::Next (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return TimeStep (NextTs ());
}
void
RealtimeSimulatorImpl::Run (void)
{
@ -424,31 +416,41 @@ RealtimeSimulatorImpl::Run (void)
NS_ASSERT_MSG (m_running == false,
"RealtimeSimulatorImpl::Run(): Simulator already running");
// Set the current threadId as the main threadId
m_main = SystemThread::Self();
m_stop = false;
m_running = true;
m_synchronizer->SetOrigin (m_currentTs);
for (;;)
// Sleep until signalled
uint64_t tsNow;
uint64_t tsDelay = 1000000000; // wait time of 1 second (in nanoseconds)
while (!m_stop)
{
bool done = false;
bool process = false;
{
CriticalSection cs (m_mutex);
//
// In all cases we stop when the event list is empty. If you are doing a
// realtime simulation and you want it to extend out for some time, you must
// call StopAt. In the realtime case, this will stick a placeholder event out
// at the end of time.
//
if (m_stop || m_events->IsEmpty ())
if (!m_events->IsEmpty ())
{
done = true;
process = true;
}
else
{
// Get current timestamp while holding the critical section
tsNow = m_synchronizer->GetCurrentRealtime ();
}
}
if (done)
if (!process)
{
break;
// Sleep until signalled
tsNow = m_synchronizer->Synchronize (tsNow, tsDelay);
// Re-check event queue
continue;
}
ProcessOneEvent ();
@ -482,50 +484,6 @@ RealtimeSimulatorImpl::Realtime (void) const
return m_synchronizer->Realtime ();
}
//
// This will run the first event on the queue without considering any realtime
// synchronization. It's mainly implemented to allow simulations requiring
// the multithreaded ScheduleRealtimeNow() functions the possibility of driving
// the simulation from their own event loop.
//
// It is expected that if there are any realtime requirements, the responsibility
// for synchronizing with real time in an external event loop will be picked up
// by that loop. For example, they may call Simulator::Next() to find the
// execution time of the next event and wait for that time somehow -- then call
// RunOneEvent to fire the event.
//
void
RealtimeSimulatorImpl::RunOneEvent (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_ASSERT_MSG (m_running == false,
"RealtimeSimulatorImpl::RunOneEvent(): An internal simulator event loop is running");
EventImpl *event = 0;
//
// Run this in a critical section in case there's another thread around that
// may be inserting things onto the event list.
//
{
CriticalSection cs (m_mutex);
Scheduler::Event next = m_events->RemoveNext ();
NS_ASSERT (next.key.m_ts >= m_currentTs);
m_unscheduledEvents--;
NS_LOG_LOGIC ("handle " << next.key.m_ts);
m_currentTs = next.key.m_ts;
m_currentContext = next.key.m_context;
m_currentUid = next.key.m_uid;
event = next.impl;
}
event->Invoke ();
event->Unref ();
}
void
RealtimeSimulatorImpl::Stop (void)
{
@ -581,7 +539,20 @@ RealtimeSimulatorImpl::ScheduleWithContext (uint32_t context, Time const &time,
CriticalSection cs (m_mutex);
uint64_t ts;
ts = m_currentTs + time.GetTimeStep ();
if (SystemThread::Equals (m_main))
{
ts = m_currentTs + time.GetTimeStep ();
}
else
{
//
// If the simulator is running, we're pacing and have a meaningful
// realtime clock. If we're not, then m_currentTs is where we stopped.
//
ts = m_running ? m_synchronizer->GetCurrentRealtime () : m_currentTs;
ts += time.GetTimeStep ();
}
NS_ASSERT_MSG (ts >= m_currentTs, "RealtimeSimulatorImpl::ScheduleRealtime(): schedule for time < m_currentTs");
Scheduler::Event ev;
ev.impl = impl;

View File

@ -20,6 +20,7 @@
#define REALTIME_SIMULATOR_IMPL_H
#include "simulator-impl.h"
#include "system-thread.h"
#include "scheduler.h"
#include "synchronizer.h"
@ -53,7 +54,6 @@ public:
virtual void Destroy ();
virtual bool IsFinished (void) const;
virtual Time Next (void) const;
virtual void Stop (void);
virtual void Stop (Time const &time);
virtual EventId Schedule (Time const &time, EventImpl *event);
@ -64,7 +64,6 @@ public:
virtual void Cancel (const EventId &ev);
virtual bool IsExpired (const EventId &ev) const;
virtual void Run (void);
virtual void RunOneEvent (void);
virtual Time Now (void) const;
virtual Time GetDelayLeft (const EventId &id) const;
virtual Time GetMaximumSimulationTime (void) const;
@ -87,9 +86,8 @@ public:
private:
bool Running (void) const;
bool Realtime (void) const;
void ProcessOneEvent (void);
uint64_t NextTs (void) const;
void ProcessOneEvent (void);
virtual void DoDispose (void);
typedef std::list<EventId> DestroyEvents;
@ -118,6 +116,8 @@ private:
* The maximum allowable drift from real-time in SYNC_HARD_LIMIT mode.
*/
Time m_hardLimit;
SystemThread::ThreadId m_main;
};
} // namespace ns3

View File

@ -54,12 +54,6 @@ public:
* return true. Return false otherwise.
*/
virtual bool IsFinished (void) const = 0;
/**
* If Simulator::IsFinished returns true, the behavior of this
* method is undefined. Otherwise, it returns the microsecond-based
* time of the next event expected to be scheduled.
*/
virtual Time Next (void) const = 0;
/**
* If an event invokes this method, it will be the last
* event scheduled by the Simulator::run method before
@ -156,10 +150,6 @@ public:
* is greater than or equal to the stop time.
*/
virtual void Run (void) = 0;
/**
* Process only the next simulation event, then return immediately.
*/
virtual void RunOneEvent (void) = 0;
/**
* Return the "current simulation time".
*/

View File

@ -149,13 +149,6 @@ Simulator::IsFinished (void)
return GetImpl ()->IsFinished ();
}
Time
Simulator::Next (void)
{
NS_LOG_FUNCTION_NOARGS ();
return GetImpl ()->Next ();
}
void
Simulator::Run (void)
{
@ -163,13 +156,6 @@ Simulator::Run (void)
GetImpl ()->Run ();
}
void
Simulator::RunOneEvent (void)
{
NS_LOG_FUNCTION_NOARGS ();
GetImpl ()->RunOneEvent ();
}
void
Simulator::Stop (void)
{

View File

@ -101,12 +101,6 @@ public:
* return true. Return false otherwise.
*/
static bool IsFinished (void);
/**
* If Simulator::IsFinished returns true, the behavior of this
* method is undefined. Otherwise, it returns the microsecond-based
* time of the next event expected to be scheduled.
*/
static Time Next (void) NS_DEPRECATED;
/**
* Run the simulation until one of:
@ -118,11 +112,6 @@ public:
*/
static void Run (void);
/**
* Process only the next simulation event, then return immediately.
*/
static void RunOneEvent (void) NS_DEPRECATED;
/**
* If an event invokes this method, it will be the last
* event scheduled by the Simulator::run method before
@ -286,6 +275,7 @@ public:
/**
* Schedule an event with the given context.
* A context of 0xffffffff means no context is specified.
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
@ -296,6 +286,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj);
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param mem_ptr member method pointer to invoke
@ -306,6 +298,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj, T1 a1);
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param mem_ptr member method pointer to invoke
@ -317,6 +311,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param mem_ptr member method pointer to invoke
@ -330,6 +326,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param mem_ptr member method pointer to invoke
@ -344,6 +342,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param mem_ptr member method pointer to invoke
@ -359,6 +359,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj,
T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param f the function to invoke
@ -366,6 +368,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(void));
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param f the function to invoke
@ -375,6 +379,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1), T1 a1);
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param f the function to invoke
@ -385,6 +391,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2), T1 a1, T2 a2);
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param f the function to invoke
@ -396,6 +404,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3);
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param f the function to invoke
@ -409,6 +419,8 @@ public:
static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
/**
* This method is thread-safe: it can be called from any thread.
*
* @param time the relative expiration time of the event.
* @param context user-specified context parameter
* @param f the function to invoke
@ -743,6 +755,8 @@ public:
static EventId Schedule (Time const &time, const Ptr<EventImpl> &event);
/**
* This method is thread-safe: it can be called from any thread.
*
* \param time delay until the event expires
* \param context event context
* \param event the event to schedule

View File

@ -44,6 +44,9 @@
#include <sys/sysctl.h>
#endif
#ifdef __linux__
#include <unistd.h>
#endif
#if defined (__win32__)
#define SYSTEM_PATH_SEP "\\"

View File

@ -0,0 +1,96 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 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 <mathieu.lacage.inria.fr>
*/
#include "fatal-error.h"
#include "system-thread.h"
#include "log.h"
#include <string.h>
NS_LOG_COMPONENT_DEFINE ("SystemThread");
namespace ns3 {
#ifdef HAVE_PTHREAD_H
SystemThread::SystemThread (Callback<void> callback)
: m_callback (callback)
{
NS_LOG_FUNCTION (this);
}
SystemThread::~SystemThread()
{
NS_LOG_FUNCTION (this);
}
void
SystemThread::Start (void)
{
NS_LOG_FUNCTION (this);
int rc = pthread_create (&m_thread, NULL, &SystemThread::DoRun,
(void *)this);
if (rc)
{
NS_FATAL_ERROR ("pthread_create failed: " << rc << "=\"" <<
strerror (rc) << "\".");
}
}
void
SystemThread::Join (void)
{
NS_LOG_FUNCTION (this);
void *thread_return;
int rc = pthread_join (m_thread, &thread_return);
if (rc)
{
NS_FATAL_ERROR ("pthread_join failed: " << rc << "=\"" <<
strerror (rc) << "\".");
}
}
void *
SystemThread::DoRun (void *arg)
{
NS_LOG_FUNCTION (arg);
SystemThread *self = static_cast<SystemThread *> (arg);
self->m_callback ();
return 0;
}
SystemThread::ThreadId
SystemThread::Self (void)
{
return pthread_self ();
}
bool
SystemThread::Equals (SystemThread::ThreadId id)
{
return (pthread_equal (pthread_self (), id) != 0);
}
#endif /* HAVE_PTHREAD_H */
} // namespace ns3

View File

@ -21,12 +21,14 @@
#ifndef SYSTEM_THREAD_H
#define SYSTEM_THREAD_H
#include "ns3/core-config.h"
#include "callback.h"
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif /* HAVE_PTHREAD_H */
namespace ns3 {
class SystemThreadImpl;
/**
* @brief A class which provides a relatively platform-independent thread
* primitive.
@ -45,6 +47,11 @@ class SystemThreadImpl;
class SystemThread : public SimpleRefCount<SystemThread>
{
public:
#ifdef HAVE_PTHREAD_H
typedef pthread_t ThreadId;
#endif
/**
* @brief Create a SystemThread object.
*
@ -94,10 +101,6 @@ public:
*
* @param callback entry point of the thread
*
* @warning The SystemThread uses SIGALRM to wake threads that are possibly
* blocked on IO.
* @see Shutdown
*
* @warning I've made the system thread class look like a normal ns3 object
* with smart pointers, and living in the heap. This makes it very easy to
* manage threads from a single master thread context. You should be very
@ -125,47 +128,28 @@ public:
* provided callback, finishes.
*/
void Join (void);
/**
* @brief Returns the current thread Id.
*
* @returns current thread Id.
*/
static ThreadId Self(void);
/**
* @brief Indicates to a managed thread doing cooperative multithreading that
* its managing thread wants it to exit.
* @brief Compares an TharedId with the current ThreadId .
*
* It is often the case that we want a thread to be off doing work until such
* time as its job is done (typically when the simulation is done). We then
* want the thread to exit itself. This method provides a consistent way for
* the managing thread to communicate with the managed thread. After the
* manager thread calls this method, the Break() method will begin returning
* true, telling the managed thread to exit.
*
* This alone isn't really enough to merit these events, but in Unix, if a
* worker thread is doing blocking IO, it will need to be woken up from that
* read somehow. This method also provides that functionality, by sending a
* SIGALRM signal to the possibly blocked thread.
*
* @warning Uses SIGALRM to notify threads possibly blocked on IO. Beware
* if you are using signals.
* @see Break
* @returns true if Id matches the current ThreadId.
*/
void Shutdown (void);
/**
* @brief Indicates to a thread doing cooperative multithreading that
* its managing thread wants it to exit.
*
* It is often the case that we want a thread to be off doing work until such
* time as its job is done. We then want the thread to exit itself. This
* method allows a thread to query whether or not it should be running.
* Typically, the worker thread is running in a forever-loop, and will need to
* "break" out of that loop to exit -- thus the name.
*
* @see Shutdown
* @returns true if thread is expected to exit (break out of the forever-loop)
*/
bool Break (void);
static bool Equals(ThreadId id);
private:
SystemThreadImpl * m_impl;
bool m_break;
#ifdef HAVE_PTHREAD_H
static void *DoRun (void *arg);
Callback<void> m_callback;
pthread_t m_thread;
void * m_ret;
#endif
};
} // namespace ns3

View File

@ -1,183 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 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 <mathieu.lacage.inria.fr>
*/
#include <pthread.h>
#include <string.h>
#include <signal.h>
#include "fatal-error.h"
#include "system-thread.h"
#include "log.h"
NS_LOG_COMPONENT_DEFINE ("SystemThread");
namespace ns3 {
//
// Private implementation class for the SystemThread class. The deal is
// that we export the SystemThread class to the user. The header just
// declares a class and its members. There is a forward declaration for
// a private implementation class there and a member declaration. Thus
// there is no knowledge of the implementation in the exported header.
//
// We provide an implementation class for each operating system. This is
// the Unix implementation of the SystemThread.
//
// In order to use the SystemThread, you will include "system-thread.h" and
// get the implementation by linking unix-system-thread.cc (if you are running
// a Posix system).
//
class SystemThreadImpl
{
public:
SystemThreadImpl (Callback<void> callback);
void Start (void);
void Join (void);
void Shutdown (void);
bool Break (void);
private:
static void *DoRun (void *arg);
Callback<void> m_callback;
pthread_t m_thread;
bool m_break;
void * m_ret;
};
SystemThreadImpl::SystemThreadImpl (Callback<void> callback)
: m_callback (callback), m_break (false)
{
NS_LOG_FUNCTION_NOARGS ();
// Make sure we have a SIGALRM handler which does not terminate
// our process.
struct sigaction act;
act.sa_flags = 0;
sigemptyset (&act.sa_mask);
act.sa_handler = SIG_IGN;
sigaction (SIGALRM, &act, 0);
}
void
SystemThreadImpl::Start (void)
{
NS_LOG_FUNCTION_NOARGS ();
int rc = pthread_create (&m_thread, NULL, &SystemThreadImpl::DoRun,
(void *)this);
if (rc)
{
NS_FATAL_ERROR ("pthread_create failed: " << rc << "=\"" <<
strerror (rc) << "\".");
}
}
void
SystemThreadImpl::Join (void)
{
NS_LOG_FUNCTION_NOARGS ();
void *thread_return;
int rc = pthread_join (m_thread, &thread_return);
if (rc)
{
NS_FATAL_ERROR ("pthread_join failed: " << rc << "=\"" <<
strerror (rc) << "\".");
}
}
void
SystemThreadImpl::Shutdown (void)
{
NS_LOG_FUNCTION_NOARGS ();
m_break = true;
// send a SIGALRM signal on the target thread to make sure that it
// will unblock.
pthread_kill (m_thread, SIGALRM);
}
bool
SystemThreadImpl::Break (void)
{
NS_LOG_FUNCTION_NOARGS ();
return m_break;
}
void *
SystemThreadImpl::DoRun (void *arg)
{
NS_LOG_FUNCTION_NOARGS ();
SystemThreadImpl *self = static_cast<SystemThreadImpl *> (arg);
self->m_callback ();
return 0;
}
//
// Remember that we just export the delcaration of the SystemThread class to
// the user. There is no code to implement the SystemThread methods. We
// have to do that here. We just vector the calls to our implementation
// class above.
//
SystemThread::SystemThread (Callback<void> callback)
: m_impl (new SystemThreadImpl (callback)), m_break (false)
{
NS_LOG_FUNCTION_NOARGS ();
}
SystemThread::~SystemThread()
{
NS_LOG_FUNCTION_NOARGS ();
delete m_impl;
}
void
SystemThread::Start (void)
{
NS_LOG_FUNCTION_NOARGS ();
m_impl->Start ();
}
void
SystemThread::Join (void)
{
NS_LOG_FUNCTION_NOARGS ();
m_impl->Join ();
}
void
SystemThread::Shutdown (void)
{
NS_LOG_FUNCTION_NOARGS ();
m_impl->Shutdown ();
}
bool
SystemThread::Break (void)
{
NS_LOG_FUNCTION_NOARGS ();
return m_impl->Break ();
}
} // namespace ns3

View File

@ -21,6 +21,7 @@
#include "system-wall-clock-ms.h"
#include "abort.h"
#include <sys/times.h>
#include <unistd.h>
namespace ns3 {

View File

@ -242,6 +242,7 @@ UnderRootNamespaceConfigTestCase::DoRun (void)
a->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 1, "Object Attribute \"A\" not set correctly");
//
// We should find the default values of "B" too.
//
@ -292,6 +293,16 @@ UnderRootNamespaceConfigTestCase::DoRun (void)
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 4, "Object Attribute \"A\" not set as expected");
b->GetAttribute ("B", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), -4, "Object Attribute \"B\" not set as expected");
//
// Try '*' for attributes
//
Config::Set ("/*/A", IntegerValue (2));
a->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 2, "Object Attribute \"A\" not set correctly");
b->GetAttribute ("A", iv);
NS_TEST_ASSERT_MSG_EQ (iv.Get (), 4, "Object Attribute \"A\" not set correctly");
}
// ===========================================================================

View File

@ -0,0 +1,268 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 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: Claudio Freire <claudio-daniel.freire@inria.fr>
*/
#include "ns3/test.h"
#include "ns3/simulator.h"
#include "ns3/list-scheduler.h"
#include "ns3/heap-scheduler.h"
#include "ns3/map-scheduler.h"
#include "ns3/calendar-scheduler.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/system-thread.h"
#include <time.h>
#include <list>
#include <utility>
namespace ns3 {
#define MAXTHREADS 64
class ThreadedSimulatorEventsTestCase : public TestCase
{
public:
ThreadedSimulatorEventsTestCase (ObjectFactory schedulerFactory, const std::string &simulatorType, unsigned int threads);
void A (int a);
void B (int b);
void C (int c);
void D (int d);
void DoNothing (unsigned int threadno);
static void SchedulingThread (std::pair<ThreadedSimulatorEventsTestCase *, unsigned int> context);
void End (void);
uint64_t m_b;
uint64_t m_a;
uint64_t m_c;
uint64_t m_d;
unsigned int m_threads;
bool m_threadWaiting[MAXTHREADS];
bool m_stop;
ObjectFactory m_schedulerFactory;
std::string m_simulatorType;
std::string m_error;
std::list<Ptr<SystemThread> > m_threadlist;
private:
virtual void DoSetup (void);
virtual void DoRun (void);
virtual void DoTeardown (void);
};
ThreadedSimulatorEventsTestCase::ThreadedSimulatorEventsTestCase (ObjectFactory schedulerFactory, const std::string &simulatorType, unsigned int threads)
: TestCase ("Check that threaded event handling is working with " +
schedulerFactory.GetTypeId ().GetName () + " in " + simulatorType),
m_threads (threads),
m_schedulerFactory (schedulerFactory),
m_simulatorType (simulatorType)
{
}
void
ThreadedSimulatorEventsTestCase::End (void)
{
m_stop = true;
for (std::list<Ptr<SystemThread> >::iterator it2 = m_threadlist.begin(); it2 != m_threadlist.end(); ++it2)
{
(*it2)->Join();
}
}
void
ThreadedSimulatorEventsTestCase::SchedulingThread (std::pair<ThreadedSimulatorEventsTestCase *, unsigned int> context)
{
ThreadedSimulatorEventsTestCase *me = context.first;
unsigned int threadno = context.second;
while (!me->m_stop)
{
me->m_threadWaiting[threadno] = true;
Simulator::ScheduleWithContext (uint32_t (-1),
MicroSeconds (1),
&ThreadedSimulatorEventsTestCase::DoNothing, me, threadno);
while (!me->m_stop && me->m_threadWaiting[threadno])
{
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 500;
nanosleep(&ts, NULL);
}
}
}
void
ThreadedSimulatorEventsTestCase::DoNothing (unsigned int threadno)
{
if (!m_error.empty())
{
m_error = "Bad threaded scheduling";
}
m_threadWaiting[threadno] = false;
}
void
ThreadedSimulatorEventsTestCase::A (int a)
{
if (m_a != m_b || m_a != m_c || m_a != m_d)
{
m_error = "Bad scheduling";
Simulator::Stop();
};
++m_a;
Simulator::Schedule (MicroSeconds (10),
&ThreadedSimulatorEventsTestCase::B, this, a+1);
}
void
ThreadedSimulatorEventsTestCase::B (int b)
{
if (m_a != (m_b+1) || m_a != (m_c+1) || m_a != (m_d+1))
{
m_error = "Bad scheduling";
Simulator::Stop();
};
++m_b;
Simulator::Schedule (MicroSeconds (10),
&ThreadedSimulatorEventsTestCase::C, this, b+1);
}
void
ThreadedSimulatorEventsTestCase::C (int c)
{
if (m_a != m_b || m_a != (m_c+1) || m_a != (m_d+1))
{
m_error = "Bad scheduling";
Simulator::Stop();
};
++m_c;
Simulator::Schedule (MicroSeconds (10),
&ThreadedSimulatorEventsTestCase::D, this, c+1);
}
void
ThreadedSimulatorEventsTestCase::D (int d)
{
if (m_a != m_b || m_a != m_c || m_a != (m_d+1))
{
m_error = "Bad scheduling";
Simulator::Stop();
};
++m_d;
if (m_stop)
{
Simulator::Stop();
}
else
{
Simulator::Schedule (MicroSeconds (10),
&ThreadedSimulatorEventsTestCase::A, this, d+1);
}
}
void
ThreadedSimulatorEventsTestCase::DoSetup (void)
{
if (!m_simulatorType.empty())
{
Config::SetGlobal ("SimulatorImplementationType", StringValue (m_simulatorType));
}
m_error = "";
m_a =
m_b =
m_c =
m_d = 0;
for (unsigned int i=0; i < m_threads; ++i)
{
m_threadlist.push_back(
Create<SystemThread> (MakeBoundCallback (
&ThreadedSimulatorEventsTestCase::SchedulingThread,
std::pair<ThreadedSimulatorEventsTestCase *, unsigned int>(this,i) )) );
}
}
void
ThreadedSimulatorEventsTestCase::DoTeardown (void)
{
m_threadlist.clear();
Config::SetGlobal ("SimulatorImplementationType", StringValue ("ns3::DefaultSimulatorImpl"));
}
void
ThreadedSimulatorEventsTestCase::DoRun (void)
{
m_stop = false;
Simulator::SetScheduler (m_schedulerFactory);
Simulator::Schedule (MicroSeconds (10), &ThreadedSimulatorEventsTestCase::A, this, 1);
Simulator::Schedule (Seconds (1), &ThreadedSimulatorEventsTestCase::End, this);
for (std::list<Ptr<SystemThread> >::iterator it = m_threadlist.begin(); it != m_threadlist.end(); ++it)
{
(*it)->Start();
}
Simulator::Run ();
Simulator::Destroy ();
NS_TEST_EXPECT_MSG_EQ (m_error.empty(), true, m_error.c_str());
NS_TEST_EXPECT_MSG_EQ (m_a, m_b, "Bad scheduling");
NS_TEST_EXPECT_MSG_EQ (m_a, m_c, "Bad scheduling");
NS_TEST_EXPECT_MSG_EQ (m_a, m_d, "Bad scheduling");
}
class ThreadedSimulatorTestSuite : public TestSuite
{
public:
ThreadedSimulatorTestSuite ()
: TestSuite ("threaded-simulator")
{
std::string simulatorTypes[] = {
#ifdef HAVE_RT
"ns3::RealtimeSimulatorImpl",
#endif
"ns3::DefaultSimulatorImpl"
};
std::string schedulerTypes[] = {
"ns3::ListScheduler",
"ns3::HeapScheduler",
"ns3::MapScheduler",
"ns3::CalendarScheduler"
};
unsigned int threadcounts[] = {
0,
2,
10,
20
};
ObjectFactory factory;
for (unsigned int i=0; i < (sizeof(simulatorTypes) / sizeof(simulatorTypes[0])); ++i)
{
for (unsigned int j=0; j < (sizeof(threadcounts) / sizeof(threadcounts[0])); ++j)
{
for (unsigned int k=0; k < (sizeof(schedulerTypes) / sizeof(schedulerTypes[0])); ++k)
{
factory.SetTypeId(schedulerTypes[k]);
AddTestCase (new ThreadedSimulatorEventsTestCase (factory, simulatorTypes[i], threadcounts[j]));
}
}
}
}
} g_threadedSimulatorTestSuite;
} // namespace ns3

View File

@ -285,13 +285,14 @@ def build(bld):
if env['ENABLE_THREADING']:
core.source.extend([
'model/system-thread.cc',
'model/unix-fd-reader.cc',
'model/unix-system-thread.cc',
'model/unix-system-mutex.cc',
'model/unix-system-condition.cc',
])
core.use.append('PTHREAD')
core_test.use.append('PTHREAD')
core_test.source.extend(['test/threaded-test-suite.cc'])
headers.source.extend([
'model/unix-fd-reader.h',
'model/system-mutex.h',

View File

@ -18,11 +18,11 @@
#include <sstream>
// ns3 includes
#include "ns3/animation-interface.h"
#include "ns3/csma-star-helper.h"
#include "ns3/node-list.h"
#include "ns3/point-to-point-net-device.h"
#include "ns3/vector.h"
#include "ns3/log.h"
NS_LOG_COMPONENT_DEFINE ("CsmaStarHelper");

View File

@ -3131,6 +3131,11 @@ def register_Ns3Socket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',

View File

@ -3131,6 +3131,11 @@ def register_Ns3Socket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',

View File

@ -840,7 +840,7 @@ RoutingProtocol::SendPeriodicUpdate ()
m_routingTable.Purge (removedAddresses);
MergeTriggerPeriodicUpdates ();
m_routingTable.GetListOfAllRoutes (allRoutes);
if (allRoutes.size () < 0)
if (allRoutes.empty ())
{
return;
}

View File

@ -1,4 +1,5 @@
callback_classes = [
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'],

View File

@ -20,8 +20,6 @@ def module_init():
def register_types(module):
root_module = module.get_root()
## log.h (module 'core'): ns3::LogLevel [enumeration]
module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME', 'LOG_PREFIX_NODE'], import_from_module='ns.core')
## address.h (module 'network'): ns3::Address [class]
module.add_class('Address', import_from_module='ns.network')
## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration]
@ -68,8 +66,6 @@ def register_types(module):
root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address'])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class]
module.add_class('Ipv6Prefix', import_from_module='ns.network')
## log.h (module 'core'): ns3::LogComponent [class]
module.add_class('LogComponent', import_from_module='ns.core')
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
module.add_class('Mac48Address', import_from_module='ns.network')
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
@ -142,12 +138,6 @@ def register_types(module):
module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object'])
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object'])
## scheduler.h (module 'core'): ns3::Scheduler [class]
module.add_class('Scheduler', import_from_module='ns.core', parent=root_module['ns3::Object'])
## scheduler.h (module 'core'): ns3::Scheduler::Event [struct]
module.add_class('Event', import_from_module='ns.core', outer_class=root_module['ns3::Scheduler'])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey [struct]
module.add_class('EventKey', import_from_module='ns.core', outer_class=root_module['ns3::Scheduler'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
@ -168,10 +158,6 @@ def register_types(module):
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::SystemThread', 'ns3::empty', 'ns3::DefaultDeleter<ns3::SystemThread>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simulator-impl.h (module 'core'): ns3::SimulatorImpl [class]
module.add_class('SimulatorImpl', import_from_module='ns.core', parent=root_module['ns3::Object'])
## synchronizer.h (module 'core'): ns3::Synchronizer [class]
module.add_class('Synchronizer', import_from_module='ns.core', parent=root_module['ns3::Object'])
## system-thread.h (module 'core'): ns3::SystemThread [class]
module.add_class('SystemThread', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >'])
## nstime.h (module 'core'): ns3::Time [class]
@ -240,10 +226,6 @@ def register_types(module):
module.add_class('OutputStreamWrapper', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
## packet.h (module 'network'): ns3::Packet [class]
module.add_class('Packet', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl [class]
module.add_class('RealtimeSimulatorImpl', import_from_module='ns.core', parent=root_module['ns3::SimulatorImpl'])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode [enumeration]
module.add_enum('SynchronizationMode', ['SYNC_BEST_EFFORT', 'SYNC_HARD_LIMIT'], outer_class=root_module['ns3::RealtimeSimulatorImpl'], import_from_module='ns.core')
## nstime.h (module 'core'): ns3::TimeChecker [class]
module.add_class('TimeChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## nstime.h (module 'core'): ns3::TimeValue [class]
@ -260,12 +242,6 @@ def register_types(module):
module.add_class('EmuNetDevice', parent=root_module['ns3::NetDevice'])
## emu-net-device.h (module 'emu'): ns3::EmuNetDevice::EncapsulationMode [enumeration]
module.add_enum('EncapsulationMode', ['ILLEGAL', 'DIX', 'LLC'], outer_class=root_module['ns3::EmuNetDevice'])
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogTimePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogTimePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogTimePrinter&')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogNodePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogNodePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogNodePrinter&')
## Register a nested module for the namespace FatalImpl
@ -298,7 +274,6 @@ def register_methods(root_module):
register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask'])
register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address'])
register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix'])
register_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent'])
register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address'])
register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer'])
register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer'])
@ -331,9 +306,6 @@ def register_methods(root_module):
register_Ns3Object_methods(root_module, root_module['ns3::Object'])
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
register_Ns3Scheduler_methods(root_module, root_module['ns3::Scheduler'])
register_Ns3SchedulerEvent_methods(root_module, root_module['ns3::Scheduler::Event'])
register_Ns3SchedulerEventKey_methods(root_module, root_module['ns3::Scheduler::EventKey'])
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
@ -344,8 +316,6 @@ def register_methods(root_module):
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3SimulatorImpl_methods(root_module, root_module['ns3::SimulatorImpl'])
register_Ns3Synchronizer_methods(root_module, root_module['ns3::Synchronizer'])
register_Ns3SystemThread_methods(root_module, root_module['ns3::SystemThread'])
register_Ns3Time_methods(root_module, root_module['ns3::Time'])
register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor'])
@ -377,7 +347,6 @@ def register_methods(root_module):
register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue'])
register_Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::OutputStreamWrapper'])
register_Ns3Packet_methods(root_module, root_module['ns3::Packet'])
register_Ns3RealtimeSimulatorImpl_methods(root_module, root_module['ns3::RealtimeSimulatorImpl'])
register_Ns3TimeChecker_methods(root_module, root_module['ns3::TimeChecker'])
register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue'])
register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker'])
@ -1466,40 +1435,6 @@ def register_Ns3Ipv6Prefix_methods(root_module, cls):
is_const=True)
return
def register_Ns3LogComponent_methods(root_module, cls):
## log.h (module 'core'): ns3::LogComponent::LogComponent(ns3::LogComponent const & arg0) [copy constructor]
cls.add_constructor([param('ns3::LogComponent const &', 'arg0')])
## log.h (module 'core'): ns3::LogComponent::LogComponent(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## log.h (module 'core'): void ns3::LogComponent::Disable(ns3::LogLevel level) [member function]
cls.add_method('Disable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::Enable(ns3::LogLevel level) [member function]
cls.add_method('Enable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::EnvVarCheck(char const * name) [member function]
cls.add_method('EnvVarCheck',
'void',
[param('char const *', 'name')])
## log.h (module 'core'): bool ns3::LogComponent::IsEnabled(ns3::LogLevel level) const [member function]
cls.add_method('IsEnabled',
'bool',
[param('ns3::LogLevel', 'level')],
is_const=True)
## log.h (module 'core'): bool ns3::LogComponent::IsNoneEnabled() const [member function]
cls.add_method('IsNoneEnabled',
'bool',
[],
is_const=True)
## log.h (module 'core'): char const * ns3::LogComponent::Name() const [member function]
cls.add_method('Name',
'char const *',
[],
is_const=True)
return
def register_Ns3Mac48Address_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
@ -2857,71 +2792,6 @@ def register_Ns3PcapFileWrapper_methods(root_module, cls):
[])
return
def register_Ns3Scheduler_methods(root_module, cls):
## scheduler.h (module 'core'): ns3::Scheduler::Scheduler() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::Scheduler(ns3::Scheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler const &', 'arg0')])
## scheduler.h (module 'core'): static ns3::TypeId ns3::Scheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## scheduler.h (module 'core'): void ns3::Scheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## scheduler.h (module 'core'): bool ns3::Scheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## scheduler.h (module 'core'): void ns3::Scheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3SchedulerEvent_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
## scheduler.h (module 'core'): ns3::Scheduler::Event::Event() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::Event::Event(ns3::Scheduler::Event const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler::Event const &', 'arg0')])
## scheduler.h (module 'core'): ns3::Scheduler::Event::impl [variable]
cls.add_instance_attribute('impl', 'ns3::EventImpl *', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::Event::key [variable]
cls.add_instance_attribute('key', 'ns3::Scheduler::EventKey', is_const=False)
return
def register_Ns3SchedulerEventKey_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('!=')
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::EventKey() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::EventKey(ns3::Scheduler::EventKey const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler::EventKey const &', 'arg0')])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_context [variable]
cls.add_instance_attribute('m_context', 'uint32_t', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_ts [variable]
cls.add_instance_attribute('m_ts', 'uint64_t', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_uid [variable]
cls.add_instance_attribute('m_uid', 'uint32_t', is_const=False)
return
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
@ -3042,232 +2912,25 @@ def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDelete
is_static=True)
return
def register_Ns3SimulatorImpl_methods(root_module, cls):
## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl() [constructor]
cls.add_constructor([])
## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl(ns3::SimulatorImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SimulatorImpl const &', 'arg0')])
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Cancel(ns3::EventId const & ev) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetMaximumSimulationTime() const [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): static ns3::TypeId ns3::SimulatorImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsFinished() const [member function]
cls.add_method('IsFinished',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Remove(ns3::EventId const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Run() [member function]
cls.add_method('Run',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleDestroy',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleNow',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Synchronizer_methods(root_module, cls):
## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer(ns3::Synchronizer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Synchronizer const &', 'arg0')])
## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer() [constructor]
cls.add_constructor([])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::EventEnd() [member function]
cls.add_method('EventEnd',
'uint64_t',
[])
## synchronizer.h (module 'core'): void ns3::Synchronizer::EventStart() [member function]
cls.add_method('EventStart',
'void',
[])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetCurrentRealtime() [member function]
cls.add_method('GetCurrentRealtime',
'uint64_t',
[])
## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::GetDrift(uint64_t ts) [member function]
cls.add_method('GetDrift',
'int64_t',
[param('uint64_t', 'ts')])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetOrigin() [member function]
cls.add_method('GetOrigin',
'uint64_t',
[])
## synchronizer.h (module 'core'): static ns3::TypeId ns3::Synchronizer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::Realtime() [member function]
cls.add_method('Realtime',
'bool',
[])
## synchronizer.h (module 'core'): void ns3::Synchronizer::SetCondition(bool arg0) [member function]
cls.add_method('SetCondition',
'void',
[param('bool', 'arg0')])
## synchronizer.h (module 'core'): void ns3::Synchronizer::SetOrigin(uint64_t ts) [member function]
cls.add_method('SetOrigin',
'void',
[param('uint64_t', 'ts')])
## synchronizer.h (module 'core'): void ns3::Synchronizer::Signal() [member function]
cls.add_method('Signal',
'void',
[])
## synchronizer.h (module 'core'): bool ns3::Synchronizer::Synchronize(uint64_t tsCurrent, uint64_t tsDelay) [member function]
cls.add_method('Synchronize',
'bool',
[param('uint64_t', 'tsCurrent'), param('uint64_t', 'tsDelay')])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoEventEnd() [member function]
cls.add_method('DoEventEnd',
'uint64_t',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoEventStart() [member function]
cls.add_method('DoEventStart',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoGetCurrentRealtime() [member function]
cls.add_method('DoGetCurrentRealtime',
'uint64_t',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::DoGetDrift(uint64_t ns) [member function]
cls.add_method('DoGetDrift',
'int64_t',
[param('uint64_t', 'ns')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoRealtime() [member function]
cls.add_method('DoRealtime',
'bool',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetCondition(bool arg0) [member function]
cls.add_method('DoSetCondition',
'void',
[param('bool', 'arg0')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetOrigin(uint64_t ns) [member function]
cls.add_method('DoSetOrigin',
'void',
[param('uint64_t', 'ns')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSignal() [member function]
cls.add_method('DoSignal',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay) [member function]
cls.add_method('DoSynchronize',
'bool',
[param('uint64_t', 'nsCurrent'), param('uint64_t', 'nsDelay')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3SystemThread_methods(root_module, cls):
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::SystemThread const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemThread const &', 'arg0')])
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [constructor]
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [constructor]
cls.add_constructor([param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
## system-thread.h (module 'core'): bool ns3::SystemThread::Break() [member function]
cls.add_method('Break',
## system-thread.h (module 'core'): static bool ns3::SystemThread::Equals(pthread_t id) [member function]
cls.add_method('Equals',
'bool',
[])
[param('pthread_t', 'id')],
is_static=True)
## system-thread.h (module 'core'): void ns3::SystemThread::Join() [member function]
cls.add_method('Join',
'void',
[])
## system-thread.h (module 'core'): void ns3::SystemThread::Shutdown() [member function]
cls.add_method('Shutdown',
'void',
[])
## system-thread.h (module 'core'): static pthread_t ns3::SystemThread::Self() [member function]
cls.add_method('Self',
'pthread_t',
[],
is_static=True)
## system-thread.h (module 'core'): void ns3::SystemThread::Start() [member function]
cls.add_method('Start',
'void',
@ -3919,7 +3582,7 @@ def register_Ns3NetDevice_methods(root_module, cls):
cls.add_constructor([])
## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NetDevice const &', 'arg0')])
## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
@ -4407,162 +4070,6 @@ def register_Ns3Packet_methods(root_module, cls):
[param('ns3::Ptr< ns3::NixVector >', 'arg0')])
return
def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls):
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl(ns3::RealtimeSimulatorImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RealtimeSimulatorImpl const &', 'arg0')])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl() [constructor]
cls.add_constructor([])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Cancel(ns3::EventId const & ev) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetHardLimit() const [member function]
cls.add_method('GetHardLimit',
'ns3::Time',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetMaximumSimulationTime() const [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode ns3::RealtimeSimulatorImpl::GetSynchronizationMode() const [member function]
cls.add_method('GetSynchronizationMode',
'ns3::RealtimeSimulatorImpl::SynchronizationMode',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): static ns3::TypeId ns3::RealtimeSimulatorImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'ev')],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsFinished() const [member function]
cls.add_method('IsFinished',
'bool',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::RealtimeNow() const [member function]
cls.add_method('RealtimeNow',
'ns3::Time',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Remove(ns3::EventId const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Run() [member function]
cls.add_method('Run',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleDestroy',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleNow',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtime(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtime',
'void',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeNow',
'void',
[param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNowWithContext(uint32_t context, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeNowWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetHardLimit(ns3::Time limit) [member function]
cls.add_method('SetHardLimit',
'void',
[param('ns3::Time', 'limit')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetSynchronizationMode(ns3::RealtimeSimulatorImpl::SynchronizationMode mode) [member function]
cls.add_method('SetSynchronizationMode',
'void',
[param('ns3::RealtimeSimulatorImpl::SynchronizationMode', 'mode')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3TimeChecker_methods(root_module, cls):
## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker() [constructor]
cls.add_constructor([])
@ -4752,7 +4259,7 @@ def register_Ns3EmuNetDevice_methods(root_module, cls):
'bool',
[],
is_const=True, is_virtual=True)
## emu-net-device.h (module 'emu'): void ns3::EmuNetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
## emu-net-device.h (module 'emu'): void ns3::EmuNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],

View File

@ -20,8 +20,6 @@ def module_init():
def register_types(module):
root_module = module.get_root()
## log.h (module 'core'): ns3::LogLevel [enumeration]
module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME', 'LOG_PREFIX_NODE'], import_from_module='ns.core')
## address.h (module 'network'): ns3::Address [class]
module.add_class('Address', import_from_module='ns.network')
## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration]
@ -68,8 +66,6 @@ def register_types(module):
root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address'])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class]
module.add_class('Ipv6Prefix', import_from_module='ns.network')
## log.h (module 'core'): ns3::LogComponent [class]
module.add_class('LogComponent', import_from_module='ns.core')
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
module.add_class('Mac48Address', import_from_module='ns.network')
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
@ -142,12 +138,6 @@ def register_types(module):
module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object'])
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object'])
## scheduler.h (module 'core'): ns3::Scheduler [class]
module.add_class('Scheduler', import_from_module='ns.core', parent=root_module['ns3::Object'])
## scheduler.h (module 'core'): ns3::Scheduler::Event [struct]
module.add_class('Event', import_from_module='ns.core', outer_class=root_module['ns3::Scheduler'])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey [struct]
module.add_class('EventKey', import_from_module='ns.core', outer_class=root_module['ns3::Scheduler'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
@ -168,10 +158,6 @@ def register_types(module):
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::SystemThread', 'ns3::empty', 'ns3::DefaultDeleter<ns3::SystemThread>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simulator-impl.h (module 'core'): ns3::SimulatorImpl [class]
module.add_class('SimulatorImpl', import_from_module='ns.core', parent=root_module['ns3::Object'])
## synchronizer.h (module 'core'): ns3::Synchronizer [class]
module.add_class('Synchronizer', import_from_module='ns.core', parent=root_module['ns3::Object'])
## system-thread.h (module 'core'): ns3::SystemThread [class]
module.add_class('SystemThread', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >'])
## nstime.h (module 'core'): ns3::Time [class]
@ -240,10 +226,6 @@ def register_types(module):
module.add_class('OutputStreamWrapper', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
## packet.h (module 'network'): ns3::Packet [class]
module.add_class('Packet', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl [class]
module.add_class('RealtimeSimulatorImpl', import_from_module='ns.core', parent=root_module['ns3::SimulatorImpl'])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode [enumeration]
module.add_enum('SynchronizationMode', ['SYNC_BEST_EFFORT', 'SYNC_HARD_LIMIT'], outer_class=root_module['ns3::RealtimeSimulatorImpl'], import_from_module='ns.core')
## nstime.h (module 'core'): ns3::TimeChecker [class]
module.add_class('TimeChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## nstime.h (module 'core'): ns3::TimeValue [class]
@ -260,12 +242,6 @@ def register_types(module):
module.add_class('EmuNetDevice', parent=root_module['ns3::NetDevice'])
## emu-net-device.h (module 'emu'): ns3::EmuNetDevice::EncapsulationMode [enumeration]
module.add_enum('EncapsulationMode', ['ILLEGAL', 'DIX', 'LLC'], outer_class=root_module['ns3::EmuNetDevice'])
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogTimePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogTimePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogTimePrinter&')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogNodePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogNodePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogNodePrinter&')
## Register a nested module for the namespace FatalImpl
@ -298,7 +274,6 @@ def register_methods(root_module):
register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask'])
register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address'])
register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix'])
register_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent'])
register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address'])
register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer'])
register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer'])
@ -331,9 +306,6 @@ def register_methods(root_module):
register_Ns3Object_methods(root_module, root_module['ns3::Object'])
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
register_Ns3Scheduler_methods(root_module, root_module['ns3::Scheduler'])
register_Ns3SchedulerEvent_methods(root_module, root_module['ns3::Scheduler::Event'])
register_Ns3SchedulerEventKey_methods(root_module, root_module['ns3::Scheduler::EventKey'])
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
@ -344,8 +316,6 @@ def register_methods(root_module):
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
register_Ns3SimpleRefCount__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3SimulatorImpl_methods(root_module, root_module['ns3::SimulatorImpl'])
register_Ns3Synchronizer_methods(root_module, root_module['ns3::Synchronizer'])
register_Ns3SystemThread_methods(root_module, root_module['ns3::SystemThread'])
register_Ns3Time_methods(root_module, root_module['ns3::Time'])
register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor'])
@ -377,7 +347,6 @@ def register_methods(root_module):
register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue'])
register_Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::OutputStreamWrapper'])
register_Ns3Packet_methods(root_module, root_module['ns3::Packet'])
register_Ns3RealtimeSimulatorImpl_methods(root_module, root_module['ns3::RealtimeSimulatorImpl'])
register_Ns3TimeChecker_methods(root_module, root_module['ns3::TimeChecker'])
register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue'])
register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker'])
@ -1466,40 +1435,6 @@ def register_Ns3Ipv6Prefix_methods(root_module, cls):
is_const=True)
return
def register_Ns3LogComponent_methods(root_module, cls):
## log.h (module 'core'): ns3::LogComponent::LogComponent(ns3::LogComponent const & arg0) [copy constructor]
cls.add_constructor([param('ns3::LogComponent const &', 'arg0')])
## log.h (module 'core'): ns3::LogComponent::LogComponent(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## log.h (module 'core'): void ns3::LogComponent::Disable(ns3::LogLevel level) [member function]
cls.add_method('Disable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::Enable(ns3::LogLevel level) [member function]
cls.add_method('Enable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::EnvVarCheck(char const * name) [member function]
cls.add_method('EnvVarCheck',
'void',
[param('char const *', 'name')])
## log.h (module 'core'): bool ns3::LogComponent::IsEnabled(ns3::LogLevel level) const [member function]
cls.add_method('IsEnabled',
'bool',
[param('ns3::LogLevel', 'level')],
is_const=True)
## log.h (module 'core'): bool ns3::LogComponent::IsNoneEnabled() const [member function]
cls.add_method('IsNoneEnabled',
'bool',
[],
is_const=True)
## log.h (module 'core'): char const * ns3::LogComponent::Name() const [member function]
cls.add_method('Name',
'char const *',
[],
is_const=True)
return
def register_Ns3Mac48Address_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
@ -2857,71 +2792,6 @@ def register_Ns3PcapFileWrapper_methods(root_module, cls):
[])
return
def register_Ns3Scheduler_methods(root_module, cls):
## scheduler.h (module 'core'): ns3::Scheduler::Scheduler() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::Scheduler(ns3::Scheduler const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler const &', 'arg0')])
## scheduler.h (module 'core'): static ns3::TypeId ns3::Scheduler::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## scheduler.h (module 'core'): void ns3::Scheduler::Insert(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## scheduler.h (module 'core'): bool ns3::Scheduler::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::PeekNext() const [member function]
cls.add_method('PeekNext',
'ns3::Scheduler::Event',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## scheduler.h (module 'core'): void ns3::Scheduler::Remove(ns3::Scheduler::Event const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::Scheduler::Event const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## scheduler.h (module 'core'): ns3::Scheduler::Event ns3::Scheduler::RemoveNext() [member function]
cls.add_method('RemoveNext',
'ns3::Scheduler::Event',
[],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3SchedulerEvent_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
## scheduler.h (module 'core'): ns3::Scheduler::Event::Event() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::Event::Event(ns3::Scheduler::Event const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler::Event const &', 'arg0')])
## scheduler.h (module 'core'): ns3::Scheduler::Event::impl [variable]
cls.add_instance_attribute('impl', 'ns3::EventImpl *', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::Event::key [variable]
cls.add_instance_attribute('key', 'ns3::Scheduler::EventKey', is_const=False)
return
def register_Ns3SchedulerEventKey_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('!=')
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::EventKey() [constructor]
cls.add_constructor([])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::EventKey(ns3::Scheduler::EventKey const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Scheduler::EventKey const &', 'arg0')])
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_context [variable]
cls.add_instance_attribute('m_context', 'uint32_t', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_ts [variable]
cls.add_instance_attribute('m_ts', 'uint64_t', is_const=False)
## scheduler.h (module 'core'): ns3::Scheduler::EventKey::m_uid [variable]
cls.add_instance_attribute('m_uid', 'uint32_t', is_const=False)
return
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
@ -3042,232 +2912,25 @@ def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDelete
is_static=True)
return
def register_Ns3SimulatorImpl_methods(root_module, cls):
## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl() [constructor]
cls.add_constructor([])
## simulator-impl.h (module 'core'): ns3::SimulatorImpl::SimulatorImpl(ns3::SimulatorImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SimulatorImpl const &', 'arg0')])
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Cancel(ns3::EventId const & ev) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::GetMaximumSimulationTime() const [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): uint32_t ns3::SimulatorImpl::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): static ns3::TypeId ns3::SimulatorImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): bool ns3::SimulatorImpl::IsFinished() const [member function]
cls.add_method('IsFinished',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::Time ns3::SimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Remove(ns3::EventId const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'ev')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Run() [member function]
cls.add_method('Run',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleDestroy',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): ns3::EventId ns3::SimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleNow',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## simulator-impl.h (module 'core'): void ns3::SimulatorImpl::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Synchronizer_methods(root_module, cls):
## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer(ns3::Synchronizer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Synchronizer const &', 'arg0')])
## synchronizer.h (module 'core'): ns3::Synchronizer::Synchronizer() [constructor]
cls.add_constructor([])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::EventEnd() [member function]
cls.add_method('EventEnd',
'uint64_t',
[])
## synchronizer.h (module 'core'): void ns3::Synchronizer::EventStart() [member function]
cls.add_method('EventStart',
'void',
[])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetCurrentRealtime() [member function]
cls.add_method('GetCurrentRealtime',
'uint64_t',
[])
## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::GetDrift(uint64_t ts) [member function]
cls.add_method('GetDrift',
'int64_t',
[param('uint64_t', 'ts')])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::GetOrigin() [member function]
cls.add_method('GetOrigin',
'uint64_t',
[])
## synchronizer.h (module 'core'): static ns3::TypeId ns3::Synchronizer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::Realtime() [member function]
cls.add_method('Realtime',
'bool',
[])
## synchronizer.h (module 'core'): void ns3::Synchronizer::SetCondition(bool arg0) [member function]
cls.add_method('SetCondition',
'void',
[param('bool', 'arg0')])
## synchronizer.h (module 'core'): void ns3::Synchronizer::SetOrigin(uint64_t ts) [member function]
cls.add_method('SetOrigin',
'void',
[param('uint64_t', 'ts')])
## synchronizer.h (module 'core'): void ns3::Synchronizer::Signal() [member function]
cls.add_method('Signal',
'void',
[])
## synchronizer.h (module 'core'): bool ns3::Synchronizer::Synchronize(uint64_t tsCurrent, uint64_t tsDelay) [member function]
cls.add_method('Synchronize',
'bool',
[param('uint64_t', 'tsCurrent'), param('uint64_t', 'tsDelay')])
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoEventEnd() [member function]
cls.add_method('DoEventEnd',
'uint64_t',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoEventStart() [member function]
cls.add_method('DoEventStart',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): uint64_t ns3::Synchronizer::DoGetCurrentRealtime() [member function]
cls.add_method('DoGetCurrentRealtime',
'uint64_t',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): int64_t ns3::Synchronizer::DoGetDrift(uint64_t ns) [member function]
cls.add_method('DoGetDrift',
'int64_t',
[param('uint64_t', 'ns')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoRealtime() [member function]
cls.add_method('DoRealtime',
'bool',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetCondition(bool arg0) [member function]
cls.add_method('DoSetCondition',
'void',
[param('bool', 'arg0')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSetOrigin(uint64_t ns) [member function]
cls.add_method('DoSetOrigin',
'void',
[param('uint64_t', 'ns')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): void ns3::Synchronizer::DoSignal() [member function]
cls.add_method('DoSignal',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
## synchronizer.h (module 'core'): bool ns3::Synchronizer::DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay) [member function]
cls.add_method('DoSynchronize',
'bool',
[param('uint64_t', 'nsCurrent'), param('uint64_t', 'nsDelay')],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3SystemThread_methods(root_module, cls):
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::SystemThread const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemThread const &', 'arg0')])
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [constructor]
## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [constructor]
cls.add_constructor([param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
## system-thread.h (module 'core'): bool ns3::SystemThread::Break() [member function]
cls.add_method('Break',
## system-thread.h (module 'core'): static bool ns3::SystemThread::Equals(pthread_t id) [member function]
cls.add_method('Equals',
'bool',
[])
[param('pthread_t', 'id')],
is_static=True)
## system-thread.h (module 'core'): void ns3::SystemThread::Join() [member function]
cls.add_method('Join',
'void',
[])
## system-thread.h (module 'core'): void ns3::SystemThread::Shutdown() [member function]
cls.add_method('Shutdown',
'void',
[])
## system-thread.h (module 'core'): static pthread_t ns3::SystemThread::Self() [member function]
cls.add_method('Self',
'pthread_t',
[],
is_static=True)
## system-thread.h (module 'core'): void ns3::SystemThread::Start() [member function]
cls.add_method('Start',
'void',
@ -3919,7 +3582,7 @@ def register_Ns3NetDevice_methods(root_module, cls):
cls.add_constructor([])
## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NetDevice const &', 'arg0')])
## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
@ -4407,162 +4070,6 @@ def register_Ns3Packet_methods(root_module, cls):
[param('ns3::Ptr< ns3::NixVector >', 'arg0')])
return
def register_Ns3RealtimeSimulatorImpl_methods(root_module, cls):
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl(ns3::RealtimeSimulatorImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RealtimeSimulatorImpl const &', 'arg0')])
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::RealtimeSimulatorImpl() [constructor]
cls.add_constructor([])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Cancel(ns3::EventId const & ev) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetDelayLeft(ns3::EventId const & id) const [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetHardLimit() const [member function]
cls.add_method('GetHardLimit',
'ns3::Time',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::GetMaximumSimulationTime() const [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::RealtimeSimulatorImpl::SynchronizationMode ns3::RealtimeSimulatorImpl::GetSynchronizationMode() const [member function]
cls.add_method('GetSynchronizationMode',
'ns3::RealtimeSimulatorImpl::SynchronizationMode',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): uint32_t ns3::RealtimeSimulatorImpl::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): static ns3::TypeId ns3::RealtimeSimulatorImpl::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsExpired(ns3::EventId const & ev) const [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'ev')],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): bool ns3::RealtimeSimulatorImpl::IsFinished() const [member function]
cls.add_method('IsFinished',
'bool',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Next() const [member function]
cls.add_method('Next',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::Now() const [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_const=True, is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::Time ns3::RealtimeSimulatorImpl::RealtimeNow() const [member function]
cls.add_method('RealtimeNow',
'ns3::Time',
[],
is_const=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Remove(ns3::EventId const & ev) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'ev')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Run() [member function]
cls.add_method('Run',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::RunOneEvent() [member function]
cls.add_method('RunOneEvent',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::Schedule(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('Schedule',
'ns3::EventId',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleDestroy(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleDestroy',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): ns3::EventId ns3::RealtimeSimulatorImpl::ScheduleNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleNow',
'ns3::EventId',
[param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtime(ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtime',
'void',
[param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNow(ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeNow',
'void',
[param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeNowWithContext(uint32_t context, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeNowWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleRealtimeWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleRealtimeWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::ScheduleWithContext(uint32_t context, ns3::Time const & time, ns3::EventImpl * event) [member function]
cls.add_method('ScheduleWithContext',
'void',
[param('uint32_t', 'context'), param('ns3::Time const &', 'time'), param('ns3::EventImpl *', 'event')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetHardLimit(ns3::Time limit) [member function]
cls.add_method('SetHardLimit',
'void',
[param('ns3::Time', 'limit')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::SetSynchronizationMode(ns3::RealtimeSimulatorImpl::SynchronizationMode mode) [member function]
cls.add_method('SetSynchronizationMode',
'void',
[param('ns3::RealtimeSimulatorImpl::SynchronizationMode', 'mode')])
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_virtual=True)
## realtime-simulator-impl.h (module 'core'): void ns3::RealtimeSimulatorImpl::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3TimeChecker_methods(root_module, cls):
## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker() [constructor]
cls.add_constructor([])
@ -4752,7 +4259,7 @@ def register_Ns3EmuNetDevice_methods(root_module, cls):
'bool',
[],
is_const=True, is_virtual=True)
## emu-net-device.h (module 'emu'): void ns3::EmuNetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
## emu-net-device.h (module 'emu'): void ns3::EmuNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],

View File

@ -49,6 +49,7 @@
#include <limits>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
NS_LOG_COMPONENT_DEFINE ("EmuNetDevice");
@ -270,26 +271,6 @@ EmuNetDevice::StartDevice (void)
NS_FATAL_ERROR ("EmuNetDevice::StartDevice(): Device is already started");
}
//
// We're going to need a pointer to the realtime simulator implementation.
// It's important to remember that access to that implementation may happen
// in a completely different thread than the simulator is running in (we're
// going to spin up that thread below). We are talking about multiple threads
// here, so it is very, very dangerous to do any kind of reference couning on
// a shared object that is unaware of what is happening. What we are going to
// do to address that is to get a reference to the realtime simulator here
// where we are running in the context of a running simulator scheduler --
// recall we did a Simulator::Schedule of this method above. We get the
// simulator implementation pointer in a single-threaded way and save the
// underlying raw pointer for use by the (other) read thread. We must not
// free this pointer or we may delete the simulator out from under us an
// everyone else. We assume that the simulator implementation cannot be
// replaced while the emu device is running and so will remain valid through
// the time during which the read thread is running.
//
Ptr<RealtimeSimulatorImpl> impl = DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ());
m_rtImpl = GetPointer (impl);
//
// A similar story exists for the node ID. We can't just naively do a
// GetNode ()->GetId () since GetNode is going to give us a Ptr<Node> which
@ -822,8 +803,8 @@ EmuNetDevice::ReadThread (void)
NS_LOG_INFO ("EmuNetDevice::EmuNetDevice(): Received packet on node " << m_nodeId);
NS_LOG_INFO ("EmuNetDevice::ReadThread(): Scheduling handler");
NS_ASSERT_MSG (m_rtImpl, "EmuNetDevice::ReadThread(): Realtime simulator implementation pointer not set");
m_rtImpl->ScheduleRealtimeNowWithContext (m_nodeId, MakeEvent (&EmuNetDevice::ForwardUp, this, buf, len));
Simulator::ScheduleWithContext (m_nodeId, Seconds (0.0),
MakeEvent (&EmuNetDevice::ForwardUp, this, buf, len));
buf = 0;
}
}

View File

@ -33,7 +33,6 @@
#include "ns3/mac48-address.h"
#include "ns3/system-thread.h"
#include "ns3/system-mutex.h"
#include "ns3/realtime-simulator-impl.h"
namespace ns3 {
@ -517,12 +516,6 @@ private:
*/
uint8_t *m_packetBuffer;
/**
* A copy of a raw pointer to the required real-time simulator implementation.
* Never free this pointer!
*/
RealtimeSimulatorImpl *m_rtImpl;
/*
* a copy of the node id so the read thread doesn't have to GetNode() in
* in order to find the node ID. Thread unsafe reference counting in

View File

@ -3181,6 +3181,11 @@ def register_Ns3Socket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',

View File

@ -3181,6 +3181,11 @@ def register_Ns3Socket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',

View File

@ -7397,6 +7397,11 @@ def register_Ns3Socket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',
@ -9904,10 +9909,11 @@ def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
cls.add_method('GetDefaultRoute',
'ns3::Ipv4RoutingTableEntry',
[])
## ipv4-static-routing.h (module 'internet'): uint32_t ns3::Ipv4StaticRouting::GetMetric(uint32_t index) [member function]
## ipv4-static-routing.h (module 'internet'): uint32_t ns3::Ipv4StaticRouting::GetMetric(uint32_t index) const [member function]
cls.add_method('GetMetric',
'uint32_t',
[param('uint32_t', 'index')])
[param('uint32_t', 'index')],
is_const=True)
## ipv4-static-routing.h (module 'internet'): ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4StaticRouting::GetMulticastRoute(uint32_t i) const [member function]
cls.add_method('GetMulticastRoute',
'ns3::Ipv4MulticastRoutingTableEntry',

View File

@ -7397,6 +7397,11 @@ def register_Ns3Socket_methods(root_module, cls):
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',
@ -9904,10 +9909,11 @@ def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
cls.add_method('GetDefaultRoute',
'ns3::Ipv4RoutingTableEntry',
[])
## ipv4-static-routing.h (module 'internet'): uint32_t ns3::Ipv4StaticRouting::GetMetric(uint32_t index) [member function]
## ipv4-static-routing.h (module 'internet'): uint32_t ns3::Ipv4StaticRouting::GetMetric(uint32_t index) const [member function]
cls.add_method('GetMetric',
'uint32_t',
[param('uint32_t', 'index')])
[param('uint32_t', 'index')],
is_const=True)
## ipv4-static-routing.h (module 'internet'): ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4StaticRouting::GetMulticastRoute(uint32_t i) const [member function]
cls.add_method('GetMulticastRoute',
'ns3::Ipv4MulticastRoutingTableEntry',

View File

@ -18,6 +18,10 @@
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/node.h"
#include "ns3/node-list.h"
#include "ns3/simulator.h"
#include "ns3/ipv6-routing-protocol.h"
#include "ipv6-routing-helper.h"
namespace ns3 {
@ -26,4 +30,55 @@ Ipv6RoutingHelper::~Ipv6RoutingHelper ()
{
}
void
Ipv6RoutingHelper::PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const
{
for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
{
Ptr<Node> node = NodeList::GetNode (i);
Simulator::Schedule (printTime, &Ipv6RoutingHelper::Print, this, node, stream);
}
}
void
Ipv6RoutingHelper::PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const
{
for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
{
Ptr<Node> node = NodeList::GetNode (i);
Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, this, printInterval, node, stream);
}
}
void
Ipv6RoutingHelper::PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
{
Simulator::Schedule (printTime, &Ipv6RoutingHelper::Print, this, node, stream);
}
void
Ipv6RoutingHelper::PrintRoutingTableEvery (Time printInterval,Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
{
Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, this, printInterval, node, stream);
}
void
Ipv6RoutingHelper::Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
{
Ptr<Ipv6> ipv6 = node->GetObject<Ipv6> ();
Ptr<Ipv6RoutingProtocol> rp = ipv6->GetRoutingProtocol ();
NS_ASSERT (rp);
rp->PrintRoutingTable (stream);
}
void
Ipv6RoutingHelper::PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
{
Ptr<Ipv6> ipv6 = node->GetObject<Ipv6> ();
Ptr<Ipv6RoutingProtocol> rp = ipv6->GetRoutingProtocol ();
NS_ASSERT (rp);
rp->PrintRoutingTable (stream);
Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, this, printInterval, node, stream);
}
} // namespace ns3

View File

@ -22,6 +22,8 @@
#define IPV6_ROUTING_HELPER_H
#include "ns3/ptr.h"
#include "ns3/nstime.h"
#include "ns3/output-stream-wrapper.h"
namespace ns3 {
@ -61,6 +63,56 @@ public:
* \returns a newly-created routing protocol
*/
virtual Ptr<Ipv6RoutingProtocol> Create (Ptr<Node> node) const = 0;
/**
* \brief prints the routing tables of all nodes at a particular time.
* \param printTime the time at which the routing table is supposed to be printed.
* \param stream The output stream object to use
*
* This method calls the PrintRoutingTable() method of the
* Ipv6RoutingProtocol stored in the Ipv6 object, for all nodes at the
* specified time; the output format is routing protocol-specific.
*/
void PrintRoutingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const;
/**
* \brief prints the routing tables of all nodes at regular intervals specified by user.
* \param printInterval the time interval for which the routing table is supposed to be printed.
* \param stream The output stream object to use
*
* This method calls the PrintRoutingTable() method of the
* Ipv6RoutingProtocol stored in the Ipv6 object, for all nodes at the
* specified time interval; the output format is routing protocol-specific.
*/
void PrintRoutingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const;
/**
* \brief prints the routing tables of a node at a particular time.
* \param printTime the time at which the routing table is supposed to be printed.
* \param node The node ptr for which we need the routing table to be printed
* \param stream The output stream object to use
*
* This method calls the PrintRoutingTable() method of the
* Ipv6RoutingProtocol stored in the Ipv6 object, for the selected node
* at the specified time; the output format is routing protocol-specific.
*/
void PrintRoutingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
/**
* \brief prints the routing tables of a node at regular intervals specified by user.
* \param printInterval the time interval for which the routing table is supposed to be printed.
* \param node The node ptr for which we need the routing table to be printed
* \param stream The output stream object to use
*
* This method calls the PrintRoutingTable() method of the
* Ipv6RoutingProtocol stored in the Ipv6 object, for the selected node
* at the specified interval; the output format is routing protocol-specific.
*/
void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
private:
void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
};
} // namespace ns3

View File

@ -18,6 +18,7 @@
* Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
* David Gross <gdavid.devel@gmail.com>
* Mehdi Benamor <benamor.mehdi@ensi.rnu.tn>
* Tommaso Pecorella <tommaso.pecorella@unifi.it>
*/
#include "ns3/log.h"
@ -34,8 +35,7 @@
#include "icmpv6-l4-protocol.h"
#include "ndisc-cache.h"
namespace ns3
{
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (Icmpv6L4Protocol);
@ -97,7 +97,7 @@ void Icmpv6L4Protocol::DoDispose ()
cache = 0;
}
m_cacheList.clear ();
m_downTarget.Nullify();
m_downTarget.Nullify ();
m_node = 0;
IpL4Protocol::DoDispose ();
@ -114,11 +114,11 @@ void Icmpv6L4Protocol::NotifyNewAggregate ()
Ptr<Ipv6L3Protocol> ipv6 = this->GetObject<Ipv6L3Protocol> ();
if (ipv6 != 0)
{
this->SetNode (node);
SetNode (node);
ipv6->Insert (this);
Ptr<Ipv6RawSocketFactoryImpl> rawFactory = CreateObject<Ipv6RawSocketFactoryImpl> ();
ipv6->AggregateObject (rawFactory);
this->SetDownTarget6 (MakeCallback (&Ipv6L3Protocol::Send, ipv6));
SetDownTarget6 (MakeCallback (&Ipv6L3Protocol::Send, ipv6));
}
}
}
@ -162,9 +162,9 @@ void Icmpv6L4Protocol::DoDAD (Ipv6Address target, Ptr<Ipv6Interface> interface)
NS_ASSERT (ipv6);
if(!m_alwaysDad)
if (!m_alwaysDad)
{
return;
return;
}
/* TODO : disable multicast loopback to prevent NS probing to be received by the sender */
@ -192,7 +192,7 @@ enum IpL4Protocol::RxStatus Icmpv6L4Protocol::Receive (Ptr<Packet> packet, Ipv6A
uint8_t type;
p->CopyData (&type, sizeof(type));
switch (type)
switch (type)
{
case Icmpv6Header::ICMPV6_ND_ROUTER_SOLICITATION:
if (ipv6->IsForwarding (ipv6->GetInterfaceForDevice (interface->GetDevice ())))
@ -219,14 +219,21 @@ enum IpL4Protocol::RxStatus Icmpv6L4Protocol::Receive (Ptr<Packet> packet, Ipv6A
HandleEchoRequest (p, src, dst, interface);
break;
case Icmpv6Header::ICMPV6_ECHO_REPLY:
// EchoReply does not contain any info about L4
// so we can not forward it up.
// TODO: implement request / reply consistency check.
break;
case Icmpv6Header::ICMPV6_ERROR_DESTINATION_UNREACHABLE:
HandleDestinationUnreachable (p, src, dst, interface);
break;
case Icmpv6Header::ICMPV6_ERROR_PACKET_TOO_BIG:
HandlePacketTooBig (p, src, dst, interface);
break;
case Icmpv6Header::ICMPV6_ERROR_TIME_EXCEEDED:
HandleTimeExceeded (p, src, dst, interface);
break;
case Icmpv6Header::ICMPV6_ERROR_PARAMETER_ERROR:
HandleParameterError (p, src, dst, interface);
break;
default:
NS_LOG_LOGIC ("Unknown ICMPv6 message type=" << type);
@ -236,6 +243,24 @@ enum IpL4Protocol::RxStatus Icmpv6L4Protocol::Receive (Ptr<Packet> packet, Ipv6A
return IpL4Protocol::RX_OK;
}
void Icmpv6L4Protocol::Forward (Ipv6Address source, Icmpv6Header icmp,
uint32_t info, Ipv6Header ipHeader,
const uint8_t payload[8])
{
Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
// TODO assuming the ICMP is carrying a extensionless IP packet
uint8_t nextHeader = ipHeader.GetNextHeader ();
Ptr<IpL4Protocol> l4 = ipv6->GetProtocol (nextHeader);
if (l4 != 0)
{
l4->ReceiveIcmp (source, ipHeader.GetHopLimit (), icmp.GetType (), icmp.GetCode (),
info, ipHeader.GetSourceAddress (), ipHeader.GetDestinationAddress (), payload);
}
}
void Icmpv6L4Protocol::HandleEchoRequest (Ptr<Packet> packet, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
{
NS_LOG_FUNCTION (this << packet << src << dst << interface);
@ -253,7 +278,7 @@ void Icmpv6L4Protocol::HandleEchoRequest (Ptr<Packet> packet, Ipv6Address const
}
void Icmpv6L4Protocol::HandleRA (Ptr<Packet> packet, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
{
{
NS_LOG_FUNCTION (this << packet << src << dst << interface);
Ptr<Packet> p = packet->Copy ();
Icmpv6RA raHeader;
@ -276,7 +301,7 @@ void Icmpv6L4Protocol::HandleRA (Ptr<Packet> packet, Ipv6Address const &src, Ipv
{
case Icmpv6Header::ICMPV6_OPT_PREFIX:
p->RemoveHeader (prefixHdr);
ipv6->AddAutoconfiguredAddress (ipv6->GetInterfaceForDevice (interface->GetDevice ()), prefixHdr.GetPrefix (), prefixHdr.GetPrefixLength (),
ipv6->AddAutoconfiguredAddress (ipv6->GetInterfaceForDevice (interface->GetDevice ()), prefixHdr.GetPrefix (), prefixHdr.GetPrefixLength (),
prefixHdr.GetFlags (), prefixHdr.GetValidTime (), prefixHdr.GetPreferredTime (), src);
break;
case Icmpv6Header::ICMPV6_OPT_MTU:
@ -312,7 +337,7 @@ void Icmpv6L4Protocol::ReceiveLLA (Icmpv6OptionLinkLayerAddress lla, Ipv6Address
NdiscCache::Entry* entry = 0;
Ptr<NdiscCache> cache = FindCache (interface->GetDevice ());
/* check if we have this address in our cache */
/* check if we have this address in our cache */
entry = cache->Lookup (src);
if (!entry)
@ -329,11 +354,11 @@ void Icmpv6L4Protocol::ReceiveLLA (Icmpv6OptionLinkLayerAddress lla, Ipv6Address
if (entry->IsIncomplete ())
{
entry->StopRetransmitTimer ();
// mark it to reachable
// mark it to reachable
waiting = entry->MarkReachable (lla.GetAddress ());
entry->StopReachableTimer ();
entry->StartReachableTimer ();
// send out waiting packet
// send out waiting packet
for (std::list<Ptr<Packet> >::const_iterator it = waiting.begin (); it != waiting.end (); it++)
{
cache->GetInterface ()->Send (*it, src);
@ -342,7 +367,7 @@ void Icmpv6L4Protocol::ReceiveLLA (Icmpv6OptionLinkLayerAddress lla, Ipv6Address
}
else
{
if (entry->GetMacAddress ()!=lla.GetAddress ())
if (entry->GetMacAddress () != lla.GetAddress ())
{
entry->SetMacAddress (lla.GetAddress ());
entry->MarkStale ();
@ -497,7 +522,7 @@ void Icmpv6L4Protocol::HandleNS (Ptr<Packet> packet, Ipv6Address const &src, Ipv
hardwareAddress = interface->GetDevice ()->GetAddress ();
Ptr<Packet> p = ForgeNA (target.IsLinkLocal () ? interface->GetLinkLocalAddress ().GetAddress () : ifaddr.GetAddress (), src.IsAny () ? Ipv6Address::GetAllNodesMulticast () : src, &hardwareAddress, flags );
interface->Send (p, src.IsAny () ? Ipv6Address::GetAllNodesMulticast () : src);
interface->Send (p, src.IsAny () ? Ipv6Address::GetAllNodesMulticast () : src);
/* not a NS for us discard it */
}
@ -633,7 +658,7 @@ void Icmpv6L4Protocol::HandleNA (Ptr<Packet> packet, Ipv6Address const &src, Ipv
entry->StopDelayTimer ();
/* if the Flag O is clear and mac address differs from the cache */
if (!naHeader.GetFlagO () && lla.GetAddress ()!=entry->GetMacAddress ())
if (!naHeader.GetFlagO () && lla.GetAddress () != entry->GetMacAddress ())
{
if (entry->IsReachable ())
{
@ -656,7 +681,7 @@ void Icmpv6L4Protocol::HandleNA (Ptr<Packet> packet, Ipv6Address const &src, Ipv
waiting = entry->MarkReachable (lla.GetAddress ());
for (std::list<Ptr<Packet> >::const_iterator it = waiting.begin (); it != waiting.end (); it++)
{
cache->GetInterface ()->Send (*it, src);
cache->GetInterface ()->Send (*it, src);
}
entry->ClearWaitingPacket ();
}
@ -668,7 +693,7 @@ void Icmpv6L4Protocol::HandleNA (Ptr<Packet> packet, Ipv6Address const &src, Ipv
entry->StopReachableTimer ();
entry->StartReachableTimer ();
}
else if (lla.GetAddress ()!=entry->GetMacAddress ())
else if (lla.GetAddress () != entry->GetMacAddress ())
{
entry->MarkStale ();
}
@ -723,7 +748,7 @@ void Icmpv6L4Protocol::HandleRedirection (Ptr<Packet> packet, Ipv6Address const
if (entry->IsIncomplete () || entry->GetMacAddress () != llOptionHeader.GetAddress ())
{
/* update entry to STALE */
if (entry->GetMacAddress ()!=llOptionHeader.GetAddress ())
if (entry->GetMacAddress () != llOptionHeader.GetAddress ())
{
entry->SetMacAddress (llOptionHeader.GetAddress ());
entry->MarkStale ();
@ -750,6 +775,73 @@ void Icmpv6L4Protocol::HandleRedirection (Ptr<Packet> packet, Ipv6Address const
}
}
void Icmpv6L4Protocol::HandleDestinationUnreachable (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
{
NS_LOG_FUNCTION (this << *p << src << dst);
Ptr<Packet> pkt = p->Copy ();
Icmpv6DestinationUnreachable unreach;
pkt->RemoveHeader (unreach);
Ptr<Packet> origPkt = unreach.GetPacket ();
Ipv6Header ipHeader;
if ( origPkt->GetSerializedSize () > ipHeader.GetSerializedSize () )
{
origPkt->RemoveHeader (ipHeader);
uint8_t payload[8];
origPkt->CopyData (payload, 8);
Forward (src, unreach, unreach.GetCode (), ipHeader, payload);
}
}
void Icmpv6L4Protocol::HandleTimeExceeded (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
{
NS_LOG_FUNCTION (this << *p << src << dst);
Ptr<Packet> pkt = p->Copy ();
Icmpv6TimeExceeded timeexceeded;
pkt->RemoveHeader (timeexceeded);
Ptr<Packet> origPkt = timeexceeded.GetPacket ();
Ipv6Header ipHeader;
uint8_t payload[8];
origPkt->RemoveHeader (ipHeader);
origPkt->CopyData (payload, 8);
Forward (src, timeexceeded, timeexceeded.GetCode (), ipHeader, payload);
}
void Icmpv6L4Protocol::HandlePacketTooBig (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
{
NS_LOG_FUNCTION (this << *p << src << dst);
Ptr<Packet> pkt = p->Copy ();
Icmpv6TooBig tooBig;
pkt->RemoveHeader (tooBig);
Ptr<Packet> origPkt = tooBig.GetPacket ();
Ipv6Header ipHeader;
origPkt->RemoveHeader (ipHeader);
uint8_t payload[8];
origPkt->CopyData (payload, 8);
Forward (src, tooBig, tooBig.GetMtu (), ipHeader, payload);
}
void Icmpv6L4Protocol::HandleParameterError (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
{
NS_LOG_FUNCTION (this << *p << src << dst);
Ptr<Packet> pkt = p->Copy ();
Icmpv6ParameterError paramErr;
pkt->RemoveHeader (paramErr);
Ptr<Packet> origPkt = paramErr.GetPacket ();
Ipv6Header ipHeader;
origPkt->RemoveHeader (ipHeader);
uint8_t payload[8];
origPkt->CopyData (payload, 8);
Forward (src, paramErr, paramErr.GetCode (), ipHeader, payload);
}
void Icmpv6L4Protocol::SendMessage (Ptr<Packet> packet, Ipv6Address src, Ipv6Address dst, uint8_t ttl)
{
NS_LOG_FUNCTION (this << packet << src << dst << (uint32_t)ttl);
@ -851,7 +943,7 @@ void Icmpv6L4Protocol::SendNS (Ipv6Address src, Ipv6Address dst, Ipv6Address tar
dst = Ipv6Address::GetAllNodesMulticast ();
}
NS_LOG_LOGIC ("Send NS ( from " << src << " to " << dst << " target " << target <<")");
NS_LOG_LOGIC ("Send NS ( from " << src << " to " << dst << " target " << target << ")");
p->AddHeader (llOption);
ns.CalculatePseudoHeaderChecksum (src, dst, p->GetSize () + ns.GetSerializedSize (), PROT_NUMBER);
@ -930,7 +1022,7 @@ void Icmpv6L4Protocol::SendErrorTooBig (Ptr<Packet> malformedPacket, Ipv6Address
void Icmpv6L4Protocol::SendErrorTimeExceeded (Ptr<Packet> malformedPacket, Ipv6Address dst, uint8_t code)
{
NS_LOG_FUNCTION (this<< malformedPacket << dst << code);
NS_LOG_FUNCTION (this << malformedPacket << dst << code);
Ptr<Packet> p = Create<Packet> ();
uint32_t malformedPacketSize = malformedPacket->GetSize ();
Icmpv6TimeExceeded header;
@ -938,7 +1030,7 @@ void Icmpv6L4Protocol::SendErrorTimeExceeded (Ptr<Packet> malformedPacket, Ipv6A
NS_LOG_LOGIC ("Send Time Exceeded ( to " << dst << " code " << (uint32_t)code << " )");
/* 48 = sizeof IPv6 header + sizeof ICMPv6 error header */
if (malformedPacketSize <= 1280 - 48)
if (malformedPacketSize <= 1280 - 48)
{
header.SetPacket (malformedPacket);
}
@ -962,7 +1054,7 @@ void Icmpv6L4Protocol::SendErrorParameterError (Ptr<Packet> malformedPacket, Ipv
NS_LOG_LOGIC ("Send Parameter Error ( to " << dst << " code " << (uint32_t)code << " )");
/* 48 = sizeof IPv6 header + sizeof ICMPv6 error header */
if (malformedPacketSize <= 1280 -48 )
if (malformedPacketSize <= 1280 - 48 )
{
header.SetPacket (malformedPacket);
}
@ -992,7 +1084,7 @@ void Icmpv6L4Protocol::SendRedirection (Ptr<Packet> redirectedPacket, Ipv6Addres
if ((redirectedPacketSize % 8) != 0)
{
Ptr<Packet> pad = Create<Packet> (8 - (redirectedPacketSize % 8));
redirectedPacket->AddAtEnd (pad);
redirectedPacket->AddAtEnd (pad);
}
if (redirHardwareTarget.GetLength ())
@ -1081,7 +1173,7 @@ Ptr<Packet> Icmpv6L4Protocol::ForgeNS (Ipv6Address src, Ipv6Address dst, Ipv6Add
dst = Ipv6Address::GetAllNodesMulticast ();
}
NS_LOG_LOGIC ("Send NS ( from " << src << " to " << dst << " target " << target <<")");
NS_LOG_LOGIC ("Send NS ( from " << src << " to " << dst << " target " << target << ")");
p->AddHeader (llOption);
ns.CalculatePseudoHeaderChecksum (src, dst, p->GetSize () + ns.GetSerializedSize (), PROT_NUMBER);
@ -1196,7 +1288,7 @@ bool Icmpv6L4Protocol::Lookup (Ptr<Packet> p, Ipv6Address dst, Ptr<NetDevice> de
else
{
/* find source address that match destination */
addr = cache->GetInterface ()->GetAddressMatchingDestination (dst).GetAddress ();
addr = cache->GetInterface ()->GetAddressMatchingDestination (dst).GetAddress ();
}
SendNS (addr, Ipv6Address::MakeSolicitedAddress (dst), dst, cache->GetDevice ()->GetAddress ());
@ -1229,7 +1321,7 @@ void Icmpv6L4Protocol::FunctionDadTimeout (Ptr<Icmpv6L4Protocol> icmpv6, Ipv6Int
}
}
/* for the moment, this function is always called, if we was victim of a DAD the address is INVALID
/* for the moment, this function is always called, if we was victim of a DAD the address is INVALID
* and we do not set it to PREFERRED
*/
if (found && ifaddr.GetState () != Ipv6InterfaceAddress::INVALID)
@ -1242,9 +1334,9 @@ void Icmpv6L4Protocol::FunctionDadTimeout (Ptr<Icmpv6L4Protocol> icmpv6, Ipv6Int
*/
Ptr<Ipv6> ipv6 = icmpv6->m_node->GetObject<Ipv6> ();
if (!ipv6->IsForwarding (ipv6->GetInterfaceForDevice (interface->GetDevice ())) && addr.IsLinkLocal ())
if (!ipv6->IsForwarding (ipv6->GetInterfaceForDevice (interface->GetDevice ())) && addr.IsLinkLocal ())
{
/* XXX because all nodes start at the same time, there will be many of RS arround 1 second of simulation time
/* XXX because all nodes start at the same time, there will be many of RS arround 1 second of simulation time
* TODO Add random delays before sending RS
*/
Simulator::Schedule (Seconds (0.0), &Icmpv6L4Protocol::SendRS, PeekPointer (icmpv6), ifaddr.GetAddress (), Ipv6Address::GetAllRoutersMulticast (), interface->GetDevice ()->GetAddress ());

View File

@ -29,8 +29,7 @@
#include "icmpv6-header.h"
#include "ip-l4-protocol.h"
namespace ns3
{
namespace ns3 {
class NetDevice;
class Node;
@ -194,7 +193,7 @@ public:
* \brief Send a packet via ICMPv6.
* \param packet the packet to send
* \param dst destination address
* \param icmpv6Hdr ICMPv6 header (needed to calculate checksum
* \param icmpv6Hdr ICMPv6 header (needed to calculate checksum
* after source address is determined by routing stuff
* \param ttl next hop limit
*/
@ -202,8 +201,8 @@ public:
/**
* \brief Do the Duplication Address Detection (DAD).
* It consists in sending a NS with our IPv6 as target. If
* we received a NA with matched target address, we could not use
* It consists in sending a NS with our IPv6 as target. If
* we received a NA with matched target address, we could not use
* the address, else the address pass from TENTATIVE to PERMANENT.
*
* \param target target address
@ -325,13 +324,20 @@ public:
/**
* \brief Receive method.
* \param p the packet
* \param src source address
* \param dst destination address
* \param header the IPv4 header
* \param interface the interface from which the packet is coming
*/
virtual enum IpL4Protocol::RxStatus Receive (Ptr<Packet> p,
Ipv4Header const &header,
Ptr<Ipv4Interface> interface);
/**
* \brief Receive method.
* \param p the packet
* \param src source address
* \param dst destination address
* \param interface the interface from which the packet is coming
*/
virtual enum IpL4Protocol::RxStatus Receive (Ptr<Packet> p,
Ipv6Address &src, Ipv6Address &dst,
Ptr<Ipv6Interface> interface);
@ -396,7 +402,6 @@ protected:
virtual void DoDispose ();
private:
typedef std::list<Ptr<NdiscCache> > CacheList;
/**
@ -414,6 +419,18 @@ private:
*/
bool m_alwaysDad;
/**
* \brief Notify an ICMPv6 reception to upper layers (if requested).
* \param source the ICMP source
* \param icmp the ICMP header
* \param info information about the ICMP
* \param ipHeader the IP header carried by the ICMP
* \param payload the data carried by the ICMP
*/
void Forward (Ipv6Address source, Icmpv6Header icmp,
uint32_t info, Ipv6Header ipHeader,
const uint8_t payload[8]);
/**
* \brief Receive Neighbor Solicitation method.
* \param p the packet
@ -468,6 +485,42 @@ private:
*/
void HandleRedirection (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface);
/**
* \brief Receive Destination Unreachable method.
* \param p the packet
* \param src source address
* \param dst destination address
* \param interface the interface from which the packet is coming
*/
void HandleDestinationUnreachable (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface);
/**
* \brief Receive Time Exceeded method.
* \param p the packet
* \param src source address
* \param dst destination address
* \param interface the interface from which the packet is coming
*/
void HandleTimeExceeded (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface);
/**
* \brief Receive Packet Too Big method.
* \param p the packet
* \param src source address
* \param dst destination address
* \param interface the interface from which the packet is coming
*/
void HandlePacketTooBig (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface);
/**
* \brief Receive Parameter Error method.
* \param p the packet
* \param src source address
* \param dst destination address
* \param interface the interface from which the packet is coming
*/
void HandleParameterError (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface);
/**
* \brief Link layer address option processing.
* \param lla LLA option

View File

@ -504,8 +504,6 @@ Ipv4L3Protocol::Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t p
NS_LOG_WARN ("No route found for forwarding packet. Drop.");
m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject<Ipv4> (), interface);
}
}
Ptr<Icmpv4L4Protocol>

Some files were not shown because too many files have changed in this diff Show More