Add a small documentation
diff --git a/docs/source/conf.py b/docs/source/conf.py
new file mode 100644
index 0000000..8da1d3a
--- /dev/null
+++ b/docs/source/conf.py
@@ -0,0 +1,242 @@
+# -*- coding: utf-8 -*-
+#
+# ndnSIM: NS-3 based NDN simulator documentation build configuration file, created by
+# sphinx-quickstart on Thu May 31 18:21:13 2012.
+#
+# 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 = []
+
+# 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'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'ndnSIM: NS-3 based NDN simulator'
+copyright = u'2012, Alexander Afanasyev, Ilya Moiseenko, and Lixia Zhang'
+
+# 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 = '0.1'
+# The full version, including alpha/beta/rc tags.
+release = '0.1a1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# 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 = 'ndnSIMNS-3basedNDNsimulatordoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+ ('index', 'ndnSIMNS-3basedNDNsimulator.tex', u'ndnSIM: NS-3 based NDN simulator Documentation',
+ u'Alexander Afanasyev, Ilya Moiseenko, and Lixia Zhang', '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
+
+# 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', 'ndnsimns-3basedndnsimulator', u'ndnSIM: NS-3 based NDN simulator Documentation',
+ [u'Alexander Afanasyev, Ilya Moiseenko, and Lixia Zhang'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ ('index', 'ndnSIMNS-3basedNDNsimulator', u'ndnSIM: NS-3 based NDN simulator Documentation',
+ u'Alexander Afanasyev, Ilya Moiseenko, and Lixia Zhang', 'ndnSIMNS-3basedNDNsimulator', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
diff --git a/docs/source/examples.rst b/docs/source/examples.rst
new file mode 100644
index 0000000..3e08120
--- /dev/null
+++ b/docs/source/examples.rst
@@ -0,0 +1,82 @@
+Examples
+========
+
+Simple scenario
+---------------
+
+The first example (``ccnx-simple.cc``) shows very basics of ndnSIM. In the simulated
+topology there are 3 nodes, connected with point-to-point links, one
+NDN consumer, and one NDN producer::
+
+ +----------+ 1Mbps +--------+ 1Mbps +----------+
+ | consumer | <------------> | router | <------------> | producer |
+ +----------+ 10ms +--------+ 10ms +----------+
+
+Consumer requests data from producer with frequency 10 interests per second
+(interests contain constantly increasing sequence number).
+
+For every received interest, producer replies with a data packet, containing
+1024 bytes of virtual payload.
+
+The following code represents all that is necessary to run such a
+simple scenario
+
+.. code-block:: c++
+
+ #include "ns3/core-module.h"
+ #include "ns3/network-module.h"
+ #include "ns3/point-to-point-module.h"
+ #include "ns3/ndnSIM-module.h"
+
+ using namespace ns3;
+
+ int
+ main (int argc, char *argv[])
+ {
+ // setting default parameters for PointToPoint links and channels
+ Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
+ Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("10ms"));
+ Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("20"));
+
+ // Creating nodes
+ NodeContainer nodes;
+ nodes.Create (3);
+
+ // Connecting nodes using two links
+ PointToPointHelper p2p;
+ p2p.Install (nodes.Get (0), nodes.Get (1));
+ p2p.Install (nodes.Get (1), nodes.Get (2));
+
+ // Install CCNx stack on all nodes
+ CcnxStackHelper ccnxHelper;
+ ccnxHelper.SetDefaultRoutes (true);
+ ccnxHelper.InstallAll ();
+
+ // Installing applications
+
+ // Consumer
+ CcnxAppHelper consumerHelper ("ns3::CcnxConsumerCbr");
+ // Consumer will request /prefix/0, /prefix/1, ...
+ consumerHelper.SetPrefix ("/prefix");
+ consumerHelper.SetAttribute ("Frequency", StringValue ("10")); // 10 interests a second
+ consumerHelper.Install (nodes.Get (0)); // first node
+
+ // Producer
+ CcnxAppHelper producerHelper ("ns3::CcnxProducer");
+ // Producer will reply to all requests starting with /prefix
+ producerHelper.SetPrefix ("/prefix");
+ producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ producerHelper.Install (nodes.Get (2)); // last node
+
+ Simulator::Stop (Seconds (20.0));
+
+ Simulator::Run ();
+ Simulator::Destroy ();
+
+ return 0;
+ }
+
+If NS-3 is compiled in debug mode, you can run and see progress of the
+simulation using the following command::
+
+ NS_LOG=CcnxConsumer:CcnxProducer ./waf --run=ccnx-simple
diff --git a/docs/source/index.rst b/docs/source/index.rst
new file mode 100644
index 0000000..ad6750f
--- /dev/null
+++ b/docs/source/index.rst
@@ -0,0 +1,13 @@
+.. ndnSIM: NS-3 based NDN simulator documentation master file
+
+Welcome to ndnSIM NS-3 based NDN simulator
+==========================================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+ intro
+ helpers
+ examples
diff --git a/docs/source/intro.rst b/docs/source/intro.rst
new file mode 100644
index 0000000..b4a03b5
--- /dev/null
+++ b/docs/source/intro.rst
@@ -0,0 +1,175 @@
+.. ndnSIM: NS-3 based NDN simulator
+.. ============================================================
+
+.. .. toctree::
+.. :maxdepth: 2
+
+Introduction
+==============
+
+The ndnSIM is NS-3 module that implements Named Data Networking (NDN) communication model, the clean slate Internet design. ndnSIM is specially optimized for simulation purposes and has a cleaner and more extensible internal structure comparing to the existing NDN implementation (Project CCNx).
+
+Following the NDN architecture, ndnSIM is implemented as a new network-layer protocol model, which can run on top of any available link-layer protocol model (point-to-point, CSMA, wireless, etc.).
+
+.. note::
+ It will also be possible to run ndnSIM on top of network-layer (IPv4, IPv6) and transport-layer (TCP, UDP) protocols.
+ However, it is not yet implemented and patches are welcome.
+
+.. This flexibility allows ndnSIM to simulate scenarios of various homogeneous and heterogeneous networks (e.g., NDN-only, NDN-over-IP, etc.).
+
+The simulator is implemented in a modular fashion, using separate C++ classes to model behavior of each network-layer entity in NDN: pending Interest table (PIT), forwarding information base (FIB), content store, network and application interfaces, Interest forwarding strategies, etc.
+This modular structure allows any component to be easily modified or replaced with no or minimal impact on other components.
+In addition, the simulator provides an extensive collection of interfaces and helpers to perform detailed tracing behavior of every component, as well as NDN traffic flow.
+
+The wire format of Interest and Data packets follows the format of the existing `CCNx Project's NDN implementation`_ (CCNx Binary Encoding), allowing reuse of the existing traffic analysis tools, as well as driving simulations using real NDN traffic traces.
+
+.. _CCNx Project's NDN implementation: http://www.ccnx.org/
+
+Getting Started
+===============
+
+Portability
+------------
+
+ndnSIM has been successfully compiled and used under Ubuntu Linux 11.04 (stock gcc), Mac OS 10.6/10.7 (gcc-4.2 apple/llvm, macports gcc 4.6), FreeBSD 8.2 (requires gcc from ports - the stock gcc will not work!).
+
+Requirements
+-------------
+
+1. ndnSIM requires the latest version of NS-3 simulator (as of May 31st, 2012, development branch of NS-3).
+
+2. ndnSIM requires boost libraries:
+
+ * For Ubuntu::
+
+ sudo aptitude install libboost-all-dev
+
+ * For MacOS (macports)::
+
+ sudo port instal boost
+
+3. Other NS-3 modules have additional dependencies. For example, in
+order to run `visualizer`_ module, the following should be installed:
+
+ * For Ubuntu::
+
+ sudo apt-get install python-dev python-pygraphviz python-kiwi
+ sudo apt-get install python-pygoocanvas python-gnome2
+ sudo apt-get install python-gnomedesktop python-rsvg ipython
+
+ * For MacOS (macports)::
+
+ sudo port install py27-pygraphviz py27-kiwi py27-goocanvas
+
+.. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz
+
+Downloading ndnSIM source
+=========================
+
+Only ndnSIM
+--------------
+
+Download NS-3 simulator. For example::
+
+ hg clone http://code.nsnam.org/ns-3-allinone/ ns-3-all
+ cd ns-3-all
+ ./download.py
+
+ndnSIM source code should be placed in ``src/ndnSIM`` folder under NS-3 simulator source tree. For example::
+
+ cd ns-3-dev
+ git clone git@github.com:NDN-Routing/ndnSIM.git ns-3/src/ndnSIM
+
+After cloning, a number of patches need to be applied to the base NS-3 to make sure ndnSIM compiles and works::
+
+ find src/ndnSIM/patches/ -type f -print 0 | xargs -0 patch -p1
+
+
+Custom (unsupported) branch of NS-3
+-------------------------------------------
+
+Alternatively, it is possible to download a custom (unsupported) branch of NS-3 that contains all necessary patches and more::
+
+ mkdir ndnSIM
+ cd ndnSIM
+ git clone git@github.com:cawka/ns-3-dev-ndnSIM.git ns-3
+ git clone git@github.com:cawka/pybindgen.git pybindgen
+ git clone git@github.com:NDN-Routing/ndnSIM.git ns-3/src/ndnSIM
+
+The first command is to create a directory, which will contain everything NS-3 related. The bare minimum is just base NS-3 (the first clone above). The second clone gets a module necessary to build python bindings, which are necessary for the visualizer module. The third clone gets actual ndnSIM code and places it in src/ directory.
+
+There are quite a few modification to the base NS-3 code that are necessary to run ndnSIM, and the code is periodically synchronized with the official developer branch. Eventually, all the changes will be merged to the official branch, but for the time being, it is necessary to use the customized branch.
+
+Compiling and running ndnSIM
+============================
+
+ndnSIM uses standard NS-3 compilation procedure. For example::
+
+ cd <ns-3-folder>
+ ./waf configure --enable-examples
+ ./waf
+
+To run :doc:`sample ndnSIM simulations <examples>`::
+
+ ./waf --run=ccnx-simple
+
+or::
+
+ ./waf --run=ccnx-grid
+
+.. note::
+ Do not forget to configure and compile NS-3 in optimized mode (``./waf configure -d optimized``) in order to run actual simulations.
+
+Logging
+-----------------
+
+Almost every component in ndnSIM exports logging interface, so it is possible in debug compilation of simulator to track many details. For example, by enabling logging of CcnxFace and CcnxConsumer will show everything what happens on CcnxFace and CcnxConsumer classes::
+
+ NS_LOG=CcnxFace:CcnxConsumer ./waf --run=ccnx-simple
+
+Refer to the source code and NS-3 documentation to see what logging interfaces are available and about details how enable one or more logging interfaces.
+
+Documentation
+------------------------
+
+Overall structure of ndnSIM is described in our technical report.
+
+It is also possible to build doxygen documentation of ndnSIM API (in ns-3/doc/html/), provided that doxygen and graphviz modules are installed on system::
+
+ ./waf doxygen
+
+
+A very short guide to the code
+==============================
+
+All the NDN related code is in ns-3/src/ndnSIM
+
++-----------------+---------------------------------------------------------------------+
+| Folder | Description |
++=================+=====================================================================+
+| ``examples/`` | contain several example scenarios |
++-----------------+---------------------------------------------------------------------+
+| ``apps/`` | applications (in NS-3 sense) that can be installed on the nodes. |
+| | Right now we have one producer (``CcnxProducer``) and a collection |
+| | of consumer (``CcnxConsumerCbr``, ``CcnxConsumerWindow``, |
+| | ``CcnxConsumerBatches``). See doxygen documentation or source |
+| | code for details |
++-----------------+---------------------------------------------------------------------+
+| ``helper/`` | a number of useful helpers |
++-----------------+---------------------------------------------------------------------+
+| ``model/`` | implementation of NDN base: L3 protocol, faces, forwarding |
+| | strategies, etc. |
++-----------------+---------------------------------------------------------------------+
+| ``utils/`` | helper classes |
++-----------------+---------------------------------------------------------------------+
+| ``plugins/`` | a number of plugins that may be helpful to run simulation scenarios |
++-----------------+---------------------------------------------------------------------+
+
+
+.. Indices and tables
+.. ==================
+
+.. * :ref:`genindex`
+.. * :ref:`modindex`
+.. * :ref:`search`
+