model: Initial attempt to optimize Interest/Data encoding/decoding via a custom packet format
diff --git a/model/ndn-interest-header.h b/model/ndn-interest-header.h
index f645255..096dc7b 100644
--- a/model/ndn-interest-header.h
+++ b/model/ndn-interest-header.h
@@ -38,97 +38,51 @@
 class Packet;
 
 namespace ndn {
-  
-/**
- * Ndn XML definition of Interest
- * 
- * Only few important fields are actually implemented in the simulation
- *
- * <xs:element name="Interest" type="InterestType"/>
- * <xs:complexType name="InterestType">
- *   <xs:sequence>
- *     <xs:element name="Name" type="NameType"/>
- *     <xs:element name="MinSuffixComponents" type="xs:nonNegativeInteger"
- *                         minOccurs="0" maxOccurs="1"/>
- *     <xs:element name="MaxSuffixComponents" type="xs:nonNegativeInteger"
- *                         minOccurs="0" maxOccurs="1"/>
- *     <xs:choice minOccurs="0" maxOccurs="1">
- *         <xs:element name="PublisherPublicKeyDigest" type="DigestType"/>
- *         <xs:element name="PublisherCertificateDigest" type="DigestType"/>
- *         <xs:element name="PublisherIssuerKeyDigest" type="DigestType"/>
- *         <xs:element name="PublisherIssuerCertificateDigest" type="DigestType"/>
- *     </xs:choice>
- *     <xs:element name="Exclude" type="ExcludeType"
- *                         minOccurs="0" maxOccurs="1"/>
- *     <xs:element name="ChildSelector" type="xs:nonNegativeInteger"
- *                         minOccurs="0" maxOccurs="1"/>
- *     <xs:element name="AnswerOriginKind" type="xs:nonNegativeInteger"
- *                         minOccurs="0" maxOccurs="1"/>
- *     <xs:element name="Scope" type="xs:nonNegativeInteger"
- * 			minOccurs="0" maxOccurs="1"/>
- *     <xs:element name="InterestLifetime" type="FinegrainLifetimeType"
- * 			minOccurs="0" maxOccurs="1"/>
- *     <xs:element name="Nonce" type="Base64BinaryType"
- * 			minOccurs="0" maxOccurs="1"/>
- *   </xs:sequence>
- * </xs:complexType>
- *
- * <xs:complexType name="NameType">
- *   <xs:sequence>
- *     <xs:element name="Component" type="Base64BinaryType"
- *                 minOccurs="0" maxOccurs="unbounded"/>
- *   </xs:sequence>
- * </xs:complexType>
- * 
- * <xs:complexType name="ExcludeType">
- *   <xs:sequence>
- *     <xs:choice minOccurs="0" maxOccurs="1">
- *         <xs:element name="Any" type="EmptyType"/>
- *         <xs:element name="Bloom" type="Base64BinaryType"/> <!-- Bloom is deprecated --!>
- *     </xs:choice>
- *      <xs:sequence minOccurs="0" maxOccurs="unbounded">
- *         <xs:element name="Component" type="Base64BinaryType"/>
- *         <xs:choice minOccurs="0" maxOccurs="1">
- *             <xs:element name="Any" type="EmptyType"/>
- *             <xs:element name="Bloom" type="Base64BinaryType"/> <!-- Bloom is deprecated --!>
- *         </xs:choice>
- *      </xs:sequence>
- *   </xs:sequence>
- * </xs:complexType>
- * 
- * <!-- Binary representation of time, Unix time epoch, units 2**-12 sec (0.000244140625 sec) -->
- * <!-- The length limit limit of 6 bytes is not actually to be enforced, but
- *      it will be a loooooooong time before anyone cares. --> 
- * 
- * <!-- Binary representation of relative time, relative to "now" -->
- * <xs:complexType name="FinegrainLifetimeType">
- *   <xs:simpleContent>
- *     <xs:extension base="BinaryTime12">
- *       <xs:attribute name="ccnbencoding" type="xs:string" fixed="base64Binary"/>
- *     </xs:extension>
- *   </xs:simpleContent>
- * </xs:complexType>
- *
- * <xs:simpleType name="BinaryTime12">
- *     <xs:restriction base="xs:base64Binary">
- *       <xs:length value="6" fixed="true"/>
- *     </xs:restriction>
- * </xs:simpleType>
- *
- **/
 
 /**
   * @brief NDN InterestHeader and routines to serialize/deserialize
   *
-  * Simplifications:
-  * - Name:  binary name components are not supported
-  * - MinSuffixComponents and MasSuffixComponents: if value is negative (default), will not be serialized
-  * - ChildSelector, AnswerOriginKind: 0 - false, 1 - true, -1 not set
-  * - Publisher* elements are not supported
-  * - Exclude: only simple name matching is supported (Bloom support has been deprecated in Ndn)
-  * - InterestLifetime: ?
-  * - Nonce: 32 bit random integer.  If value is 0, will not be serialized
-  **/
+  * Optimized and simplified formatting of Interest packets 
+  *
+  *	Interest ::= Nonce 
+  *	     	     Scope 
+  *		     InterestLifetime 
+  *	     	     Name 
+  *	     	     Selectors 
+  *	     	     Options
+  *
+  * Minumum size of the Interest packet: 1 + 4 + 2 + 1 + (2 + 0) + (2 + 0) + (2 + 0) = 14
+  *
+  * Maximum size of the Interest packet: 1 + 4 + 2 + 1 + (2 + 65535) + (2 + 65535) + (2 + 65535) = 196619
+  *
+  * ::
+  *
+  *        0                   1                   2                   3
+  *        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+  *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  *        |                          Nonce                                |
+  *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  *        |     Scope     |   Reserved    |      InterestLifetime         |
+  *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  *        |            Length             |                               |
+  *	   |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
+  *        ~                                                               ~
+  *        ~                            Name                               ~
+  *        |							           |	
+  *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  *        |            Length             |                               |
+  *        |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
+  *        ~                                                               ~
+  *        ~                          Selectors                            ~
+  *        |							            |	
+  *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  *        |            Length             |                               |
+  *	   |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
+  *        ~                                                               ~
+  *        ~                          Options                              ~
+  *        |							           |	
+  *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+  * **/
 class InterestHeader : public SimpleRefCount<InterestHeader, Header>
 {
 public:
@@ -153,7 +107,6 @@
   void
   SetName (Ptr<NameComponents> name);
 
-
   /**
    * \brief Get interest name
    *
@@ -169,105 +122,6 @@
   GetNamePtr () const;
 
   /**
-   * \brief Set interest MinSuffixComponents
-   *
-   * MinSuffixComponents refer to the number of name components beyond those in the prefix, 
-   * and counting the implicit digest, that may occur in the matching ContentObject.
-   * \see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html for more information.
-   * @param[in] value minimum length of suffix components
-   **/
-  void
-  SetMinSuffixComponents (int32_t value);
-
-  /**
-   * \brief Get interest MinSuffixComponents
-   *
-   * MinSuffixComponents refer to the number of name components beyond those in the prefix, 
-   * and counting the implicit digest, that may occur in the matching ContentObject.
-   * For more information, see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html
-   **/
-  int32_t
-  GetMinSuffixComponents () const;
-
-
-  /**
-   * \brief Set interest MaxSuffixComponents
-   *
-   * MaxSuffixComponents refer to the number of name components beyond those in the prefix, 
-   * and counting the implicit digest, that may occur in the matching ContentObject.
-   * \see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html for more information.
-   * @param[in] value maximum length of suffix components
-   **/
-  void
-  SetMaxSuffixComponents (int32_t value);
-
-  /**
-   * \brief Get interest MaxSuffixComponents
-   *
-   * MaxSuffixComponents refer to the number of name components beyond those in the prefix, 
-   * and counting the implicit digest, that may occur in the matching ContentObject.
-   * For more information, see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html
-   **/
-  int32_t
-  GetMaxSuffixComponents () const;
-
-  /**
-   * \brief Set exclude filer
-   *
-   * For example, SetExclude (ndnNameComponents("exclude1")("exclude2")("exclude3"))
-   * @param[in] exclude const pointer to ndnNameComponents to be excluded 
-   **/
-  void
-  SetExclude (Ptr<NameComponents> exclude);
-
-  /**
-   * \brief Check if interest conatins exclude filter
-   *
-   */ 
-  bool
-  IsEnabledExclude () const;
-  
-  /**
-   * \brief Get exclude filter 
-   */
-  const NameComponents&
-  GetExclude () const;
-
-  /**
-   * \brief Set ChildSelector
-   * Often a given interest will match more than one ContentObject within a given content store. 
-   * The ChildSelector provides a way of expressing a preference for which of these should be returned. 
-   * If the value is false, the leftmost child is preferred. If true, the rightmost child is preferred.
-   * \see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html for more information. 
-   * @param[in] value boolean ChildSelector value
-   */
-  void
-  SetChildSelector (bool value);
-
-  /**
-   * \brief Return ChildSelector value
-   * \see http://www.ndn.org/releases/latest/doc/technical/InterestMessage.html for more information.
-   *
-   */
-  bool
-  IsEnabledChildSelector () const;
-
-  /**
-   * \brief Set AnswerOriginKind
-   * Default value for AnswerOriginKind is false.
-   * @param[in] value boolean AnswerOriginKind value
-   */
-  void
-  SetAnswerOriginKind (bool value);
-
-  /**
-   * \brief Check the value of AnswerOriginKind
-   *
-   */
-  bool
-  IsEnabledAnswerOriginKind () const;
-
-  /**
    * \brief Set Scope
    * Scope limits where the Interest may propagate. 
    * Scope 0 prevents propagation beyond the local ccnd (even to other applications on the same host).
@@ -348,14 +202,14 @@
    * @param[in] nackType  NACK_LOOP or NACK_CONGESTION or NACK_GIVEUP_PIT or NORMAL_INTEREST
    */
   void
-  SetNack (uint32_t nackType);
+  SetNack (uint8_t nackType); //using reserved field
     
   /**
   * \brief Get NACK type
   * Returns NACK_LOOP, NACK_CONGESTION or NACK_GIVEUP_PIT. 
   * Otherwise, in case of normal interest packet, returns NORMAL_INTEREST (equals 0).
   */
-  uint32_t
+  uint8_t
   GetNack () const;
 
   //////////////////////////////////////////////////////////////////
@@ -396,15 +250,10 @@
   
 private:
   Ptr<NameComponents> m_name;    ///< Interest name
-  int32_t m_minSuffixComponents; ///< Minimum suffix components. not used if negative
-  int32_t m_maxSuffixComponents; ///< Maximum suffix components. not used if negative
-  Ptr<NameComponents> m_exclude; ///< Exclude filter
-  bool m_childSelector;          ///< Default value for ChildSelector is false
-  bool m_answerOriginKind;       ///< Default value for AnswerOriginKind is false
-  int8_t m_scope;                ///< -1 not set, 0 local scope, 1 this host, 2 immediate neighborhood
+  uint8_t m_scope;                ///< 0xFF not set, 0 local scope, 1 this host, 2 immediate neighborhood
   Time  m_interestLifetime;      ///< InterestLifetime
   uint32_t m_nonce;              ///< Nonce. not used if zero
-  uint32_t m_nackType;           ///< Negative Acknowledgement type
+  uint8_t  m_nackType;           ///< Negative Acknowledgement type
 };
 
 /**