manpages: build manpages
This commit also imports manpages of ndnpeek and ndnpoke from
NFD:commit:6ee6e07e6f1c068f7658a616982ab785f3bd8b22.
refs #2816
Change-Id: Ibc7bbbbd063af0107fa5883baccc12c7789bcc72
diff --git a/manpages/conf.py b/manpages/conf.py
new file mode 100644
index 0000000..20709a9
--- /dev/null
+++ b/manpages/conf.py
@@ -0,0 +1,11 @@
+# General information about the project.
+project = u'NDN Essential Tools'
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ ('ndnpeek', 'ndnpeek', 'simple consumer to send one Interest and expect one Data', None, 1),
+ ('ndnpoke', 'ndnpoke', 'simple producer to publish one Data', None, 1),
+]
diff --git a/manpages/ndnpeek.rst b/manpages/ndnpeek.rst
new file mode 100644
index 0000000..1f36263
--- /dev/null
+++ b/manpages/ndnpeek.rst
@@ -0,0 +1,56 @@
+ndnpeek
+=======
+
+Usage
+-----
+
+::
+
+ ndnpeek [-h] [-f] [-r] [-m min] [-M max] [-l lifetime] [-p] [-w timeout] name
+
+Description
+-----------
+
+``ndnpeek`` is a simple consumer program that sends one Interest and expects one Data
+packet in response. The full Data packet (in TLV format) is written to stdout. The
+program terminates with return code 0 if Data arrives, and with return code 1 when timeout
+occurs.
+
+``name`` is interpreted as the Interest name.
+
+Options
+-------
+
+``-h``
+ Print help and exit
+
+``-f``
+ If specified, set ``MustBeFresh`` selector in the Interest packet.
+
+``-r``
+ Set ``ChildSelector=1`` (the rightmost child) selector.
+
+``-m``
+ Set ``min`` as the ``MinSuffixComponents`` selector.
+
+``-M``
+ Set ``max`` as the ``MaxSuffixComponents`` selector.
+
+``-l``
+ Set ``lifetime`` (in milliseconds) as the ``InterestLifetime``.
+
+``-p``
+ If specified, print the received payload only, not the full packet.
+
+``-w``
+ Timeout after ``timeout`` milliseconds.
+
+
+Examples
+--------
+
+Send Interest for ``ndn:/app1/video`` and print the received payload only
+
+::
+
+ ndnpeek -p ndn:/app1/video
diff --git a/manpages/ndnpoke.rst b/manpages/ndnpoke.rst
new file mode 100644
index 0000000..c4c0a47
--- /dev/null
+++ b/manpages/ndnpoke.rst
@@ -0,0 +1,54 @@
+ndnpoke
+=======
+
+Usage
+-----
+
+::
+
+ ndnpoke [-h] [-f] [-D] [-i identity] [-F] [-x freshness] [-w timeout] name
+
+Description
+-----------
+
+``ndnpoke`` is a simple producer program that reads payload from stdin and publishes it
+as a single NDN Data packet. The Data packet is published either as a response to the
+incoming Interest for the given ``name``, or forcefully pushed to the local NDN
+forwarder's cache if ``-f`` flag is specified.
+
+The program terminates with return code 0 if Data is sent and with return code 1 when
+timeout occurs.
+
+Options
+-------
+
+``-h``
+ Print usage and exit.
+
+``-f``
+ If specified, send Data without waiting for Interest.
+
+``-D``
+ If specified, use ``DigestSha256`` signature instead of default ``SignatureSha256WithRsa``.
+
+``-i``
+ Use ``identity`` to sign the created Data packet.
+
+``-F``
+ Set ``FinalBlockId`` to the last component of specified name.
+
+``-x``
+ Set ``FreshnessPeriod`` in milliseconds.
+
+``-w``
+ Wait at most ``timeout`` milliseconds for the incoming Interest. If no Interest arrives
+ within the ``timeout``, the Data packet will not be published.
+
+
+Examples
+--------
+
+Create Data packet with content ``hello`` with the name ``ndn:/app/video`` and wait at
+most 3 seconds for the incoming Interest for it::
+
+ echo "Hello" | build/bin/ndnpoke -w 3000 ndn:/app/video
diff --git a/manpages/wscript b/manpages/wscript
new file mode 100644
index 0000000..e1093a4
--- /dev/null
+++ b/manpages/wscript
@@ -0,0 +1,10 @@
+def build(bld):
+ if not bld.env['SPHINX_BUILD']:
+ return
+ bld(features='sphinx',
+ builder='man',
+ outdir='.',
+ config='./conf.py',
+ source=bld.path.ant_glob('*.rst'),
+ install_path='${MANDIR}/',
+ VERSION=bld.env['VERSION'])