Convert the rest of the document
Change-Id: I52ce8e0b9185c73646ecbc3afb14e5cb44f0fbc8
diff --git a/details/binary-xml-wire-format.rst b/details/binary-xml-wire-format.rst
new file mode 100644
index 0000000..683eeff
--- /dev/null
+++ b/details/binary-xml-wire-format.rst
@@ -0,0 +1,185 @@
+BinaryXmlWireFormat Class
+=========================
+
+:[C++]:
+ Namespace: `ndn`
+
+BinaryXmlWireFormat Constructor
+-------------------------------
+
+Create a BinaryXmlWireFormat which extends the WireFormat interface to implement encoding and decoding in binary XML.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ BinaryXmlWireFormat();
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ var BinaryXmlWireFormat = function BinaryXmlWireFormat()
+
+BinaryXmlWireFormat.decodeData Method
+-------------------------------------
+
+Decode the input and Binary XML and put the result in data.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void decodeData(
+
+ Data& data,
+ const uint8_t* input,
+ size_t inputLength
+ [, size_t* signedPortionBeginOffset,
+ size_t* signedPortionEndOffset]
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ BinaryXmlWireFormat.prototype.decodeContentObject = function(
+
+ contentObject, // ContentObject
+ input // Uint8Array
+
+ )
+
+:Parameters:
+
+ - `data`
+ The Data which is set to the values decoded from the input.
+
+ - `input`
+ The input byte array to be decoded.
+
+ - `inputLength`
+ (C++ only) The length of the input byte array.
+
+ - `signedPortionBeginOffset`
+ (optional) Return the offset in the input of the beginning of the signed portion. If you are not decoding in order to verify, you can ignore this returned value.
+
+ - `signedPortionEndOffset`
+ (optional) Return the offset in the input of the end of the signed portion. If you are not decoding in order to verify, you can ignore this returned value.
+
+BinaryXmlWireFormat.encodeData Method
+-------------------------------------
+
+Encode the data object as Binary XML and return the encoding.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ Blob encodeData(
+
+ const Data& data
+ [, size_t* signedPortionBeginOffset,
+ size_t* signedPortionEndOffset]
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ // Returns Uint8Array
+ BinaryXmlWireFormat.prototype.encodeContentObject = function(
+
+ contentObject, // ContentObject
+
+ )
+
+:Parameters:
+
+ - `data`
+ The Data object to be encoded.
+
+ - `signedPortionBeginOffset`
+ (optional) Return the offset in the encoding of the beginning of the signed portion. If you are not encoding in order to sign, you can ignore this returned value.
+
+ - `signedPortionEndOffset`
+ (optional) Return the offset in the encoding of the end of the signed portion. If you are not encoding in order to sign, you can ignore this returned value.
+
+:Returns:
+
+ The encoded byte array.
+
+BinaryXmlWireFormat.decodeInterest Method
+-----------------------------------------
+
+Decode the input and Binary XML and put the result in interest.
+
+:[C++]:
+ .. code-block:: c++
+
+ void decodeInterest(
+
+ Interest& interest,
+ const uint8_t* input,
+ size_t inputLength
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ BinaryXmlWireFormat.prototype.decodeInterest = function(
+
+ interest, // Interest
+ input // Uint8Array
+
+ )
+
+:Parameters:
+
+ - `interest`
+ The Interest which is set to the values decoded from the input.
+
+ - `input`
+ The input byte array to be decoded.
+
+ - `inputLength`
+ (C++ only) The length of the input byte array.
+
+BinaryXmlWireFormat.encodeInterest Method
+-----------------------------------------
+
+Encode the interest as Binary XML and return the encoding.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ Blob encodeInterest(
+
+ const Interest& interest,
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ // Returns Uint8Array
+ BinaryXmlWireFormat.prototype.encodeContentObject = function(
+
+ interest, // Interest
+
+ )
+
+:Parameters:
+
+ - `interest`
+ The Interest to be encoded.
+
+:Returns:
+
+ The encoded byte array.
diff --git a/details/cpp.rst b/details/cpp.rst
new file mode 100644
index 0000000..37d47e1
--- /dev/null
+++ b/details/cpp.rst
@@ -0,0 +1,50 @@
+ptr_lib (C++)
+=============
+
+Some C++ methods need to use shared_ptr. Depending on where ./configure found shared_ptr, define the ptr_lib namespace as follows, so that the API always uses ndn::ptr_lib::shared_ptr.
+
+.. code-block:: c++
+
+ #if NDN_CPP_HAVE_STD_SHARED_PTR
+ #include
+ #include <memory>
+ namespace ndn { namespace ptr_lib = std; }
+ #elif NDN_CPP_HAVE_BOOST_SHARED_PTR
+ #include <boost/shared_ptr.hpp>
+ #include <boost/make_shared.hpp>
+ namespace ndn { namespace ptr_lib = boost; }
+ #else
+ // Use the boost header files in this distribution.
+ #include <ndnboost/shared_ptr.hpp>
+ #include <ndnboost/make_shared.hpp>
+ namespace ndn { namespace ptr_lib = ndnboost; }
+ #endif
+
+Time representation
+===================
+
+Some methods use calendar time or a time interval. These are represented as follows.
+
+Milliseconds Typedef
+--------------------
+
+(C++ only) A time interval represented as the number of milliseconds.
+
+:[C++]:
+ Namespace: `ndn`
+
+.. code-block:: c++
+
+ typedef double Milliseconds;
+
+MillisecondsSince1970 Typedef
+-----------------------------
+
+(C++ only) The calendar time represented as the number of milliseconds since 1/1/1970.
+
+:[C++]:
+ Namespace: ndn
+
+.. code-block:: c++
+
+ typedef double MillisecondsSince1970;
diff --git a/details/forwarding-flags.rst b/details/forwarding-flags.rst
new file mode 100644
index 0000000..e499d02
--- /dev/null
+++ b/details/forwarding-flags.rst
@@ -0,0 +1,431 @@
+ForwardingFlags Class
+=====================
+
+A ForwardingFlags object holds the flags which specify how the forwarding daemon should forward an interest for a registered prefix. We use a separate ForwardingFlags object to retain future compatibility if the daemon forwarding bits are changed, amended or deprecated.
+
+:[C++]:
+ Namespace: `ndn`
+
+ForwardingFlags Constructor
+
+Create a new ForwardingFlags with "active" and "childInherit" set and all other flags cleared.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ ForwardingFlags();
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ var ForwardingFlags = function ForwardingFlags()
+
+ForwardingFlags.getActive Method
+--------------------------------
+
+Get the value of the "active" flag.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ bool getActive() const;
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.getActive = function()
+
+:Returns:
+
+ true if the flag is set, false if it is cleared.
+
+ForwardingFlags.getChildInherit Method
+--------------------------------------
+
+Get the value of the "childInherit" flag.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ bool getChildInherit() const;
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.getChildInherit = function()
+
+:Returns:
+
+ true if the flag is set, false if it is cleared.
+
+ForwardingFlags.getAdvertise Method
+-----------------------------------
+
+Get the value of the "advertise" flag.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ bool getAdvertise() const;
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.getAdvertise = function()
+
+:Returns:
+
+ true if the flag is set, false if it is cleared.
+
+ForwardingFlags.getLast Method
+------------------------------
+
+Get the value of the "last" flag.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ bool getLast() const;
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.getLast = function()
+
+:Returns:
+
+ true if the flag is set, false if it is cleared.
+
+ForwardingFlags.getCapture Method
+---------------------------------
+
+Get the value of the "capture" flag.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ bool getCapture() const;
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.getCapture = function()
+
+:Returns:
+
+ true if the flag is set, false if it is cleared.
+
+ForwardingFlags.getLocal Method
+-------------------------------
+
+Get the value of the "local" flag.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ bool getLocal() const;
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.getLocal = function()
+
+:Returns:
+
+ true if the flag is set, false if it is cleared.
+
+ForwardingFlags.getTap Method
+-----------------------------
+
+Get the value of the "tap" flag.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ bool getTap() const;
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.getTap = function()
+
+:Returns:
+
+ true if the flag is set, false if it is cleared.
+
+ForwardingFlags.getCaptureOk Method
+-----------------------------------
+
+Get the value of the "captureOk" flag.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ bool getCaptureOk() const;
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.getCaptureOk = function()
+
+:Returns:
+
+ true if the flag is set, false if it is cleared.
+
+ForwardingFlags.setActive Method
+--------------------------------
+
+Set the value of the "active" flag
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void setActive(
+
+ bool active;
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.setActive = function(
+
+ active // boolean
+
+ )
+
+:Parameters:
+
+ - `active`
+ true to set the flag, false to clear it.
+
+ForwardingFlags.setChildInherit Method
+--------------------------------------
+
+Set the value of the "childInherit" flag
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void setChildInherit(
+
+ bool childInherit;
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.setChildInherit = function(
+
+ childInherit // boolean
+
+ )
+
+:Parameters:
+
+ - `childInherit`
+ true to set the flag, false to clear it.
+
+ForwardingFlags.setAdvertise Method
+-----------------------------------
+
+Set the value of the "advertise" flag
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void setAdvertise(
+
+ bool advertise;
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.setAdvertise = function(
+
+ advertise // boolean
+
+ )
+
+:Parameters:
+
+ - `advertise`
+ true to set the flag, false to clear it.
+
+ForwardingFlags.setLast Method
+------------------------------
+
+Set the value of the "last" flag
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void setLast(
+
+ bool last;
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.setLast = function(
+
+ last // boolean
+
+ )
+
+:Parameters:
+
+ - `last`
+ true to set the flag, false to clear it.
+
+ForwardingFlags.setCapture Method
+---------------------------------
+
+Set the value of the "capture" flag
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void setCapture(
+
+ bool capture;
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.setCapture = function(
+
+ capture // boolean
+
+ )
+
+:Parameters:
+
+ - `capture`
+ true to set the flag, false to clear it.
+
+ForwardingFlags.setLocal Method
+-------------------------------
+
+Set the value of the "local" flag
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void setLocal(
+
+ bool local;
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.setLocal = function(
+
+ local // boolean
+
+ )
+
+:Parameters:
+
+ - `local`
+ true to set the flag, false to clear it.
+
+ForwardingFlags.setTap Method
+-----------------------------
+
+Set the value of the "tap" flag
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void setTap(
+
+ bool tap;
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.setTap = function(
+
+ tap // boolean
+
+ )
+
+:Parameters:
+
+ - `tap`
+ true to set the flag, false to clear it.
+
+ForwardingFlags.setCaptureOk Method
+-----------------------------------
+
+Set the value of the "captureOk" flag
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void setCaptureOk(
+
+ bool captureOk;
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ ForwardingFlags.prototype.setCaptureOk = function(
+
+ captureOk // boolean
+
+ )
+
+:Parameters:
+
+ - `captureOk`
+ true to set the flag, false to clear it.
diff --git a/details/tcp-transport.rst b/details/tcp-transport.rst
new file mode 100644
index 0000000..ef9cf4c
--- /dev/null
+++ b/details/tcp-transport.rst
@@ -0,0 +1,125 @@
+TcpTransport.ConnectionInfo Class
+=================================
+
+:[C++]:
+ Namespace: ndn
+
+A TcpTransport::ConnectionInfo extends Transport::ConnectionInfo to hold the host and port info for the TCP connection.
+
+TcpTransport.ConnectionInfo Constructor
+---------------------------------------
+
+Create a TcpTransport.ConnectionInfo with the given host and port.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ TcpTransport(
+
+ const char *host
+ [, unsigned short port]
+
+ );
+
+:Parameters:
+
+ - `host`
+ The host for the connection.
+
+ - `port`
+ (optional) The port number for the connection. If omitted, use 9695.
+
+.. _TcpTransport:
+
+TcpTransport Class
+==================
+
+:[C++]:
+
+Namespace: `ndn`
+
+TcpTransport Constructor
+------------------------
+
+Create a TcpTransport which extends the Transport interface to implement communication over TCP/IP.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ TcpTransport();
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ var TcpTransport = function TcpTransport()
+
+TcpTransport.connect Method
+---------------------------
+
+Connect according to the info in ConnectionInfo, and use elementListener to receive data.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void connect(
+
+ const Transport::ConnectionInfo& connectionInfo,
+ ElementListener& elementListener
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ TcpTransport.prototype.connect = function(
+
+ ndn // NDN
+
+ )
+
+:Parameters:
+
+ - `connectionInfo`
+ A TcpTransport.ConnectionInfo with the info for connecting.
+
+ - `elementListener`
+ The ElementListener called when an element is received.
+
+TcpTransport.send Method
+------------------------
+
+Send the data over the connection.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void send(
+
+ const uint8_t* data,
+ size_t dataLength
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ TcpTransport.prototype.send = function(
+
+ data // Uint8Array
+
+ )
+
+:Parameters:
+
+ - `data`
+ The data byte array to send.
+
+ - `dataLength`
+ (C++ only) The length of the data byte array.
diff --git a/details/udp-transport.rst b/details/udp-transport.rst
new file mode 100644
index 0000000..7f57e94
--- /dev/null
+++ b/details/udp-transport.rst
@@ -0,0 +1,108 @@
+UdpTransport.ConnectionInfo Class
+=================================
+
+:[C++]:
+ Namespace: `ndn`
+
+A UdpTransport::ConnectionInfo extends Transport::ConnectionInfo to hold the host and port info for the UDP connection.
+
+UdpTransport.ConnectionInfo Constructor
+---------------------------------------
+
+Create a UdpTransport.ConnectionInfo with the given host and port.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ UdpTransport(
+
+ const char *host
+ [, unsigned short port]
+
+ );
+
+:Parameters:
+
+ - `host`
+ The host for the connection.
+
+ - `port`
+ (optional) The port number for the connection. If omitted, use 9695.
+
+.. _UdpTransport:
+
+UdpTransport Class
+==================
+
+:[C++]:
+ Namespace: `ndn`
+
+UdpTransport Constructor
+------------------------
+
+Create a UdpTransport which extends the Transport interface to implement communication over UDP.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ UdpTransport();
+
+UdpTransport.connect Method
+---------------------------
+
+Connect according to the info in ConnectionInfo, and use elementListener to receive data.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void connect(
+
+ const Transport::ConnectionInfo& connectionInfo,
+ ElementListener& elementListener
+
+ );
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ TcpTransport.prototype.connect = function(
+
+ ndn // NDN
+
+ )
+
+:Parameters:
+
+ - `connectionInfo`
+ A UdpTransport.ConnectionInfo with the info for connecting.
+
+ - `elementListener`
+ The ElementListener called when an element is received
+
+UdpTransport.send Method
+------------------------
+
+Send the data over the connection.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ void send(
+
+ const uint8_t* data,
+ size_t dataLength
+
+ );
+
+:Parameters:
+
+ - `data`
+ The data byte array to send.
+
+ - `dataLength`
+ (C++ only) The length of the data byte array.
diff --git a/details/wire-format.rst b/details/wire-format.rst
new file mode 100644
index 0000000..a548d73
--- /dev/null
+++ b/details/wire-format.rst
@@ -0,0 +1,77 @@
+WireFormat Class
+================
+
+:[C++]:
+ Namespace: `ndn`
+
+WireFormat Constructor
+----------------------
+
+Create a base class WireFormat where the methods throw an "unimplemented" error. You should use a derived class like BinaryXmlWireFormat.
+
+:Realizations:
+
+ - BinaryXmlWireFormat
+
+:[C++]:
+
+ .. code-block:: c++
+
+ WireFormat();
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ var WireFormat = function WireFormat()
+
+WireFormat.setDefaultWireFormat Method
+--------------------------------------
+
+Set the static default WireFormat used by default encoding and decoding methods.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ static void setDefaultWireFormat(
+
+ WireFormat* wireFormat
+
+ )
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ WireFormat.setDefaultWireFormat = function(
+
+ wireFormat // WireFormat
+
+ )
+
+:Parameters:
+
+ - `wireFormat`
+ An object of a subclass of WireFormat.
+
+WireFormat.getDefaultWireFormat Method
+--------------------------------------
+
+Return the default WireFormat used by default encoding and decoding methods. The initial value is a BinaryXmlWireFormat object. If can be changed with setDefaultWireFormat.
+
+:[C++]:
+
+ .. code-block:: c++
+
+ static WireFormat* getDefaultWireFormat();
+
+:[JavaScript]:
+
+ .. code-block:: javascript
+
+ WireFormat.getDefaultWireFormat = function()
+
+:Returns:
+
+ The default (subclass of) WireFormat object.