tools: Publish /localhop/ndn-autoconf/routable-prefixes from ndn-autoconfig-server

Change-Id: I2902b91cebf1f4b8ac1a7dabedb0f0cbd0a13b24
Refs: #1954
diff --git a/docs/manpages/ndn-autoconfig-server.rst b/docs/manpages/ndn-autoconfig-server.rst
index 8ed7968..c38b6c1 100644
--- a/docs/manpages/ndn-autoconfig-server.rst
+++ b/docs/manpages/ndn-autoconfig-server.rst
@@ -8,7 +8,7 @@
 
 ::
 
-    ndn-autoconfig-server [-h] FaceUri
+    ndn-autoconfig-server [-h] [-p prefix] [-p prefix] ... FaceUri
 
 
 Description
@@ -27,6 +27,13 @@
 ``FaceUri``
   FaceUri for this NDN hub.
 
+``-p prefix``
+  A local prefix for which the local hub allow end applications to register prefix
+  (See more details in :ref:`local-prefix-discovery`).  One can supply more than one
+  prefixes.  All supplied prefixes will be put into the local prefix discovery data
+  as described in :ref:`local-prefix-discovery`.  If no prefix is specified,
+  auto-config-server will not serve any local prefix discovery data.
+
 Examples
 --------
 
@@ -34,6 +41,8 @@
 
     ndn-autoconfig-server tcp://spurs.cs.ucla.edu
 
+    ndn-autoconfig-server -p /ndn/edu/ucla tcp://spurs.cs.ucla.edu
+
 
 See also
 --------
diff --git a/docs/misc/local-prefix-discovery.rst b/docs/misc/local-prefix-discovery.rst
new file mode 100644
index 0000000..f1bca84
--- /dev/null
+++ b/docs/misc/local-prefix-discovery.rst
@@ -0,0 +1,32 @@
+.. _local-prefix-discovery:
+
+Discover local hub prefix
+=========================
+
+Some applications need to discover prefix(es) under which they can publish data
+/ which Interests local hub will be able to forward down to the application.
+In order to discover that, applications need to send an interest for
+``/localhop/ndn-autoconf/routable-prefixes`` prefix. Response data to the
+interest contains a list of prefixes and should be encoded as:
+
+::
+
+    Response ::= DATA-TYPE TLV-LENGTH
+                 Name (= /localhop/ndn-autoconf/routable-prefixes/[version])
+                 MetaInfo (= ResponseMetaInfo)
+                 Content (= ResponseContent)
+                 Signature
+
+    ResponseMetaInfo ::= META-INFO-TYPE TLV-LENGTH
+                         ContentType (= DATA)
+                         FreshnessPeriod (= 5000)
+
+    ResponseContent ::= Name+
+
+.. note::
+ResponseContent should contain at least one Name, which should be routable
+towards the face from which the request has been received.  The requester may
+process list of the returned names and pick whichever it wants to use.
+
+For now, the ``/localhop/ndn-autoconf/routable-prefixes`` data is served by
+:ref:`ndn-autoconfig-server`.