diff --git a/src/c/data.h b/src/c/data.h
deleted file mode 100644
index ffaa83c..0000000
--- a/src/c/data.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_DATA_H
-#define NDN_DATA_H
-
-#include <ndn-cpp-dev/c/data-types.h>
-#include "name.h"
-#include "publisher-public-key-digest.h"
-#include "key-locator.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * An ndn_Signature struct holds the signature bits and other info representing the signature in a data packet.
- */
-struct ndn_Signature {
-  struct ndn_Blob digestAlgorithm; /**< A Blob whose value is a pointer to a pre-allocated buffer.  0 for none.
-                                    *   If none, default is 2.16.840.1.101.3.4.2.1 (sha-256). */
-  struct ndn_Blob witness;         /**< A Blob whose value is a pointer to pre-allocated buffer.  0 for none. */
-  struct ndn_Blob signature;
-  struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
-  struct ndn_KeyLocator keyLocator;
-};
-
-/**
- * Initialize the ndn_Signature struct with values for none and the default digestAlgorithm.
- * @param self A pointer to the ndn_MetaInfo struct.
- * @param keyNameComponents The pre-allocated array of ndn_NameComponent for the keyLocator.
- * @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
- */
-static inline void ndn_Signature_initialize(struct ndn_Signature *self, struct ndn_NameComponent *keyNameComponents, size_t maxKeyNameComponents) {
-  ndn_Blob_initialize(&self->digestAlgorithm, 0, 0);
-  ndn_Blob_initialize(&self->witness, 0, 0);
-  ndn_Blob_initialize(&self->signature, 0, 0);
-  ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
-  ndn_KeyLocator_initialize(&self->keyLocator, keyNameComponents, maxKeyNameComponents);
-}
-
-/**
- * An ndn_MetaInfo struct holds the meta info which is signed inside the data packet.
- */
-struct ndn_MetaInfo {
-  ndn_MillisecondsSince1970 timestampMilliseconds; /**< milliseconds since 1/1/1970. -1 for none */
-  ndn_ContentType type;                  /**< default is ndn_ContentType_DATA. -1 for none */
-  int freshnessSeconds;                  /**< -1 for none */
-  struct ndn_NameComponent finalBlockID; /**< has a pointer to a pre-allocated buffer.  0 for none */
-};
-
-/**
- * Initialize the ndn_MetaInfo struct with values for none and the type to the default ndn_ContentType_DATA.
- * @param self A pointer to the ndn_MetaInfo struct.
- */
-static inline void ndn_MetaInfo_initialize
-  (struct ndn_MetaInfo *self) {
-  self->type = ndn_ContentType_DATA;
-  self->freshnessSeconds = -1;
-  ndn_NameComponent_initialize(&self->finalBlockID, 0, 0);
-}
-
-struct ndn_Data {
-  struct ndn_Signature signature;
-  struct ndn_Name name;
-  struct ndn_MetaInfo metaInfo;
-  struct ndn_Blob content;     /**< A Blob with a pointer to the content. */
-};
-
-/**
- * Initialize an ndn_Data struct with the pre-allocated nameComponents and keyNameComponents,
- * and defaults for all the values.
- * @param self A pointer to the ndn_Data struct.
- * @param nameComponents The pre-allocated array of ndn_NameComponent.
- * @param maxNameComponents The number of elements in the allocated nameComponents array.
- * @param keyNameComponents The pre-allocated array of ndn_NameComponent for the signature.keyLocator.
- * @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
- */
-static inline void ndn_Data_initialize
-  (struct ndn_Data *self, struct ndn_NameComponent *nameComponents, size_t maxNameComponents, 
-   struct ndn_NameComponent *keyNameComponents, size_t maxKeyNameComponents) 
-{
-  ndn_Signature_initialize(&self->signature, keyNameComponents, maxKeyNameComponents);
-  ndn_Name_initialize(&self->name, nameComponents, maxNameComponents);
-  ndn_MetaInfo_initialize(&self->metaInfo);
-  ndn_Blob_initialize(&self->content, 0, 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/encoding/binary-xml-data.c b/src/c/encoding/binary-xml-data.c
deleted file mode 100644
index d8013cf..0000000
--- a/src/c/encoding/binary-xml-data.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * Derived from ContentObject.js by Meki Cheraoui.
- * See COPYING for copyright and distribution information.
- */
-
-#include "binary-xml-encoder.h"
-#include "binary-xml-decoder.h"
-#include "binary-xml-name.h"
-#include "binary-xml-publisher-public-key-digest.h"
-#include "binary-xml-data.h"
-#include "binary-xml-key.h"
-
-static ndn_Error encodeSignature(struct ndn_Signature *signature, struct ndn_BinaryXmlEncoder *encoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Signature)))
-    return error;
-  
-  // TODO: Check if digestAlgorithm is the same as the default, and skip it, otherwise encode it as UDATA.
-
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement(encoder, ndn_BinaryXml_DTag_Witness, &signature->witness)))
-    return error;
-
-  // Require a signature.
-  if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement(encoder, ndn_BinaryXml_DTag_SignatureBits, &signature->signature)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
-    return error;
-  
-  return NDN_ERROR_success;    
-}
-
-static ndn_Error decodeSignature(struct ndn_Signature *signature, struct ndn_BinaryXmlDecoder *decoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Signature)))
-    return error;
-  
-  /* TODO: digestAlgorithm as UDATA */ signature->digestAlgorithm.value = 0; signature->digestAlgorithm.length = 0;
-  
-  if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
-      (decoder, ndn_BinaryXml_DTag_Witness, 0, &signature->witness)))
-    return error;
-  
-  // Require a signature.
-  if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
-      (decoder, ndn_BinaryXml_DTag_SignatureBits, 0, &signature->signature)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-static ndn_Error encodeSignedInfo(struct ndn_Signature *signature, struct ndn_MetaInfo *metaInfo, struct ndn_BinaryXmlEncoder *encoder)
-{
-  if ((int)metaInfo->type < 0)
-    return NDN_ERROR_success;
-
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_SignedInfo)))
-    return error;
-
-  // This will skip encoding if there is no publisherPublicKeyDigest.
-  if ((error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&signature->publisherPublicKeyDigest, encoder)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalTimeMillisecondsDTagElement
-      (encoder, ndn_BinaryXml_DTag_Timestamp, metaInfo->timestampMilliseconds)))
-    return error;
-  
-  if (!((int)metaInfo->type < 0 || metaInfo->type == ndn_ContentType_DATA)) {
-    // Not the default of DATA, so we need to encode the type.
-    struct ndn_Blob typeBytes;
-    typeBytes.length = 3;
-    if (metaInfo->type == ndn_ContentType_ENCR)
-      typeBytes.value = (uint8_t *)"\x10\xD0\x91";
-    else if (metaInfo->type == ndn_ContentType_GONE)
-      typeBytes.value = (uint8_t *)"\x18\xE3\x44";
-    else if (metaInfo->type == ndn_ContentType_KEY)
-      typeBytes.value = (uint8_t *)"\x28\x46\x3F";
-    else if (metaInfo->type == ndn_ContentType_LINK)
-      typeBytes.value = (uint8_t *)"\x2C\x83\x4A";
-    else if (metaInfo->type == ndn_ContentType_NACK)
-      typeBytes.value = (uint8_t *)"\x34\x00\x8A";
-    else
-      return NDN_ERROR_unrecognized_ndn_ContentType;
-
-    if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement(encoder, ndn_BinaryXml_DTag_Type, &typeBytes)))
-      return error;
-  }
-  
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
-      (encoder, ndn_BinaryXml_DTag_FreshnessSeconds, metaInfo->freshnessSeconds)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement
-      (encoder, ndn_BinaryXml_DTag_FinalBlockID, &metaInfo->finalBlockID.value)))
-    return error;
- 
-  // This will skip encoding if there is no key locator.
-  if ((error = ndn_encodeBinaryXmlKeyLocator(&signature->keyLocator, encoder)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
-    return error;
-  
-  return NDN_ERROR_success;  
-}
-
-static ndn_Error decodeSignedInfo(struct ndn_Signature *signature, struct ndn_MetaInfo *metaInfo, struct ndn_BinaryXmlDecoder *decoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_SignedInfo)))
-    return error;
-  
-  if ((error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&signature->publisherPublicKeyDigest, decoder)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement
-       (decoder, ndn_BinaryXml_DTag_Timestamp, &metaInfo->timestampMilliseconds)))
-    return error;
-  
-  struct ndn_Blob typeBytes;
-  if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
-      (decoder, ndn_BinaryXml_DTag_Type, 0, &typeBytes)))
-    return error;
-  if (typeBytes.length == 0)
-    // The default Type is DATA.
-    metaInfo->type = ndn_ContentType_DATA;
-  else if (typeBytes.length == 3) {
-    // All the recognized content types are 3 bytes.
-    if (ndn_memcmp(typeBytes.value, (uint8_t *)"\x0C\x04\xC0", typeBytes.length) == 0)
-      metaInfo->type = ndn_ContentType_DATA;
-    else if (ndn_memcmp(typeBytes.value, (uint8_t *)"\x10\xD0\x91", typeBytes.length) == 0)
-      metaInfo->type = ndn_ContentType_ENCR;
-    else if (ndn_memcmp(typeBytes.value, (uint8_t *)"\x18\xE3\x44", typeBytes.length) == 0)
-      metaInfo->type = ndn_ContentType_GONE;
-    else if (ndn_memcmp(typeBytes.value, (uint8_t *)"\x28\x46\x3F", typeBytes.length) == 0)
-      metaInfo->type = ndn_ContentType_KEY;
-    else if (ndn_memcmp(typeBytes.value, (uint8_t *)"\x2C\x83\x4A", typeBytes.length) == 0)
-      metaInfo->type = ndn_ContentType_LINK;
-    else if (ndn_memcmp(typeBytes.value, (uint8_t *)"\x34\x00\x8A", typeBytes.length) == 0)
-      metaInfo->type = ndn_ContentType_NACK;
-    else
-      return NDN_ERROR_unrecognized_ndn_ContentType;
-  }
-  else
-    return NDN_ERROR_unrecognized_ndn_ContentType;
- 
-  if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_FreshnessSeconds, &metaInfo->freshnessSeconds)))
-    return error;
-
-  if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
-      (decoder, ndn_BinaryXml_DTag_FinalBlockID, 0, &metaInfo->finalBlockID.value)))
-    return error;
-
-  if ((error = ndn_decodeOptionalBinaryXmlKeyLocator(&signature->keyLocator, decoder)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_encodeBinaryXmlData
-  (struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_BinaryXmlEncoder *encoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_ContentObject)))
-    return error;
-  
-  if ((error = encodeSignature(&data->signature, encoder)))
-    return error;
-  
-  *signedPortionBeginOffset = encoder->offset;
-
-  if ((error = ndn_encodeBinaryXmlName(&data->name, encoder)))
-    return error;
-  
-  if ((error = encodeSignedInfo(&data->signature, &data->metaInfo, encoder)))
-    return error;
-
-  if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement(encoder, ndn_BinaryXml_DTag_Content, &data->content)))
-    return error;
-
-  *signedPortionEndOffset = encoder->offset;
-
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_decodeBinaryXmlData
-  (struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_BinaryXmlDecoder *decoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_ContentObject)))
-    return error;
-
-  int gotExpectedTag;
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Signature, &gotExpectedTag)))
-    return error;
-  if (gotExpectedTag) {
-    if ((error = decodeSignature(&data->signature, decoder)))
-      return error;
-  }
-  else
-    ndn_Signature_initialize(&data->signature, data->signature.keyLocator.keyName.components, data->signature.keyLocator.keyName.maxComponents);
-  
-  *signedPortionBeginOffset = decoder->offset;
-  
-  if ((error = ndn_decodeBinaryXmlName(&data->name, decoder)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_SignedInfo, &gotExpectedTag)))
-    return error;
-  if (gotExpectedTag) {
-    if ((error = decodeSignedInfo(&data->signature, &data->metaInfo, decoder)))
-      return error;
-  }
-  else
-    ndn_MetaInfo_initialize(&data->metaInfo);
-
-  // Require a Content element, but set allowNull to allow a missing BLOB.
-  if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Content, 1, &data->content)))
-    return error; 
-  
-  *signedPortionEndOffset = decoder->offset;
-
-  if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
diff --git a/src/c/encoding/binary-xml-data.h b/src/c/encoding/binary-xml-data.h
deleted file mode 100644
index f5865ba..0000000
--- a/src/c/encoding/binary-xml-data.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARY_XML_DATA_H
-#define NDN_BINARY_XML_DATA_H
-
-#include "../errors.h"
-#include "../data.h"
-#include "binary-xml-encoder.h"
-#include "binary-xml-decoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Encode the data packet as binary XML.
- * @param data Pointer to the data object to encode.
- * @param signedPortionBeginOffset 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.
- * @param signedPortionEndOffset 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.
- * @param encoder Pointer to the ndn_BinaryXmlEncoder struct which receives the encoding. 
- * @return 0 for success, else an error code.
- */
-ndn_Error ndn_encodeBinaryXmlData
-  (struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_BinaryXmlEncoder *encoder);
-
-/**
- * Decode the data packet as binary XML and set the fields in the data object.
- * @param data Pointer to the data object whose fields are updated.
- * @param signedPortionBeginOffset Return the offset in the input buffer of the beginning of the signed portion.
- * If you are not decoding in order to verify, you can ignore this returned value.
- * @param signedPortionEndOffset Return the offset in the input buffer of the end of the signed portion.
- * If you are not decoding in order to verify, you can ignore this returned value.
- * @param decoder Pointer to the ndn_BinaryXmlDecoder struct which has been initialized with the buffer to decode. 
- * @return 0 for success, else an error code.
- */
-ndn_Error ndn_decodeBinaryXmlData
-  (struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_BinaryXmlDecoder *decoder);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/encoding/binary-xml-decoder.c b/src/c/encoding/binary-xml-decoder.c
deleted file mode 100644
index 110ce51..0000000
--- a/src/c/encoding/binary-xml-decoder.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * Derived from BinaryXMLDecoder.js by Meki Cheraoui.
- * See COPYING for copyright and distribution information.
- */
-
-#include "binary-xml.h"
-#include "binary-xml-decoder.h"
-
-/**
- * Return the octet at self->offset, converting to unsigned int.  Increment self->offset.
- * This does not check for reading past the end of the input, so this is called "unsafe".
- */
-static inline unsigned int unsafeReadOctet(struct ndn_BinaryXmlDecoder *self) 
-{
-  return (unsigned int)(self->input[self->offset++] & 0xff);  
-}
-
-/**
- * Return the octet at self->offset, converting to unsigned int.  Do not increment self->offset.
- * This does not check for reading past the end of the input, so this is called "unsafe".
- */
-static inline unsigned int unsafeGetOctet(struct ndn_BinaryXmlDecoder *self) 
-{
-  return (unsigned int)(self->input[self->offset] & 0xff);  
-}
-
-/**
- * Parse the value as a decimal unsigned integer.  This does not check for whitespace or + sign.
- * If valueLength is 0, this succeeds with resultOut 0.
- * @param value
- * @param valueLength
- * @param resultOut output the parsed integer.
- * @return 0 for success, else an error code, including if an element of value is not a decimal digit.
- */
-static ndn_Error parseUnsignedDecimalInt(uint8_t *value, size_t valueLength, unsigned int *resultOut)
-{
-  unsigned int result = 0;
-  
-  size_t i;
-  for (i = 0; i < valueLength; ++i) {
-    uint8_t digit = value[i];
-    if (!(digit >= '0' && digit <= '9'))
-      return NDN_ERROR_element_of_value_is_not_a_decimal_digit;
-
-    result *= 10;
-    result += (unsigned int)(digit - '0');
-  }
-    
-  *resultOut = result;
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_decodeTypeAndValue(struct ndn_BinaryXmlDecoder *self, unsigned int *type, unsigned int *valueOut) 
-{
-  unsigned int value = 0;
-  int gotFirstOctet = 0;
-  
-  while (1) {
-    if (self->offset >= self->inputLength)
-      return NDN_ERROR_read_past_the_end_of_the_input;
-    
-    unsigned int octet = unsafeReadOctet(self);
-    
-    if (!gotFirstOctet) {
-      if (octet == 0)
-        return NDN_ERROR_the_first_header_octet_may_not_be_zero;
-      
-      gotFirstOctet = 1;
-    }
-    
-    if (octet & ndn_BinaryXml_TT_FINAL) {
-      // Finished.
-      *type = octet & ndn_BinaryXml_TT_MASK;
-      value = (value << ndn_BinaryXml_TT_VALUE_BITS) | ((octet >> ndn_BinaryXml_TT_BITS) & ndn_BinaryXml_TT_VALUE_MASK);
-      break;
-    }
-    
-    value = (value << ndn_BinaryXml_REGULAR_VALUE_BITS) | (octet & ndn_BinaryXml_REGULAR_VALUE_MASK);    
-  }
-
-  *valueOut = value;
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_readElementStartDTag(struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag)
-{
-  if (self->offset == self->previouslyPeekedDTagStartOffset) {
-    // peekDTag already decoded this DTag.
-    if (self->previouslyPeekedDTag != expectedTag)
-      return NDN_ERROR_did_not_get_the_expected_DTAG;
-
-    // Fast forward past the header.
-    self->offset = self->previouslyPeekedDTagEndOffset;
-  }
-  else {
-    ndn_Error error;
-    unsigned int type;
-    unsigned int value;
-    if ((error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &type, &value)))
-      return error;
-
-    if (type != ndn_BinaryXml_DTAG)
-      return NDN_ERROR_header_type_is_not_a_DTAG;
-
-    if (value != expectedTag)
-      return NDN_ERROR_did_not_get_the_expected_DTAG;
-  }
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_readElementClose(struct ndn_BinaryXmlDecoder *self)
-{
-  if (self->offset >= self->inputLength)
-    return NDN_ERROR_read_past_the_end_of_the_input;
-  
-  if (unsafeReadOctet(self) != ndn_BinaryXml_CLOSE)
-    return NDN_ERROR_did_not_get_the_expected_element_close;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_peekDTag(struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int *gotExpectedTag)
-{
-  if (self->offset == self->previouslyPeekedDTagStartOffset)
-    // We already decoded this DTag.
-    *gotExpectedTag = (self->previouslyPeekedDTag == expectedTag ? 1 : 0);
-  else {
-    // Default to 0.
-    *gotExpectedTag = 0;
-
-    // First check if it is an element close (which cannot be the expected tag).  
-    if (self->offset >= self->inputLength)
-      return NDN_ERROR_read_past_the_end_of_the_input;
-    if (unsafeGetOctet(self) == ndn_BinaryXml_CLOSE)
-      return NDN_ERROR_success;
-
-    unsigned int type;
-    unsigned int value;
-    size_t saveOffset = self->offset;
-    ndn_Error error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &type, &value);
-    // readElementStartDTag will use this to fast forward.
-    self->previouslyPeekedDTagEndOffset = self->offset;
-    // Restore offset.
-    self->offset = saveOffset;
-
-    if (error)
-      return error;
-
-    if (type == ndn_BinaryXml_DTAG) {
-      self->previouslyPeekedDTagStartOffset = saveOffset;
-      self->previouslyPeekedDTag = value;
-
-      if (value == expectedTag)
-        *gotExpectedTag = 1;
-    }
-  }
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_readBinaryDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, struct ndn_Blob *value)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(self, expectedTag)))
-    return error;
-  
-  if (allowNull) {
-    if (self->offset >= self->inputLength)
-      return NDN_ERROR_read_past_the_end_of_the_input;
-  
-    if (unsafeGetOctet(self) == ndn_BinaryXml_CLOSE) {
-      // The binary item is missing, and this is allowed, so read the element close and return a null value.
-      ++self->offset;
-      value->value = 0;
-      value->length = 0;
-      return NDN_ERROR_success;
-    }
-  }
-  
-  unsigned int itemType;
-  unsigned int uintValueLength;
-  if ((error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &itemType, &uintValueLength)))
-    return error;
-  // Ignore itemType.
-  value->value = self->input + self->offset;
-  value->length = (size_t)uintValueLength;
-  self->offset += value->length;
-  
-  if ((error = ndn_BinaryXmlDecoder_readElementClose(self)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, struct ndn_Blob *value)
-{
-  ndn_Error error;
-  int gotExpectedTag;
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(self, expectedTag, &gotExpectedTag)))
-    return error;
-  if (gotExpectedTag) {
-    if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(self, expectedTag, allowNull, value)))
-      return error;
-  }
-  else {
-    value->value = 0;
-    value->length = 0;
-  }  
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_readUDataDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, struct ndn_Blob *value)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(self, expectedTag)))
-    return error;
-    
-  unsigned int itemType;
-  unsigned int uintValueLength;
-  if ((error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &itemType, &uintValueLength)))
-    return error;
-  if (itemType != ndn_BinaryXml_UDATA)
-    return NDN_ERROR_item_is_not_UDATA;
-  value->value = self->input + self->offset;
-  value->length = uintValueLength;
-  self->offset += value->length;
-  
-  if ((error = ndn_BinaryXmlDecoder_readElementClose(self)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_readOptionalUDataDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, struct ndn_Blob *value)
-{
-  ndn_Error error;
-  int gotExpectedTag;
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(self, expectedTag, &gotExpectedTag)))
-    return error;
-  if (gotExpectedTag) {
-    if ((error = ndn_BinaryXmlDecoder_readUDataDTagElement(self, expectedTag, value)))
-      return error;
-  }
-  else {
-    value->value = 0;
-    value->length = 0;
-  }  
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned int *value)
-{
-  struct ndn_Blob udataValue;
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readUDataDTagElement(self, expectedTag, &udataValue)))
-    return error;
-  
-  if ((error = parseUnsignedDecimalInt(udataValue.value, udataValue.length, value)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int *value)
-{
-  int gotExpectedTag;
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(self, expectedTag, &gotExpectedTag)))
-    return error;
-    
-  if (!gotExpectedTag) {
-    *value = -1;
-    return NDN_ERROR_success;
-  }
-
-  unsigned int unsignedValue;
-  if ((error = ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement(self, expectedTag, &unsignedValue)))
-    return error;
-  
-  *value = (int)unsignedValue;
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlDecoder_readTimeMillisecondsDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, ndn_MillisecondsSince1970 *milliseconds)
-{
-  ndn_Error error;
-  struct ndn_Blob bytes;
-  if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(self, expectedTag, 0, &bytes)))
-    return error;
-    
-  *milliseconds = 1000.0 * ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(bytes.value, bytes.length) / 4096.0;
-  return NDN_ERROR_success;  
-}
-
-ndn_Error ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, ndn_MillisecondsSince1970 *milliseconds)
-{
-  int gotExpectedTag;
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(self, expectedTag, &gotExpectedTag)))
-    return error;
-    
-  if (!gotExpectedTag) {
-    *milliseconds = -1.0;
-    return NDN_ERROR_success;
-  }
-
-  if ((error = ndn_BinaryXmlDecoder_readTimeMillisecondsDTagElement(self, expectedTag, milliseconds)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(uint8_t *bytes, size_t bytesLength) 
-{
-  double result = 0.0;
-  size_t i;
-  for (i = 0; i < bytesLength; ++i) {
-    result *= 256.0;
-    result += (double)bytes[i];
-  }
-  
-  return result;
-}
diff --git a/src/c/encoding/binary-xml-decoder.h b/src/c/encoding/binary-xml-decoder.h
deleted file mode 100644
index 8fe1469..0000000
--- a/src/c/encoding/binary-xml-decoder.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLDECODER_H
-#define NDN_BINARYXMLDECODER_H
-
-#include <ndn-cpp-dev/c/common.h>
-#include "../errors.h"
-#include "../util/blob.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ndn_BinaryXmlDecoder {
-  uint8_t *input;
-  size_t inputLength;
-  size_t offset;
-  // peekDTag sets and checks these, and readElementStartDTag uses them to avoid reading again.
-  size_t previouslyPeekedDTagStartOffset;
-  size_t previouslyPeekedDTagEndOffset;
-  unsigned int previouslyPeekedDTag;
-};
-
-static inline void ndn_BinaryXmlDecoder_initialize(struct ndn_BinaryXmlDecoder *self, uint8_t *input, size_t inputLength) 
-{
-  self->input = input;
-  self->inputLength = inputLength;
-  self->offset = 0;
-  self->previouslyPeekedDTagStartOffset = (size_t)-1;
-}
-
-/**
- * Decode the header's type and value from self's input starting at offset. Update offset.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param type output for the header type
- * @param value output for the header value
- * @return 0 for success, else an error code for read past the end of the input or if the initial byte is zero
- */
-ndn_Error ndn_BinaryXmlDecoder_decodeTypeAndValue(struct ndn_BinaryXmlDecoder *self, unsigned int *type, unsigned int *value);
-
-/**
- * Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
- * Update offset.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param expectedTag the expected value for DTAG
- * @return 0 for success, else an error code, including an error if not the expected tag
- */
-ndn_Error ndn_BinaryXmlDecoder_readElementStartDTag(struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag);
-
-/**
- * Read one byte from self's input starting at offset, expecting it to be the element close.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @return 0 for success, else an error code, including an error if not the element close
- */
-ndn_Error ndn_BinaryXmlDecoder_readElementClose(struct ndn_BinaryXmlDecoder *self);
-
-/**
- * Decode the header from self's input starting at offset, and if it is a DTAG where the value is the expectedTag,
- * then set gotExpectedTag to 1, else 0.  Do not update offset, including if returning an error.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param expectedTag the expected value for DTAG
- * @param gotExpectedTag output a 1 if got the expected tag, else 0
- * @return 0 for success, else an error code for read past the end of the input
- */
-ndn_Error ndn_BinaryXmlDecoder_peekDTag(struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int *gotExpectedTag);
-
-/**
- * Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
- * Then read one item of any type (presumably BLOB, UDATA, TAG or ATTR) and return the item's value and length.
- * However, if allowNull is 1, then the item may be absent.
- * Finally, read the element close.  Update offset.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param expectedTag the expected value for DTAG
- * @param allowNull 1 if the binary item may be missing
- * @param value output a pointer to the binary data inside self's input buffer. However, if allowNull is 1 and the
- * binary data item is absent, then set value and length to 0.
- * @return 0 for success, else an error code, including an error if not the expected tag, or if allowNull is 0
- * and the binary data is absent
- */
-ndn_Error ndn_BinaryXmlDecoder_readBinaryDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, struct ndn_Blob *value);
-
-/**
- * Peek at the next element and if it is the expectedTag, call ndn_BinaryXmlDecoder_readBinaryDTagElement.
- * Otherwise, set value and valueLength to 0.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param expectedTag the expected value for DTAG
- * @param allowNull 1 if the binary item may be missing
- * @param value output a pointer to the binary data inside self's input buffer. However, if allowNull is 1 and the
- * binary data item is absent, then set value and length to 0.
- * @return 0 for success, else an error code, including if allowNull is 0 and the binary data is absent
- */
-ndn_Error ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, struct ndn_Blob *value);
-
-/**
- * Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
- * Then read one item expecting it to be type UDATA, and return the item's value and length.
- * Finally, read the element close.  Update offset.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param expectedTag the expected value for DTAG
- * @param value output a pointer to the binary data inside self's input buffer.
- * @return 0 for success, else an error code, including an error if not the expected tag, or if the item is not UDATA.
- */
-ndn_Error ndn_BinaryXmlDecoder_readUDataDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, struct ndn_Blob *value);
-
-/**
- * Peek at the next element and if it is the expectedTag, call ndn_BinaryXmlDecoder_readUDataDTagElement.
- * Otherwise, set value and valueLength to 0.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param expectedTag the expected value for DTAG
- * @param value output a pointer to the binary data inside self's input buffer. However, if allowNull is 1 and the
- * binary data item is absent, then set value and length to 0.
- * @return 0 for success, else an error code.
- */
-ndn_Error ndn_BinaryXmlDecoder_readOptionalUDataDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, struct ndn_Blob *value);
-
-/**
- * Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
- * Then read one item expecting it to be type UDATA, parse it as an unsigned decimal integer and return the integer.
- * Finally, read the element close.  Update offset.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param expectedTag the expected value for DTAG
- * @param value output the unsigned integer
- * @return 0 for success, else an error code, including an error if not the expected tag, or if the item is not UDATA,
- * or can't parse the integer
- */
-ndn_Error ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned int *value);
-
-/**
- * Peek at the next element, and if it has the expectedTag then call ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement.
- * Otherwise, set value to -1.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param expectedTag the expected value for DTAG
- * @param value output the unsigned integer cast to int, or -1 if the next element doesn't have expectedTag.
- * @return 0 for success, else an error code, including an error if the item is not UDATA,
- * or can't parse the integer
- */
-ndn_Error ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int *value);
-
-/**
- * Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
- * Then read one item, parse it as an unsigned big endian integer in 4096 ticks per second, and convert it to milliseconds.
- * Finally, read the element close.  Update offset.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param expectedTag the expected value for DTAG
- * @param milliseconds output the number of milliseconds
- * @return 0 for success, else an error code, including an error if not the expected tag
- */
-ndn_Error ndn_BinaryXmlDecoder_readTimeMillisecondsDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, ndn_MillisecondsSince1970 *milliseconds);
-
-/**
- * Peek at the next element, and if it has the expectedTag then call ndn_BinaryXmlDecoder_readTimeMillisecondsDTagElement.
- * Otherwise, set value to -1.0 .
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param expectedTag the expected value for DTAG
- * @param milliseconds output the number of milliseconds, or -1.0 if the next element doesn't have expectedTag.
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement
-  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, ndn_MillisecondsSince1970 *milliseconds);
-
-/**
- * Interpret the bytes as an unsigned big endian integer and convert to a double. Don't check for overflow.
- * We use a double because it is large enough to represent NDN time (4096 ticks per second since 1970).
- * @param bytes pointer to the array of bytes
- * @param bytesLength the length of bytes
- * @return the result
- */
-double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(uint8_t *bytes, size_t bytesLength); 
-
-/**
- * Set the offset into the input, used for the next read.
- * @param self pointer to the ndn_BinaryXmlDecoder struct
- * @param offset the new offset
- */
-static inline void ndn_BinaryXmlDecoder_seek(struct ndn_BinaryXmlDecoder *self, size_t offset) 
-{
-  self->offset = offset;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/encoding/binary-xml-element-reader.c b/src/c/encoding/binary-xml-element-reader.c
deleted file mode 100644
index 350a978..0000000
--- a/src/c/encoding/binary-xml-element-reader.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "binary-xml-element-reader.h"
-
-ndn_Error ndn_BinaryXmlElementReader_onReceivedData
-  (struct ndn_BinaryXmlElementReader *self, uint8_t *data, size_t dataLength)
-{
-  // Process multiple objects in the data.
-  while(1) {
-    // Scan the input to check if a whole binary XML object has been read.
-    ndn_BinaryXmlStructureDecoder_seek(&self->structureDecoder, 0);
-    
-    ndn_Error error;
-    if ((error = ndn_BinaryXmlStructureDecoder_findElementEnd(&self->structureDecoder, data, dataLength)))
-      return error;
-    if (self->structureDecoder.gotElementEnd) {
-      // Got the remainder of an element.  Report to the caller.
-      if (self->usePartialData) {
-        // We have partial data from a previous call, so append this data and point to partialData.
-        if ((error = ndn_DynamicUInt8Array_set(&self->partialData, data, self->structureDecoder.offset, self->partialDataLength)))
-          return error;
-        self->partialDataLength += dataLength;
-                
-        (*self->elementListener->onReceivedElement)(self->elementListener, self->partialData.array, self->partialDataLength);
-        // Assume we don't need to use partialData anymore until needed.
-        self->usePartialData = 0;
-      }
-      else
-        // We are not using partialData, so just point to the input data buffer.
-        (*self->elementListener->onReceivedElement)(self->elementListener, data, self->structureDecoder.offset);
-        
-      // Need to read a new object.
-      data += self->structureDecoder.offset;
-      dataLength -= self->structureDecoder.offset;
-      ndn_BinaryXmlStructureDecoder_initialize(&self->structureDecoder);
-      if (dataLength == 0)
-        // No more data in the packet.
-        return NDN_ERROR_success;
-            
-      // else loop back to decode.
-    }
-    else {
-      // Save remaining data for a later call.
-      if (!self->usePartialData) {
-        self->usePartialData = 1;
-        self->partialDataLength = 0;
-      }
-      
-      if ((error = ndn_DynamicUInt8Array_set(&self->partialData, data, dataLength, self->partialDataLength)))
-        return error;
-      self->partialDataLength += dataLength;
-      
-      return NDN_ERROR_success;
-    }
-  }      
-}
diff --git a/src/c/encoding/binary-xml-element-reader.h b/src/c/encoding/binary-xml-element-reader.h
deleted file mode 100644
index 194f397..0000000
--- a/src/c/encoding/binary-xml-element-reader.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARY_XML_ELEMENT_READER_H
-#define NDN_BINARY_XML_ELEMENT_READER_H
-
-#include <ndn-cpp-dev/c/encoding/element-listener.h>
-#include "../errors.h"
-#include "binary-xml-structure-decoder.h"
-#include "../util/dynamic-uint8-array.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-  
-/**
- * A BinaryXmlElementReader lets you call ndn_BinaryXmlElementReader_onReceivedData multiple times which uses an
- * ndn_BinaryXmlStructureDecoder to detect the end of a binary XML element and calls
- * (*elementListener->onReceivedElement)(element, elementLength) with the element. 
- * This handles the case where a single call to onReceivedData may contain multiple elements.
- */
-struct ndn_BinaryXmlElementReader {
-  struct ndn_ElementListener *elementListener;
-  struct ndn_BinaryXmlStructureDecoder structureDecoder;
-  int usePartialData;
-  struct ndn_DynamicUInt8Array partialData;
-  size_t partialDataLength;
-};
-
-/**
- * Initialize an ndn_BinaryXmlElementReader struct with the elementListener and a buffer for saving partial data.
- * @param self pointer to the ndn_BinaryXmlElementReader struct
- * @param elementListener pointer to the ndn_ElementListener used by ndn_BinaryXmlElementReader_onReceivedData.
- * @param buffer the allocated buffer.  If reallocFunction is null, this should be large enough to save a full element, perhaps 8000 bytes.
- * @param bufferLength the length of the buffer
- * @param reallocFunction see ndn_DynamicUInt8Array_ensureLength.  This may be 0.
- */
-static inline void ndn_BinaryXmlElementReader_initialize
-  (struct ndn_BinaryXmlElementReader *self, struct ndn_ElementListener *elementListener,
-   uint8_t *buffer, size_t bufferLength, uint8_t * (*reallocFunction)(struct ndn_DynamicUInt8Array *self, uint8_t *, size_t))
-{
-  self->elementListener = elementListener;
-  ndn_BinaryXmlStructureDecoder_initialize(&self->structureDecoder);
-  self->usePartialData = 0;
-  ndn_DynamicUInt8Array_initialize(&self->partialData, buffer, bufferLength, reallocFunction);
-}
-
-/**
- * Continue to read binary XML data until the end of an element, then call (*elementListener->onReceivedElement)(element, elementLength).
- * The buffer passed to onReceivedElement is only valid during this call.  If you need the data later, you must copy.
- * @param self pointer to the ndn_BinaryXmlElementReader struct
- * @param data pointer to the buffer with the binary XML bytes
- * @param dataLength length of data
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlElementReader_onReceivedData
-  (struct ndn_BinaryXmlElementReader *self, uint8_t *data, size_t dataLength);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/encoding/binary-xml-encoder.c b/src/c/encoding/binary-xml-encoder.c
deleted file mode 100644
index e27cbbc..0000000
--- a/src/c/encoding/binary-xml-encoder.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * Derived from BinaryXMLEncoder.js by Meki Cheraoui.
- * See COPYING for copyright and distribution information.
- */
-
-#include <math.h>
-#include "../util/ndn_memory.h"
-#include "binary-xml.h"
-#include "binary-xml-encoder.h"
-
-enum {
-  ENCODING_LIMIT_1_BYTE = ((1 << ndn_BinaryXml_TT_VALUE_BITS) - 1),
-  ENCODING_LIMIT_2_BYTES = ((1 << (ndn_BinaryXml_TT_VALUE_BITS + ndn_BinaryXml_REGULAR_VALUE_BITS)) - 1),
-  ENCODING_LIMIT_3_BYTES = ((1 << (ndn_BinaryXml_TT_VALUE_BITS + 2 * ndn_BinaryXml_REGULAR_VALUE_BITS)) - 1)
-};
-
-/**
- * Call ndn_DynamicUInt8Array_ensureLength to ensure that there is enough room in the output, and copy
- * array to the output.  This does not write a header.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param array the array to copy
- * @param arrayLength the length of the array
- * @return 0 for success, else an error code
- */
-static ndn_Error writeArray(struct ndn_BinaryXmlEncoder *self, uint8_t *array, size_t arrayLength)
-{
-  ndn_Error error;
-  if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + arrayLength)))
-    return error;
-  
-  ndn_memcpy(self->output->array + self->offset, array, arrayLength);
-  self->offset += arrayLength;
-  
-  return NDN_ERROR_success;
-}
-
-/**
- * Return the number of bytes to encode a header of value x.
- */
-static size_t getNHeaderEncodingBytes(unsigned int x) 
-{
-  // Do a quick check for pre-compiled results.
-  if (x <= ENCODING_LIMIT_1_BYTE) 
-    return 1;
-  if (x <= ENCODING_LIMIT_2_BYTES) 
-    return 2;
-  if (x <= ENCODING_LIMIT_3_BYTES) 
-    return 3;
-  
-  size_t nBytes = 1;
-  
-  // Last byte gives you TT_VALUE_BITS.
-  // Remainder each gives you REGULAR_VALUE_BITS.
-  x >>= ndn_BinaryXml_TT_VALUE_BITS;
-  while (x != 0) {
-    ++nBytes;
-    x >>= ndn_BinaryXml_REGULAR_VALUE_BITS;
-  }
-  
-  return nBytes;
-}
-
-/**
- * Reverse the length bytes in array.
- * @param array
- * @param length
- */
-static void reverse(uint8_t *array, size_t length) 
-{
-  if (length == 0)
-    return;
-  
-  uint8_t *left = array;
-  uint8_t *right = array + length - 1;
-  while (left < right) {
-    // Swap.
-    uint8_t temp = *left;
-    *left = *right;
-    *right = temp;
-    
-    ++left;
-    --right;
-  }
-}
-
-/**
- * Write x as an unsigned decimal integer to the output with the digits in reverse order, using ndn_DynamicUInt8Array_ensureLength.
- * This does not write a header.
- * We encode in reverse order, because this is the natural way to encode the digits, and the caller can reverse as needed.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param x the unsigned int to write
- * @return 0 for success, else an error code
- */
-static ndn_Error encodeReversedUnsignedDecimalInt(struct ndn_BinaryXmlEncoder *self, unsigned int x) 
-{
-  while (1) {
-    ndn_Error error;
-    if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + 1)))
-      return error;
-    
-    self->output->array[self->offset++] = (uint8_t)(x % 10 + '0');
-    x /= 10;
-    
-    if (x == 0)
-      break;
-  }
-  
-  return NDN_ERROR_success;
-}
-
-/**
- * Reverse the buffer in self->output->array from startOffset to the current offset, then shift it right by the amount 
- * needed to prefix a header with type, then encode the header at startOffset.
- * We reverse and shift in the same function to avoid unnecessary copying if we first reverse then shift.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param startOffset the offset in self->output->array of the start of the buffer to shift right
- * @param type the header type
- * @return 0 for success, else an error code
- */
-static ndn_Error reverseBufferAndInsertHeader
-  (struct ndn_BinaryXmlEncoder *self, size_t startOffset, unsigned int type)
-{
-  size_t nBufferBytes = self->offset - startOffset;
-  size_t nHeaderBytes = getNHeaderEncodingBytes(nBufferBytes);
-  ndn_Error error;
-  if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + nHeaderBytes)))
-    return error;
-  
-  // To reverse and shift at the same time, we first shift nHeaderBytes to the destination while reversing,
-  //   then reverse the remaining bytes in place.
-  uint8_t *from = self->output->array + startOffset;
-  uint8_t *fromEnd = from + nHeaderBytes;
-  uint8_t *to = self->output->array + startOffset + nBufferBytes + nHeaderBytes - 1;
-  while (from < fromEnd)
-    *(to--) = *(from++);
-  // Reverse the remaining bytes in place (if any).
-  if (nBufferBytes > nHeaderBytes)
-    reverse(self->output->array + startOffset + nHeaderBytes, nBufferBytes - nHeaderBytes);
-  
-  // Override the offset to force encodeTypeAndValue to encode at startOffset, then fix the offset.
-  self->offset = startOffset;
-  if ((error = ndn_BinaryXmlEncoder_encodeTypeAndValue(self, type, nBufferBytes)))
-    // We don't really expect to get an error, since we have already ensured the length.
-    return error;
-  self->offset = startOffset + nHeaderBytes + nBufferBytes;
-  
-  return NDN_ERROR_success;
-}
-
-/**
- * Split the absolute value of x, rounded to an integer into 32 bit unsigned integers hi32 and lo32.
- * We need this because not all C compilers support 64 bit long long integers, so we carry around
- * a high precision value as a double, which we assume has more than 32 bits.
- * But we want to do bit-wise operations on integers.
- * @param x the double value
- * @param hi32 output the high 32 bits
- * @param lo32 output the low 32 bits
- */
-static inline void splitAbsDouble(double x, unsigned long *hi32, unsigned long *lo32)
-{
-  if (x < 0)
-    x = -x;
-  x = round(x);
-  
-  double twoPower32 = 4294967296.0;
-  double lo32Double = fmod(x, twoPower32);
-  *lo32 = (unsigned long)lo32Double;
-  *hi32 = (unsigned long)((x - lo32Double) / twoPower32);
-}
-
-ndn_Error ndn_BinaryXmlEncoder_encodeTypeAndValue(struct ndn_BinaryXmlEncoder *self, unsigned int type, unsigned int value)
-{
-  if (type > ndn_BinaryXml_UDATA)
-    return NDN_ERROR_header_type_is_out_of_range;
-  
-  // Encode backwards. Calculate how many bytes we need.
-  size_t nEncodingBytes = getNHeaderEncodingBytes(value);
-  ndn_Error error;
-  if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + nEncodingBytes)))
-    return error;
-
-  // Bottom 4 bits of value go in last byte with tag.
-  self->output->array[self->offset + nEncodingBytes - 1] = 
-    ((ndn_BinaryXml_TT_MASK & type) | 
-    ((ndn_BinaryXml_TT_VALUE_MASK & value) << ndn_BinaryXml_TT_BITS)) |
-    ndn_BinaryXml_TT_FINAL; // set top bit for last byte
-  value >>= ndn_BinaryXml_TT_VALUE_BITS;
-  
-  // Rest of value goes into preceding bytes, 7 bits per byte. (Zero top bit is "more" flag.)
-  size_t i = self->offset + nEncodingBytes - 2;
-  while (value != 0 && i >= self->offset) {
-    self->output->array[i] = (value & ndn_BinaryXml_REGULAR_VALUE_MASK);
-    value >>= ndn_BinaryXml_REGULAR_VALUE_BITS;
-    --i;
-  }
-  if (value != 0)
-    // This should not happen if getNHeaderEncodingBytes is correct.
-    return NDN_ERROR_encodeTypeAndValue_miscalculated_N_encoding_bytes;
-  
-  self->offset+= nEncodingBytes;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlEncoder_writeElementClose(struct ndn_BinaryXmlEncoder *self)
-{
-  ndn_Error error;
-  if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + 1)))
-    return error;
-  
-  self->output->array[self->offset] = ndn_BinaryXml_CLOSE;
-  self->offset += 1;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlEncoder_writeBlob(struct ndn_BinaryXmlEncoder *self, struct ndn_Blob *value)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_encodeTypeAndValue(self, ndn_BinaryXml_BLOB, value->length)))
-    return error;
-  
-  if ((error = writeArray(self, value->value, value->length)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlEncoder_writeBlobDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, struct ndn_Blob *value)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeBlob(self, value)))
-    return error;  
-  
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(self)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlEncoder_writeUData(struct ndn_BinaryXmlEncoder *self, struct ndn_Blob *value)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_encodeTypeAndValue(self, ndn_BinaryXml_UDATA, value->length)))
-    return error;
-  
-  if ((error = writeArray(self, value->value, value->length)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlEncoder_writeUDataDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, struct ndn_Blob *value)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeUData(self, value)))
-    return error;  
-  
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(self)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlEncoder_writeUnsignedDecimalInt(struct ndn_BinaryXmlEncoder *self, unsigned int value)
-{
-  // First write the decimal int (to find out how many bytes it is), then shift it forward to make room for the header.
-  size_t startOffset = self->offset;
-  
-  ndn_Error error;
-  if ((error = encodeReversedUnsignedDecimalInt(self, value)))
-    return error;
-  
-  if ((error = reverseBufferAndInsertHeader(self, startOffset, ndn_BinaryXml_UDATA)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned int value)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeUnsignedDecimalInt(self, value)))
-    return error;  
-  
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(self)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlEncoder_writeAbsDoubleBigEndianBlob(struct ndn_BinaryXmlEncoder *self, double value)
-{
-  unsigned long hi32, lo32;
-  splitAbsDouble(value, &hi32, &lo32);
-  
-  // First encode the big endian backwards, then reverseBufferAndInsertHeader will reverse it.
-  size_t startOffset = self->offset;
-  
-  ndn_Error error;
-  while (lo32 != 0) {
-    if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + 1)))
-      return error;
-    
-    self->output->array[self->offset++] = (uint8_t)(lo32 & 0xff);
-    lo32 >>= 8;
-  }
-  
-  if (hi32 != 0) {
-    // Pad the lo values out to 4 bytes.
-    while (self->offset - startOffset < 4) {
-      if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + 1)))
-        return error;
-    
-      self->output->array[self->offset++] = 0;
-    }
-    
-    // Encode hi32
-    while (hi32 != 0) {
-      if ((error = ndn_DynamicUInt8Array_ensureLength(self->output, self->offset + 1)))
-        return error;
-    
-      self->output->array[self->offset++] = (uint8_t)(hi32 & 0xff);
-      hi32 >>= 8;
-    }
-  }
-  
-  if ((error = reverseBufferAndInsertHeader(self, startOffset, ndn_BinaryXml_BLOB)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_BinaryXmlEncoder_writeTimeMillisecondsDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, double milliseconds)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
-    return error;
-   
-  if ((error = ndn_BinaryXmlEncoder_writeAbsDoubleBigEndianBlob(self, (milliseconds / 1000.0) * 4096.0)))
-    return error;
-    
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(self)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
diff --git a/src/c/encoding/binary-xml-encoder.h b/src/c/encoding/binary-xml-encoder.h
deleted file mode 100644
index 81fa6b9..0000000
--- a/src/c/encoding/binary-xml-encoder.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLENCODER_H
-#define NDN_BINARYXMLENCODER_H
-
-#include "../errors.h"
-#include "../util/dynamic-uint8-array.h"
-#include "../util/blob.h"
-#include "binary-xml.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** An ndn_BinaryXmlEncoder struct is used by all the encoding functions.  You should initialize it with
- *  ndn_BinaryXmlEncoder_initialize.
- */
-struct ndn_BinaryXmlEncoder {
-  struct ndn_DynamicUInt8Array *output; /**< A pointer to a ndn_DynamicUInt8Array which receives the encoded output */
-  size_t offset;                        /**< the offset into output.array for the next encoding */
-};
-
-/**
- * Initialize an ndn_BinaryXmlEncoder_initialize struct with the arguments for initializing the ndn_DynamicUInt8Array.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param output A pointer to a ndn_DynamicUInt8Array struct which receives the encoded output.  The struct must
- * remain valid during the entire life of this ndn_BinaryXmlEncoder. If the output->realloc
- * function pointer is null, its array must be large enough to receive the entire encoding.
- */
-static inline void ndn_BinaryXmlEncoder_initialize(struct ndn_BinaryXmlEncoder *self, struct ndn_DynamicUInt8Array *output) 
-{
-  self->output = output;
-  self->offset = 0;
-}
-
-/**
- * Encode a header with the type and value and write it to self->output.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param type the header type
- * @param value the header value
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlEncoder_encodeTypeAndValue(struct ndn_BinaryXmlEncoder *self, unsigned int type, unsigned int value);
-
-/**
- * Write an element start header using DTAG with the tag to self->output.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param tag the DTAG tag
- * @return 0 for success, else an error code
- */
-static inline ndn_Error ndn_BinaryXmlEncoder_writeElementStartDTag(struct ndn_BinaryXmlEncoder *self, unsigned int tag) 
-{
-  return ndn_BinaryXmlEncoder_encodeTypeAndValue(self, ndn_BinaryXml_DTAG, tag);
-}
-
-/**
- * Write an element close to self->output.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlEncoder_writeElementClose(struct ndn_BinaryXmlEncoder *self);
-
-/**
- * Write a BLOB header, then the bytes of the blob value to self->output.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param value A Blob with the array of bytes for the value.
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlEncoder_writeBlob(struct ndn_BinaryXmlEncoder *self, struct ndn_Blob *value);
-
-/**
- * Write an element start header using DTAG with the tag to self->output, then the blob, then an element close.
- * (If you want to just write the blob, use ndn_BinaryXmlEncoder_writeBlob .)
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param tag the DTAG tag
- * @param value A Blob with the array of bytes for the value.
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlEncoder_writeBlobDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, struct ndn_Blob *value);
-
-/**
- * If value or valueLen is 0 then do nothing, otherwise call ndn_BinaryXmlEncoder_writeBlobDTagElement.
- * @param self A pointer to the ndn_BinaryXmlEncoder struct.
- * @param tag The DTAG tag.
- * @param value A Blob with the array of bytes for the value.
- * @return 0 for success, else an error code
- */
-static inline ndn_Error ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement
-  (struct ndn_BinaryXmlEncoder *self, unsigned int tag, struct ndn_Blob *value)
-{
-  if (value->value && value->length > 0)
-    return ndn_BinaryXmlEncoder_writeBlobDTagElement(self, tag, value);
-  else
-    return NDN_ERROR_success;
-}
-
-/**
- * Write a UDATA header, then the bytes of the UDATA value to self->output.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param value A Blob with the array of bytes for the value.
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlEncoder_writeUData(struct ndn_BinaryXmlEncoder *self, struct ndn_Blob *value);
-
-/**
- * Write an element start header using DTAG with the tag to self->output, then the UDATA value, then an element close.
- * (If you want to just write the UDATA value, use ndn_BinaryXmlEncoder_writeUData .)
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param tag the DTAG tag
- * @param value A Blob with the array of bytes for the value.
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlEncoder_writeUDataDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, struct ndn_Blob *value);
-
-/**
- * If value or valueLen is 0 then do nothing, otherwise call ndn_BinaryXmlEncoder_writeUDataDTagElement.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param tag the DTAG tag
- * @param value A Blob with the array of bytes for the value.
- * @return 0 for success, else an error code
- */
-static inline ndn_Error ndn_BinaryXmlEncoder_writeOptionalUDataDTagElement
-  (struct ndn_BinaryXmlEncoder *self, unsigned int tag, struct ndn_Blob *value)
-{
-  if (value->value && value->length > 0)
-    return ndn_BinaryXmlEncoder_writeUDataDTagElement(self, tag, value);
-  else
-    return NDN_ERROR_success;
-}
-
-/**
- * Write a UDATA header, then the value as an unsigned decimal integer.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param value the unsigned int
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlEncoder_writeUnsignedDecimalInt(struct ndn_BinaryXmlEncoder *self, unsigned int value);
-
-/**
- * Write an element start header using DTAG with the tag to self->output, then the value as an unsigned decimal integer, 
- * then an element close.
- * (If you want to just write the integer, use ndn_BinaryXmlEncoder_writeUnsignedDecimalInt .)
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param tag the DTAG tag
- * @param value the unsigned int
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned int value);
-
-/**
- * If value is negative then do nothing, otherwise call ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param tag the DTAG tag
- * @param value negative for none, otherwise use (unsigned int)value
- * @return 0 for success, else an error code
- */
-static inline ndn_Error ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, int value)
-{
-  if (value >= 0)
-    return ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement(self, tag, (size_t)value);
-  else
-    return NDN_ERROR_success;
-}
-
-/**
- * Write a BLOB header, then the absolute value of value, rounded to an integer, to self->output encoded as big endian.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param value the double to encode as big endian.  If value is 0, the big endian encoding has zero bytes.
- * The value is converted to absolute value.
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlEncoder_writeAbsDoubleBigEndianBlob(struct ndn_BinaryXmlEncoder *self, double value);
-
-/**
- * Write an element start header using DTAG with the tag to self->output, then the absolute value of milliseconds
- * as a big endian BLOB converted to 4096 ticks per second, then an element close.
- * (If you want to just write the integer, use ndn_BinaryXmlEncoder_writeUnsignedDecimalInt .)
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param tag the DTAG tag
- * @param milliseconds the the number of milliseconds
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlEncoder_writeTimeMillisecondsDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, double milliseconds);
-
-/**
- * If milliseconds is negative then do nothing, otherwise call ndn_BinaryXmlEncoder_writeTimeMillisecondsDTagElement.
- * @param self pointer to the ndn_BinaryXmlEncoder struct
- * @param tag the DTAG tag
- * @param milliseconds negative for none, otherwise the number of milliseconds
- * @return 0 for success, else an error code
- */
-static inline ndn_Error ndn_BinaryXmlEncoder_writeOptionalTimeMillisecondsDTagElement
-  (struct ndn_BinaryXmlEncoder *self, unsigned int tag, double milliseconds)
-{
-  if (milliseconds >= 0)
-    return ndn_BinaryXmlEncoder_writeTimeMillisecondsDTagElement(self, tag, milliseconds);
-  else
-    return NDN_ERROR_success;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/c/encoding/binary-xml-forwarding-entry.c b/src/c/encoding/binary-xml-forwarding-entry.c
deleted file mode 100644
index d7ed52a..0000000
--- a/src/c/encoding/binary-xml-forwarding-entry.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * Derived from ForwardingEntry.js by Meki Cheraoui.
- * See COPYING for copyright and distribution information.
- */
-
-#include "binary-xml.h"
-#include "binary-xml-forwarding-entry.h"
-#include "binary-xml-name.h"
-#include "binary-xml-key.h"
-#include "binary-xml-publisher-public-key-digest.h"
-
-ndn_Error ndn_encodeBinaryXmlForwardingEntry(struct ndn_ForwardingEntry *forwardingEntry, struct ndn_BinaryXmlEncoder *encoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_ForwardingEntry)))
-    return error;
-    
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalUDataDTagElement
-      (encoder, ndn_BinaryXml_DTag_Action, &forwardingEntry->action)))
-    return error;
-  if ((error = ndn_encodeBinaryXmlName(&forwardingEntry->prefix, encoder)))
-    return error;
-  // This will skip encoding if there is no publisherPublicKeyDigest.
-  if ((error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&forwardingEntry->publisherPublicKeyDigest, encoder)))
-    return error;
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
-      (encoder, ndn_BinaryXml_DTag_FaceID, forwardingEntry->faceId)))
-    return error;
-  if ((error = ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement
-      (encoder, ndn_BinaryXml_DTag_ForwardingFlags, 
-       ndn_ForwardingFlags_getForwardingEntryFlags(&forwardingEntry->forwardingFlags))))
-    return error;
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
-      (encoder, ndn_BinaryXml_DTag_FreshnessSeconds, forwardingEntry->freshnessSeconds)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
-    return error;
-  
-  return NDN_ERROR_success;  
-}
-
-ndn_Error ndn_decodeBinaryXmlForwardingEntry(struct ndn_ForwardingEntry *forwardingEntry, struct ndn_BinaryXmlDecoder *decoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_ForwardingEntry)))
-    return error;
-    
-  if ((error = ndn_BinaryXmlDecoder_readOptionalUDataDTagElement
-      (decoder, ndn_BinaryXml_DTag_Action, &forwardingEntry->action)))
-    return error;
-  if ((error = ndn_decodeBinaryXmlName(&forwardingEntry->prefix, decoder)))
-    return error;
-  if ((error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&forwardingEntry->publisherPublicKeyDigest, decoder)))
-    return error;
-  if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_FaceID, &forwardingEntry->faceId)))
-    return error;
-  
-  int forwardingEntryFlags;
-  if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_ForwardingFlags, &forwardingEntryFlags)))
-    return error;
-  if (forwardingEntryFlags >= 0)
-    ndn_ForwardingFlags_setForwardingEntryFlags(&forwardingEntry->forwardingFlags, forwardingEntryFlags);
-  else
-    // This sets the default flags.
-    ndn_ForwardingFlags_initialize(&forwardingEntry->forwardingFlags);
-  
-  if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_FreshnessSeconds, &forwardingEntry->freshnessSeconds)))
-    return error;
-
-  if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
diff --git a/src/c/encoding/binary-xml-forwarding-entry.h b/src/c/encoding/binary-xml-forwarding-entry.h
deleted file mode 100644
index b08f292..0000000
--- a/src/c/encoding/binary-xml-forwarding-entry.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARY_XML_FORWARDING_ENTRY_H
-#define NDN_BINARY_XML_FORWARDING_ENTRY_H
-
-#include "../errors.h"
-#include "../forwarding-entry.h"
-#include "binary-xml-encoder.h"
-#include "binary-xml-decoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Encode the ndn_ForwardingEntry struct using Binary XML.
- * @param forwardingEntry pointer to the ndn_ForwardingEntry struct
- * @param encoder pointer to the ndn_BinaryXmlEncoder struct
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_encodeBinaryXmlForwardingEntry(struct ndn_ForwardingEntry *forwardingEntry, struct ndn_BinaryXmlEncoder *encoder);
-
-/**
- * Expect the next element to be a Binary XML ForwardingEntry and decode into the ndn_ForwardingEntry struct.
- * @param forwardingEntry pointer to the ndn_ForwardingEntry struct
- * @param decoder pointer to the ndn_BinaryXmlDecoder struct
- * @return 0 for success, else an error code, including if the next element is not KeyLocator.
- */
-ndn_Error ndn_decodeBinaryXmlForwardingEntry(struct ndn_ForwardingEntry *forwardingEntry, struct ndn_BinaryXmlDecoder *decoder);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/encoding/binary-xml-interest.c b/src/c/encoding/binary-xml-interest.c
deleted file mode 100644
index 00da3e4..0000000
--- a/src/c/encoding/binary-xml-interest.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * Derived from Interest.js by Meki Cheraoui.
- * See COPYING for copyright and distribution information.
- */
-
-#include "binary-xml-encoder.h"
-#include "binary-xml-decoder.h"
-#include "binary-xml-name.h"
-#include "binary-xml-publisher-public-key-digest.h"
-#include "binary-xml-interest.h"
-
-static ndn_Error encodeExclude(struct ndn_Exclude *exclude, struct ndn_BinaryXmlEncoder *encoder)
-{
-  if (exclude->nEntries == 0)
-    return NDN_ERROR_success;
-  
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Exclude)))
-    return error;
-  
-  // TODO: Do we want to order the components (except for ANY)?
-  size_t i;
-  for (i = 0; i < exclude->nEntries; ++i) {
-    struct ndn_ExcludeEntry *entry = &exclude->entries[i];
-    
-    if (entry->type == ndn_Exclude_COMPONENT) {
-      if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement(encoder, ndn_BinaryXml_DTag_Component, &entry->component.value)))
-        return error;
-    }
-    else if (entry->type == ndn_Exclude_ANY) {
-      if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Any)))
-        return error;
-      if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
-        return error;
-    }
-    else
-      return NDN_ERROR_unrecognized_ndn_ExcludeType;
-  }
-  
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
-    return error;
-  
-  return NDN_ERROR_success;  
-}
-
-static ndn_Error decodeExclude(struct ndn_Exclude *exclude, struct ndn_BinaryXmlDecoder *decoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Exclude)))
-    return error;
-    
-  exclude->nEntries = 0;
-  while (1) {
-    int gotExpectedTag;
-    
-    if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Component, &gotExpectedTag)))
-      return error;    
-    if (gotExpectedTag) {
-      // Component
-      struct ndn_Blob component;
-      if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Component, 0, &component)))
-        return error;
-    
-      // Add the component entry.
-      if (exclude->nEntries >= exclude->maxEntries)
-        return NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude;
-      ndn_ExcludeEntry_initialize(exclude->entries + exclude->nEntries, ndn_Exclude_COMPONENT, component.value, component.length);
-      ++exclude->nEntries;
-
-      continue;
-    }
-    
-    if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Any, &gotExpectedTag)))
-      return error;    
-    if (gotExpectedTag) {
-      // Any
-      if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Any)))
-        return error;
-      if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
-        return error;
-    
-      // Add the any entry.
-      if (exclude->nEntries >= exclude->maxEntries)
-        return NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude;
-      ndn_ExcludeEntry_initialize(exclude->entries + exclude->nEntries, ndn_Exclude_ANY, 0, 0);
-      ++exclude->nEntries;
-
-      continue;
-    }
-    
-    if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Bloom, &gotExpectedTag)))
-      return error;    
-    if (gotExpectedTag) {
-      // Skip the Bloom and treat it as Any.
-      struct ndn_Blob value;
-      if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Bloom, 0, &value)))
-        return error;
-    
-      // Add the any entry.
-      if (exclude->nEntries >= exclude->maxEntries)
-        return NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude;
-      ndn_ExcludeEntry_initialize(exclude->entries + exclude->nEntries, ndn_Exclude_ANY, 0, 0);
-      ++exclude->nEntries;
-
-      continue;
-    }
-    
-    // Else no more entries.
-    break;
-  }
-  
-  if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_encodeBinaryXmlInterest(struct ndn_Interest *interest, struct ndn_BinaryXmlEncoder *encoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Interest)))
-    return error;
-    
-  if ((error = ndn_encodeBinaryXmlName(&interest->name, encoder)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
-      (encoder, ndn_BinaryXml_DTag_MinSuffixComponents, interest->minSuffixComponents)))
-    return error;
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
-      (encoder, ndn_BinaryXml_DTag_MaxSuffixComponents, interest->maxSuffixComponents)))
-    return error;
-    
-  // This will skip encoding if there is no publisherPublicKeyDigest.
-  if ((error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, encoder)))
-    return error;
-  
-  // This will skip encoding if there is no exclude.
-  if ((error = encodeExclude(&interest->exclude, encoder)))
-    return error;
-
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
-      (encoder, ndn_BinaryXml_DTag_ChildSelector, interest->childSelector)))
-    return error;
-  if (interest->answerOriginKind >= 0 && interest->answerOriginKind != ndn_Interest_DEFAULT_ANSWER_ORIGIN_KIND) {
-    if ((error = ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement
-        (encoder, ndn_BinaryXml_DTag_AnswerOriginKind, (unsigned int)interest->answerOriginKind)))
-      return error;
-  }
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
-      (encoder, ndn_BinaryXml_DTag_Scope, interest->scope)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalTimeMillisecondsDTagElement
-      (encoder, ndn_BinaryXml_DTag_InterestLifetime, interest->interestLifetimeMilliseconds)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement(encoder, ndn_BinaryXml_DTag_Nonce, &interest->nonce)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
-    return error;
-  
-  return NDN_ERROR_success;  
-}
-
-ndn_Error ndn_decodeBinaryXmlInterest(struct ndn_Interest *interest, struct ndn_BinaryXmlDecoder *decoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Interest)))
-    return error;
-    
-  if ((error = ndn_decodeBinaryXmlName(&interest->name, decoder)))
-    return error;
-       
-  if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_MinSuffixComponents, &interest->minSuffixComponents)))
-    return error;
-  if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_MaxSuffixComponents, &interest->maxSuffixComponents)))
-    return error;
-  
-  if ((error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, decoder)))
-    return error;
-  
-  int gotExpectedTag;
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Exclude, &gotExpectedTag)))
-    return error;
-  if (gotExpectedTag) {
-    if ((error = decodeExclude(&interest->exclude, decoder)))
-      return error;
-  }
-  else
-    interest->exclude.nEntries = 0;
-  
-  if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_ChildSelector, &interest->childSelector)))
-    return error;
-  if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_AnswerOriginKind, &interest->answerOriginKind)))
-    return error;
-  if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_Scope, &interest->scope)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement
-       (decoder, ndn_BinaryXml_DTag_InterestLifetime, &interest->interestLifetimeMilliseconds)))
-    return error;
-  
-  if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
-      (decoder, ndn_BinaryXml_DTag_Nonce, 0, &interest->nonce)))
-    return error;
-
-  if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
diff --git a/src/c/encoding/binary-xml-interest.h b/src/c/encoding/binary-xml-interest.h
deleted file mode 100644
index 532afe4..0000000
--- a/src/c/encoding/binary-xml-interest.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLINTEREST_H
-#define NDN_BINARYXMLINTEREST_H
-
-#include "../errors.h"
-#include "../interest.h"
-#include "binary-xml-encoder.h"
-#include "binary-xml-decoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ndn_Error ndn_encodeBinaryXmlInterest(struct ndn_Interest *interest, struct ndn_BinaryXmlEncoder *encoder);
-
-ndn_Error ndn_decodeBinaryXmlInterest(struct ndn_Interest *interest, struct ndn_BinaryXmlDecoder *decoder);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/c/encoding/binary-xml-key.c b/src/c/encoding/binary-xml-key.c
deleted file mode 100644
index bc55911..0000000
--- a/src/c/encoding/binary-xml-key.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * Derived from Key.js by Meki Cheraoui.
- * See COPYING for copyright and distribution information.
- */
-
-#include "binary-xml.h"
-#include "binary-xml-structure-decoder.h"
-#include "binary-xml-key.h"
-#include "binary-xml-name.h"
-
-static ndn_Error decodeKeyNameData(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder)
-{
-  int gotExpectedTag;
-  ndn_Error error; 
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, &gotExpectedTag)))
-    return error;
-  if (gotExpectedTag) {
-    keyLocator->keyNameType = ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST;
-    if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
-        (decoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, 0, &keyLocator->keyData)))
-      return error;
-  }
-  else {
-    if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherCertificateDigest, &gotExpectedTag)))
-      return error;
-    if (gotExpectedTag) {
-      keyLocator->keyNameType = ndn_KeyNameType_PUBLISHER_CERTIFICATE_DIGEST;
-      if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
-          (decoder, ndn_BinaryXml_DTag_PublisherCertificateDigest, 0, &keyLocator->keyData)))
-        return error;
-    }
-    else {
-      if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherIssuerKeyDigest, &gotExpectedTag)))
-        return error;
-      if (gotExpectedTag) {
-        keyLocator->keyNameType = ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST;
-        if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
-            (decoder, ndn_BinaryXml_DTag_PublisherIssuerKeyDigest, 0, &keyLocator->keyData)))
-          return error;
-      }
-      else {
-        if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherIssuerCertificateDigest, &gotExpectedTag)))
-          return error;
-        if (gotExpectedTag) {
-          keyLocator->keyNameType = ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST;
-          if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
-              (decoder, ndn_BinaryXml_DTag_PublisherIssuerCertificateDigest, 0, &keyLocator->keyData)))
-            return error;
-        }
-        else {
-          // Key name data is omitted.
-          keyLocator->keyNameType = -1;
-          keyLocator->keyData.length = 0;
-        }
-      }
-    }
-  }
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_encodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlEncoder *encoder)
-{
-  if ((int)keyLocator->type < 0)
-    return NDN_ERROR_success;
-
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_KeyLocator)))
-    return error;
-
-  if (keyLocator->type == ndn_KeyLocatorType_KEY) {
-    if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement(encoder, ndn_BinaryXml_DTag_Key, &keyLocator->keyData)))
-      return error;    
-  }
-  else if (keyLocator->type == ndn_KeyLocatorType_CERTIFICATE) {
-    if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement(encoder, ndn_BinaryXml_DTag_Certificate, &keyLocator->keyData)))
-      return error;    
-  }
-  else if (keyLocator->type == ndn_KeyLocatorType_KEYNAME) {
-    if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_KeyName)))
-      return error;
-    if ((error = ndn_encodeBinaryXmlName(&keyLocator->keyName, encoder)))
-      return error;
-    
-    if ((int)keyLocator->keyNameType >= 0 && keyLocator->keyData.length > 0) {
-      if (keyLocator->keyNameType == ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST) {
-        if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
-            (encoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, &keyLocator->keyData)))
-          return error;    
-      }
-      else if (keyLocator->keyNameType == ndn_KeyNameType_PUBLISHER_CERTIFICATE_DIGEST) {
-        if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
-            (encoder, ndn_BinaryXml_DTag_PublisherCertificateDigest, &keyLocator->keyData)))
-          return error;    
-      }
-      else if (keyLocator->keyNameType == ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST) {
-        if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
-            (encoder, ndn_BinaryXml_DTag_PublisherIssuerKeyDigest, &keyLocator->keyData)))
-          return error;    
-      }
-      else if (keyLocator->keyNameType == ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST) {
-        if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
-            (encoder, ndn_BinaryXml_DTag_PublisherIssuerCertificateDigest, &keyLocator->keyData)))
-          return error;    
-      }
-      else
-        return NDN_ERROR_unrecognized_ndn_KeyNameType;
-    }
-    
-    if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
-      return error;
-  }
-  else
-    return NDN_ERROR_unrecognized_ndn_KeyLocatorType;
-  
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_decodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_KeyLocator)))
-    return error;
-
-  int gotExpectedTag;
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Key, &gotExpectedTag)))
-    return error;
-  if (gotExpectedTag) {
-    keyLocator->type = ndn_KeyLocatorType_KEY;
-    
-    if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Key, 0, &keyLocator->keyData)))
-      return error;
-  }
-  else {
-    if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Certificate, &gotExpectedTag)))
-      return error;
-    if (gotExpectedTag) {
-      keyLocator->type = ndn_KeyLocatorType_CERTIFICATE;
-    
-      if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
-          (decoder, ndn_BinaryXml_DTag_Certificate, 0, &keyLocator->keyData)))
-        return error;
-    }
-    else {
-      if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_KeyName, &gotExpectedTag)))
-        return error;
-      if (gotExpectedTag) {
-        keyLocator->type = ndn_KeyLocatorType_KEYNAME;
-        
-        if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_KeyName)))
-          return error;
-        if ((error = ndn_decodeBinaryXmlName(&keyLocator->keyName, decoder)))
-          return error;
-        if ((error = decodeKeyNameData(keyLocator, decoder)))
-          return error;        
-        if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
-          return error;
-      }
-      else
-        return NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_locator_type;
-    }
-  }
-
-  if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_decodeOptionalBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder)
-{
-  int gotExpectedTag;
-  ndn_Error error; 
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_KeyLocator, &gotExpectedTag)))
-    return error;
-  if (gotExpectedTag) {
-    if ((error = ndn_decodeBinaryXmlKeyLocator(keyLocator, decoder)))
-      return error;
-  }
-  else
-    ndn_KeyLocator_initialize(keyLocator, keyLocator->keyName.components, keyLocator->keyName.maxComponents);
-  
-  return NDN_ERROR_success;
-}
diff --git a/src/c/encoding/binary-xml-key.h b/src/c/encoding/binary-xml-key.h
deleted file mode 100644
index efd8f54..0000000
--- a/src/c/encoding/binary-xml-key.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLKEY_H
-#define NDN_BINARYXMLKEY_H
-
-#include "../key-locator.h"
-#include "../errors.h"
-#include "binary-xml-encoder.h"
-#include "binary-xml-decoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Encode the ndn_KeyLocator struct using Binary XML.  If keyLocator->type is -1, then do nothing. 
- * @param keyLocator pointer to the ndn_KeyLocator struct
- * @param encoder pointer to the ndn_BinaryXmlEncoder struct
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_encodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlEncoder *encoder);
-
-/**
- * Expect the next element to be a Binary XML KeyLocator and decode into the ndn_KeyLocator struct.
- * @param keyLocator pointer to the ndn_KeyLocator struct
- * @param decoder pointer to the ndn_BinaryXmlDecoder struct
- * @return 0 for success, else an error code, including if the next element is not KeyLocator.
- */
-ndn_Error ndn_decodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder);
-
-/**
- * Peek the next element and if it is a Binary XML KeyLocator and decode into the ndn_KeyLocator struct.
- * Otherwise, set the ndn_KeyLocator struct to none.
- * @param keyLocator pointer to the ndn_KeyLocator struct
- * @param decoder pointer to the ndn_BinaryXmlDecoder struct
- * @return 0 for success, else an error code, including if the next element is not KeyLocator.
- */
-ndn_Error ndn_decodeOptionalBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/encoding/binary-xml-name.c b/src/c/encoding/binary-xml-name.c
deleted file mode 100644
index 8df81c3..0000000
--- a/src/c/encoding/binary-xml-name.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * Derived from Name.js by Meki Cheraoui.
- * See COPYING for copyright and distribution information.
- */
-
-#include "binary-xml-encoder.h"
-#include "binary-xml-decoder.h"
-#include "binary-xml-name.h"
-
-ndn_Error ndn_encodeBinaryXmlName(struct ndn_Name *name, struct ndn_BinaryXmlEncoder *encoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Name)))
-    return error;
-  
-  size_t i;
-  for (i = 0; i < name->nComponents; ++i) {
-    if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement(encoder, ndn_BinaryXml_DTag_Component, &name->components[i].value)))
-      return error;
-  }
-  
-  if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_decodeBinaryXmlName(struct ndn_Name *name, struct ndn_BinaryXmlDecoder *decoder)
-{
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Name)))
-    return error;
-    
-  name->nComponents = 0;
-  while (1) {
-    int gotExpectedTag;
-    if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Component, &gotExpectedTag)))
-      return error;
-    
-    if (!gotExpectedTag)
-      // No more components.
-      break;
-    
-    struct ndn_Blob component;
-    if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Component, 0, &component)))
-      return error;
-    if ((error = ndn_Name_appendBlob(name, &component)))
-      return error;
-  }
-  
-  if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
diff --git a/src/c/encoding/binary-xml-name.h b/src/c/encoding/binary-xml-name.h
deleted file mode 100644
index 369dfc5..0000000
--- a/src/c/encoding/binary-xml-name.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLNAME_H
-#define NDN_BINARYXMLNAME_H
-
-#include "../errors.h"
-#include "../name.h"
-#include "binary-xml-encoder.h"
-#include "binary-xml-decoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ndn_Error ndn_encodeBinaryXmlName(struct ndn_Name *name, struct ndn_BinaryXmlEncoder *encoder);
-
-ndn_Error ndn_decodeBinaryXmlName(struct ndn_Name *name, struct ndn_BinaryXmlDecoder *decoder);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/c/encoding/binary-xml-publisher-public-key-digest.c b/src/c/encoding/binary-xml-publisher-public-key-digest.c
deleted file mode 100644
index 4748147..0000000
--- a/src/c/encoding/binary-xml-publisher-public-key-digest.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * Derived from PublisherPublicKeyDigest.js by Meki Cheraoui.
- * See COPYING for copyright and distribution information.
- */
-
-#include "binary-xml.h"
-#include "binary-xml-publisher-public-key-digest.h"
-
-ndn_Error ndn_encodeBinaryXmlPublisherPublicKeyDigest
-  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXmlEncoder *encoder)
-{  
-  if (!publisherPublicKeyDigest->publisherPublicKeyDigest.value || publisherPublicKeyDigest->publisherPublicKeyDigest.length == 0)
-    return NDN_ERROR_success;
-  
-  ndn_Error error;
-  if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
-      (encoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, &publisherPublicKeyDigest->publisherPublicKeyDigest)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_decodeBinaryXmlPublisherPublicKeyDigest
-  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXmlDecoder *decoder)
-{
-  ndn_Error error; 
-  if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
-      (decoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, 0, &publisherPublicKeyDigest->publisherPublicKeyDigest)))
-    return error;
-  
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest
-  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXmlDecoder *decoder)
-{
-  int gotExpectedTag;
-  ndn_Error error; 
-  if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, &gotExpectedTag)))
-    return error;
-  if (gotExpectedTag) {
-    if ((error = ndn_decodeBinaryXmlPublisherPublicKeyDigest(publisherPublicKeyDigest, decoder)))
-      return error;
-  }
-  else {
-    publisherPublicKeyDigest->publisherPublicKeyDigest.value = 0;
-    publisherPublicKeyDigest->publisherPublicKeyDigest.length = 0;
-  }
-  
-  return NDN_ERROR_success;
-}
diff --git a/src/c/encoding/binary-xml-publisher-public-key-digest.h b/src/c/encoding/binary-xml-publisher-public-key-digest.h
deleted file mode 100644
index 2d76205..0000000
--- a/src/c/encoding/binary-xml-publisher-public-key-digest.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLPUBLISHERPUBLICKEYDIGEST_H
-#define NDN_BINARYXMLPUBLISHERPUBLICKEYDIGEST_H
-
-#include "../errors.h"
-#include "../publisher-public-key-digest.h"
-#include "binary-xml-encoder.h"
-#include "binary-xml-decoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Encode the ndn_PublisherPublicKeyDigest struct using Binary XML.  If publisherPublicKeyDigest->publisherPublicKeyDigest or
- * publisherPublicKeyDigestLength is 0, then do nothing. 
- * @param publisherPublicKeyDigest pointer to the ndn_PublisherPublicKeyDigest struct
- * @param encoder pointer to the ndn_BinaryXmlEncoder struct
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_encodeBinaryXmlPublisherPublicKeyDigest
-  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXmlEncoder *encoder);
-
-/**
- * Expect the next element to be a Binary XML PublisherPublicKeyDigest and decode into the ndn_PublisherPublicKeyDigest struct.
- * @param publisherPublicKeyDigest pointer to the ndn_PublisherPublicKeyDigest struct
- * @param decoder pointer to the ndn_BinaryXmlDecoder struct
- * @return 0 for success, else an error code, including if the next element is not PublisherPublicKeyDigest.
- */
-ndn_Error ndn_decodeBinaryXmlPublisherPublicKeyDigest
-  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXmlDecoder *decoder);
-
-/**
- * Peek the next element and if it is a Binary XML PublisherPublicKeyDigest and decode into the ndn_PublisherPublicKeyDigest struct.
- * Otherwise, set the ndn_PublisherPublicKeyDigest struct to none.
- * @param publisherPublicKeyDigest pointer to the ndn_PublisherPublicKeyDigest struct
- * @param decoder pointer to the ndn_BinaryXmlDecoder struct
- * @return 0 for success, else an error code, including if the next element is not PublisherPublicKeyDigest.
- */
-ndn_Error ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest
-  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXmlDecoder *decoder);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/encoding/binary-xml-structure-decoder.c b/src/c/encoding/binary-xml-structure-decoder.c
deleted file mode 100644
index a8e2f09..0000000
--- a/src/c/encoding/binary-xml-structure-decoder.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "../util/ndn_memory.h"
-#include "binary-xml.h"
-#include "binary-xml-decoder.h"
-#include "binary-xml-structure-decoder.h"
-
-void ndn_BinaryXmlStructureDecoder_initialize(struct ndn_BinaryXmlStructureDecoder *self) 
-{
-  self->gotElementEnd = 0;
-  self->offset = 0;
-  self->level = 0;
-  self->state = ndn_BinaryXmlStructureDecoder_READ_HEADER_OR_CLOSE;
-  self->headerLength = 0;
-  self->useHeaderBuffer = 0;
-  self->nBytesToRead = 0;
-}
-
-/**
- * Set the state to READ_HEADER_OR_CLOSE and set up to start reading the header.
- */
-static inline void startHeader(struct ndn_BinaryXmlStructureDecoder *self)
-{
-  self->headerLength = 0;
-  self->useHeaderBuffer = 0;
-  self->state = ndn_BinaryXmlStructureDecoder_READ_HEADER_OR_CLOSE;    
-}
-
-ndn_Error ndn_BinaryXmlStructureDecoder_findElementEnd
-  (struct ndn_BinaryXmlStructureDecoder *self, uint8_t *input, size_t inputLength) 
-{
-  if (self->gotElementEnd)
-    // Someone is calling when we already got the end.
-    return NDN_ERROR_success;
-  
-  struct ndn_BinaryXmlDecoder decoder;
-  ndn_BinaryXmlDecoder_initialize(&decoder, input, inputLength);
-  
-  while (1) {
-    if (self->offset >= inputLength)
-      // All the cases assume we have some input. Return and wait for more.
-      return NDN_ERROR_success;
-    
-    if (self->state == ndn_BinaryXmlStructureDecoder_READ_HEADER_OR_CLOSE) {
-      // First check for CLOSE.
-      if (self->headerLength == 0 && input[self->offset] == ndn_BinaryXml_CLOSE) {
-        ++self->offset;
-        // Close the level.
-        --self->level;
-        if (self->level == 0) {
-          // Finished.
-          self->gotElementEnd = 1;
-          return NDN_ERROR_success;
-        }
-        if (self->level < 0)
-          return NDN_ERROR_findElementEnd_unexpected_close_tag;
-          
-        // Get ready for the next header.
-        startHeader(self);
-        continue;
-      }
-        
-      size_t startingHeaderLength = self->headerLength;
-      while (1) {
-        if (self->offset >= inputLength) {
-          // We can't get all of the header bytes from this input. Save in headerBuffer.
-          if (self->headerLength > sizeof(self->headerBuffer))
-            return NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer;
-          self->useHeaderBuffer = 1;
-          size_t nNewBytes = self->headerLength - startingHeaderLength;
-          ndn_memcpy(self->headerBuffer + startingHeaderLength, input + (self->offset - nNewBytes), nNewBytes);
-            
-          return NDN_ERROR_success;
-        }
-        unsigned int headerByte = (unsigned int)input[self->offset++];
-        ++self->headerLength;
-        if (headerByte & ndn_BinaryXml_TT_FINAL)
-          // Break and read the header.
-          break;
-      }
-        
-      unsigned int type;
-      unsigned int value;
-      if (self->useHeaderBuffer) {
-        // Copy the remaining bytes into headerBuffer.
-        if (self->headerLength > sizeof(self->headerBuffer))
-          return NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer;
-        size_t nNewBytes = self->headerLength - startingHeaderLength;
-        ndn_memcpy(self->headerBuffer + startingHeaderLength, input + (self->offset - nNewBytes), nNewBytes);
-
-        // Use a local decoder just for the headerBuffer.
-        struct ndn_BinaryXmlDecoder bufferDecoder;
-        ndn_BinaryXmlDecoder_initialize(&bufferDecoder, self->headerBuffer, sizeof(self->headerBuffer));
-        if (ndn_BinaryXmlDecoder_decodeTypeAndValue(&bufferDecoder, &type, &value))
-          return NDN_ERROR_findElementEnd_cannot_read_header_type_and_value;
-      }
-      else {
-        // We didn't have to use the headerBuffer.
-        ndn_BinaryXmlDecoder_seek(&decoder, self->offset - self->headerLength);
-        if (ndn_BinaryXmlDecoder_decodeTypeAndValue(&decoder, &type, &value))
-          return NDN_ERROR_findElementEnd_cannot_read_header_type_and_value;
-      }
-        
-      // Set the next state based on the type.
-      if (type == ndn_BinaryXml_DATTR)
-        // We already consumed the item. READ_HEADER_OR_CLOSE again.
-        // Binary XML has rules about what must follow an attribute, but we are just scanning.
-        startHeader(self);
-      else if (type == ndn_BinaryXml_DTAG || type == ndn_BinaryXml_EXT) {
-        // Start a new level and READ_HEADER_OR_CLOSE again.
-        ++self->level;
-        startHeader(self);
-      }
-      else if (type == ndn_BinaryXml_TAG || type == ndn_BinaryXml_ATTR) {
-        if (type == ndn_BinaryXml_TAG)
-          // Start a new level and read the tag.
-          ++self->level;
-        // Minimum tag or attribute length is 1.
-        self->nBytesToRead = value + 1;
-        self->state = ndn_BinaryXmlStructureDecoder_READ_BYTES;
-        // Binary XML has rules about what must follow an attribute, but we are just scanning.
-      }
-      else if (type == ndn_BinaryXml_BLOB || type == ndn_BinaryXml_UDATA) {
-        self->nBytesToRead = value;
-        self->state = ndn_BinaryXmlStructureDecoder_READ_BYTES;
-      }
-      else
-        return NDN_ERROR_findElementEnd_unrecognized_header_type;
-    }  
-    else if (self->state == ndn_BinaryXmlStructureDecoder_READ_BYTES) {
-      size_t nRemainingBytes = inputLength - self->offset;
-      if (nRemainingBytes < self->nBytesToRead) {
-        // Need more.
-        self->offset += nRemainingBytes;
-        self->nBytesToRead -= nRemainingBytes;
-        return NDN_ERROR_success;
-      }
-      // Got the bytes. Read a new header or close.
-      self->offset += self->nBytesToRead;
-      startHeader(self);
-    }
-    else
-      // We don't expect this to happen.
-      return NDN_ERROR_findElementEnd_unrecognized_state;
-  }
-}
diff --git a/src/c/encoding/binary-xml-structure-decoder.h b/src/c/encoding/binary-xml-structure-decoder.h
deleted file mode 100644
index da5ad08..0000000
--- a/src/c/encoding/binary-xml-structure-decoder.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLSTRUCTUREDECODER_H
-#define NDN_BINARYXMLSTRUCTUREDECODER_H
-
-#include <ndn-cpp-dev/c/common.h>
-#include "../errors.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ndn_BinaryXmlStructureDecoder {
-  int gotElementEnd; /**< boolean */
-  size_t offset;
-  int level;
-  int state;
-  size_t headerLength;
-  int useHeaderBuffer; /**< boolean */
-  // 10 bytes is enough to hold an encoded header with a type and a 64 bit value.
-  uint8_t headerBuffer[10];
-  int nBytesToRead;
-};
-
-enum {
-  ndn_BinaryXmlStructureDecoder_READ_HEADER_OR_CLOSE,
-  ndn_BinaryXmlStructureDecoder_READ_BYTES
-};
-
-void ndn_BinaryXmlStructureDecoder_initialize(struct ndn_BinaryXmlStructureDecoder *self);
-        
-/**
- * Continue scanning input starting from self->offset to find the element end.  On return, you must check
- *   self->gotElementEnd: If the end of the element which started at offset 0 is found, 
- *   then self->gotElementEnd is 1 and self->offset is the length of the element.  Otherwise, self-forElementEnd is 0 
- *   which means you should read more into input and call again.
- * @param self pointer to the ndn_BinaryXmlStructureDecoder struct
- * @param input the input buffer. You have to pass in input each time because the buffer could be reallocated.
- * @param inputLength the number of bytes in input.
- * @return 0 for success, else an error code
- */
-ndn_Error ndn_BinaryXmlStructureDecoder_findElementEnd
-  (struct ndn_BinaryXmlStructureDecoder *self, uint8_t *input, size_t inputLength);
-
-/**
- * Set the offset into the input, used for the next read.
- * @param self pointer to the ndn_BinaryXmlStructureDecoder struct
- * @param offset the new offset
- */
-static inline void ndn_BinaryXmlStructureDecoder_seek(struct ndn_BinaryXmlStructureDecoder *self, size_t offset) 
-{
-  self->offset = offset;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/encoding/binary-xml.h b/src/c/encoding/binary-xml.h
deleted file mode 100644
index dc6958b..0000000
--- a/src/c/encoding/binary-xml.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXML_H
-#define NDN_BINARYXML_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
-  ndn_BinaryXml_EXT = 0x00,   
-  ndn_BinaryXml_TAG = 0x01, 
-  ndn_BinaryXml_DTAG = 0x02, 
-  ndn_BinaryXml_ATTR = 0x03, 
-  ndn_BinaryXml_DATTR = 0x04, 
-  ndn_BinaryXml_BLOB = 0x05, 
-  ndn_BinaryXml_UDATA = 0x06, 
-  ndn_BinaryXml_CLOSE = 0x0,
-
-  ndn_BinaryXml_TT_BITS = 3,
-  ndn_BinaryXml_TT_MASK = ((1 << ndn_BinaryXml_TT_BITS) - 1),
-  ndn_BinaryXml_TT_VALUE_BITS = 4,
-  ndn_BinaryXml_TT_VALUE_MASK = ((1 << (ndn_BinaryXml_TT_VALUE_BITS)) - 1),
-  ndn_BinaryXml_REGULAR_VALUE_BITS = 7,
-  ndn_BinaryXml_REGULAR_VALUE_MASK = ((1 << ndn_BinaryXml_REGULAR_VALUE_BITS) - 1),
-  ndn_BinaryXml_TT_FINAL = 0x80,
-
-  ndn_BinaryXml_DTag_Any = 13,
-  ndn_BinaryXml_DTag_Name = 14,
-  ndn_BinaryXml_DTag_Component = 15,
-  ndn_BinaryXml_DTag_Certificate = 16,
-  ndn_BinaryXml_DTag_Collection = 17,
-  ndn_BinaryXml_DTag_CompleteName = 18,
-  ndn_BinaryXml_DTag_Content = 19,
-  ndn_BinaryXml_DTag_SignedInfo = 20,
-  ndn_BinaryXml_DTag_ContentDigest = 21,
-  ndn_BinaryXml_DTag_ContentHash = 22,
-  ndn_BinaryXml_DTag_Count = 24,
-  ndn_BinaryXml_DTag_Header = 25,
-  ndn_BinaryXml_DTag_Interest = 26,  /* 20090915 */
-  ndn_BinaryXml_DTag_Key = 27,
-  ndn_BinaryXml_DTag_KeyLocator = 28,
-  ndn_BinaryXml_DTag_KeyName = 29,
-  ndn_BinaryXml_DTag_Length = 30,
-  ndn_BinaryXml_DTag_Link = 31,
-  ndn_BinaryXml_DTag_LinkAuthenticator = 32,
-  ndn_BinaryXml_DTag_NameComponentCount = 33,  /* DeprecatedInInterest */
-  ndn_BinaryXml_DTag_RootDigest = 36,
-  ndn_BinaryXml_DTag_Signature = 37,
-  ndn_BinaryXml_DTag_Start = 38,
-  ndn_BinaryXml_DTag_Timestamp = 39,
-  ndn_BinaryXml_DTag_Type = 40,
-  ndn_BinaryXml_DTag_Nonce = 41,
-  ndn_BinaryXml_DTag_Scope = 42,
-  ndn_BinaryXml_DTag_Exclude = 43,
-  ndn_BinaryXml_DTag_Bloom = 44,
-  ndn_BinaryXml_DTag_BloomSeed = 45,
-  ndn_BinaryXml_DTag_AnswerOriginKind = 47,
-  ndn_BinaryXml_DTag_InterestLifetime = 48,
-  ndn_BinaryXml_DTag_Witness = 53,
-  ndn_BinaryXml_DTag_SignatureBits = 54,
-  ndn_BinaryXml_DTag_DigestAlgorithm = 55,
-  ndn_BinaryXml_DTag_BlockSize = 56,
-  ndn_BinaryXml_DTag_FreshnessSeconds = 58,
-  ndn_BinaryXml_DTag_FinalBlockID = 59,
-  ndn_BinaryXml_DTag_PublisherPublicKeyDigest = 60,
-  ndn_BinaryXml_DTag_PublisherCertificateDigest = 61,
-  ndn_BinaryXml_DTag_PublisherIssuerKeyDigest = 62,
-  ndn_BinaryXml_DTag_PublisherIssuerCertificateDigest = 63,
-  ndn_BinaryXml_DTag_ContentObject = 64,  /* 20090915 */
-  ndn_BinaryXml_DTag_WrappedKey = 65,
-  ndn_BinaryXml_DTag_WrappingKeyIdentifier = 66,
-  ndn_BinaryXml_DTag_WrapAlgorithm = 67,
-  ndn_BinaryXml_DTag_KeyAlgorithm = 68,
-  ndn_BinaryXml_DTag_Label = 69,
-  ndn_BinaryXml_DTag_EncryptedKey = 70,
-  ndn_BinaryXml_DTag_EncryptedNonceKey = 71,
-  ndn_BinaryXml_DTag_WrappingKeyName = 72,
-  ndn_BinaryXml_DTag_Action = 73,
-  ndn_BinaryXml_DTag_FaceID = 74,
-  ndn_BinaryXml_DTag_IPProto = 75,
-  ndn_BinaryXml_DTag_Host = 76,
-  ndn_BinaryXml_DTag_Port = 77,
-  ndn_BinaryXml_DTag_MulticastInterface = 78,
-  ndn_BinaryXml_DTag_ForwardingFlags = 79,
-  ndn_BinaryXml_DTag_FaceInstance = 80,
-  ndn_BinaryXml_DTag_ForwardingEntry = 81,
-  ndn_BinaryXml_DTag_MulticastTTL = 82,
-  ndn_BinaryXml_DTag_MinSuffixComponents = 83,
-  ndn_BinaryXml_DTag_MaxSuffixComponents = 84,
-  ndn_BinaryXml_DTag_ChildSelector = 85,
-  ndn_BinaryXml_DTag_RepositoryInfo = 86,
-  ndn_BinaryXml_DTag_Version = 87,
-  ndn_BinaryXml_DTag_RepositoryVersion = 88,
-  ndn_BinaryXml_DTag_GlobalPrefix = 89,
-  ndn_BinaryXml_DTag_LocalName = 90,
-  ndn_BinaryXml_DTag_Policy = 91,
-  ndn_BinaryXml_DTag_Namespace = 92,
-  ndn_BinaryXml_DTag_GlobalPrefixName = 93,
-  ndn_BinaryXml_DTag_PolicyVersion = 94,
-  ndn_BinaryXml_DTag_KeyValueSet = 95,
-  ndn_BinaryXml_DTag_KeyValuePair = 96,
-  ndn_BinaryXml_DTag_IntegerValue = 97,
-  ndn_BinaryXml_DTag_DecimalValue = 98,
-  ndn_BinaryXml_DTag_StringValue = 99,
-  ndn_BinaryXml_DTag_BinaryValue = 100,
-  ndn_BinaryXml_DTag_NameValue = 101,
-  ndn_BinaryXml_DTag_Entry = 102,
-  ndn_BinaryXml_DTag_ACL = 103,
-  ndn_BinaryXml_DTag_ParameterizedName = 104,
-  ndn_BinaryXml_DTag_Prefix = 105,
-  ndn_BinaryXml_DTag_Suffix = 106,
-  ndn_BinaryXml_DTag_Root = 107,
-  ndn_BinaryXml_DTag_ProfileName = 108,
-  ndn_BinaryXml_DTag_Parameters = 109,
-  ndn_BinaryXml_DTag_InfoString = 110,
-  ndn_BinaryXml_DTag_StatusResponse = 112,
-  ndn_BinaryXml_DTag_StatusCode = 113,
-  ndn_BinaryXml_DTag_StatusText = 114,
-  ndn_BinaryXml_DTag_SyncNode = 115,
-  ndn_BinaryXml_DTag_SyncNodeKind = 116,
-  ndn_BinaryXml_DTag_SyncNodeElement = 117,
-  ndn_BinaryXml_DTag_SyncVersion = 118,
-  ndn_BinaryXml_DTag_SyncNodeElements = 119,
-  ndn_BinaryXml_DTag_SyncContentHash = 120,
-  ndn_BinaryXml_DTag_SyncLeafCount = 121,
-  ndn_BinaryXml_DTag_SyncTreeDepth = 122,
-  ndn_BinaryXml_DTag_SyncByteCount = 123,
-  ndn_BinaryXml_DTag_SyncConfigSlice = 124,
-  ndn_BinaryXml_DTag_SyncConfigSliceList = 125,
-  ndn_BinaryXml_DTag_SyncConfigSliceOp = 126,
-  ndn_BinaryXml_DTag_SyncNodeDeltas = 127,
-  ndn_BinaryXml_DTag_SequenceNumber = 256,
-  ndn_BinaryXml_DTag_NDNProtocolDataUnit = 20587744 // the encoded empty element, viewed as a string is "NDN\202\000"
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/errors.c b/src/c/errors.c
deleted file mode 100644
index 3b6b8bb..0000000
--- a/src/c/errors.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "errors.h"
-
-char *ndn_getErrorString(int error)
-{
-  switch (error) {
-  case NDN_ERROR_success:
-    return      "Success"; 
-  case NDN_ERROR_element_of_value_is_not_a_decimal_digit:
-    return      "Element of value is not a decimal digit";
-  case NDN_ERROR_read_past_the_end_of_the_input:
-    return      "Read past the end of the input";
-  case NDN_ERROR_the_first_header_octet_may_not_be_zero:
-    return      "The first header octet may not be zero";
-  case NDN_ERROR_header_type_is_not_a_DTAG:
-    return      "Header type is not a DTAG";
-  case NDN_ERROR_did_not_get_the_expected_DTAG:
-    return      "Did not get the expected DTAG";
-  case NDN_ERROR_did_not_get_the_expected_element_close:
-    return      "Did not get the expected element close";
-  case NDN_ERROR_item_is_not_UDATA:
-    return      "Item is not UDATA";
-  case NDN_ERROR_header_type_is_out_of_range:
-    return      "Header type is out of range";
-  case NDN_ERROR_encodeTypeAndValue_miscalculated_N_encoding_bytes:
-    return      "EncodeTypeAndValue miscalculated N encoding bytes";
-  case NDN_ERROR_attempt_to_add_a_component_past_the_maximum_number_of_components_allowed_in_the_name:
-    return      "Attempt to add a component past the maximum number of components allowed in the name";
-  case NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude:
-    return      "Read an entry past the maximum number of entries allowed in the exclude";
-  case NDN_ERROR_findElementEnd_unexpected_close_tag:
-    return      "FindElementEnd unexpected close tag";
-  case NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer:
-    return      "Cannot store more header bytes than the size of headerBuffer";
-  case NDN_ERROR_findElementEnd_cannot_read_header_type_and_value:
-    return      "FindElementEnd cannot read header type and value";
-  case NDN_ERROR_findElementEnd_unrecognized_header_type:
-    return      "FindElementEnd unrecognized header type";
-  case NDN_ERROR_findElementEnd_unrecognized_state:
-    return      "FindElementEnd unrecognized state";
-  case NDN_ERROR_DynamicUInt8Array_realloc_function_pointer_not_supplied:
-    return      "DynamicUInt8Array realloc function pointer not supplied";
-  case NDN_ERROR_DynamicUInt8Array_realloc_failed:
-    return      "DynamicUInt8Array realloc failed";
-  case NDN_ERROR_unrecognized_ndn_ExcludeType:
-    return      "Unrecognized ndn_ExcludeType";
-  case NDN_ERROR_unrecognized_ndn_ContentType:
-    return      "Unrecognized ndn_ContentType";
-  case NDN_ERROR_unrecognized_ndn_KeyLocatorType:
-    return      "Unrecognized ndn_KeyLocatorType";
-  case NDN_ERROR_unrecognized_ndn_KeyNameType:
-    return      "Unrecognized ndn_KeyNameType";
-  case NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_locator_type:
-    return      "decodeBinaryXmlKeyLocator unrecognized key locator type";
-  case NDN_ERROR_unrecognized_ndn_SocketTransport:
-    return      "Unrecognized ndn_SocketTransport";
-  case NDN_ERROR_SocketTransport_error_in_getaddrinfo:
-    return      "SocketTransport error in getaddrinfo";
-  case NDN_ERROR_SocketTransport_cannot_connect_to_socket:
-    return      "SocketTransport cannot connect to socket";
-  case NDN_ERROR_SocketTransport_socket_is_not_open:
-    return      "SocketTransport socket is not open";
-  case NDN_ERROR_SocketTransport_error_in_send:
-    return      "SocketTransport error in send";
-  case NDN_ERROR_SocketTransport_error_in_poll:
-    return      "SocketTransport error in poll";
-  case NDN_ERROR_SocketTransport_error_in_recv:
-    return      "SocketTransport error in recv";
-  case NDN_ERROR_SocketTransport_error_in_close:
-    return      "SocketTransport error in close";
-  case NDN_ERROR_Name_component_does_not_begin_with_the_expected_marker:
-    return      "Name component does not begin with the expected marker";
-  case NDN_ERROR_Time_functions_are_not_supported_by_the_standard_library:
-    return      "Time functions are not supported by the standard library";
-  case NDN_ERROR_Calendar_time_value_out_of_range:
-    return      "Calendar time value out of range";
-  default:
-    return "unrecognized ndn_Error code";  
-  }
-}
diff --git a/src/c/errors.h b/src/c/errors.h
deleted file mode 100644
index 5906aa3..0000000
--- a/src/c/errors.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Define error codes and ndn_getErrorString to convert to a string.
- * Copyright (C) 2013 Regents of the University of California.
- * @author, Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_ERRORS_H
-#define NDN_ERRORS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-  NDN_ERROR_success = 0,
-  NDN_ERROR_element_of_value_is_not_a_decimal_digit,
-  NDN_ERROR_read_past_the_end_of_the_input,
-  NDN_ERROR_the_first_header_octet_may_not_be_zero,
-  NDN_ERROR_header_type_is_not_a_DTAG,
-  NDN_ERROR_did_not_get_the_expected_DTAG,
-  NDN_ERROR_did_not_get_the_expected_element_close,
-  NDN_ERROR_item_is_not_UDATA,
-  NDN_ERROR_header_type_is_out_of_range,
-  NDN_ERROR_encodeTypeAndValue_miscalculated_N_encoding_bytes,
-  NDN_ERROR_attempt_to_add_a_component_past_the_maximum_number_of_components_allowed_in_the_name,
-  NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude,
-  NDN_ERROR_findElementEnd_unexpected_close_tag,
-  NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer,
-  NDN_ERROR_findElementEnd_cannot_read_header_type_and_value,
-  NDN_ERROR_findElementEnd_unrecognized_header_type,
-  NDN_ERROR_findElementEnd_unrecognized_state,
-  NDN_ERROR_DynamicUInt8Array_realloc_function_pointer_not_supplied,
-  NDN_ERROR_DynamicUInt8Array_realloc_failed,
-  NDN_ERROR_unrecognized_ndn_ExcludeType,
-  NDN_ERROR_unrecognized_ndn_ContentType,
-  NDN_ERROR_unrecognized_ndn_KeyLocatorType,
-  NDN_ERROR_unrecognized_ndn_KeyNameType,
-  NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_locator_type,
-  NDN_ERROR_unrecognized_ndn_SocketTransport,
-  NDN_ERROR_SocketTransport_error_in_getaddrinfo,
-  NDN_ERROR_SocketTransport_cannot_connect_to_socket,
-  NDN_ERROR_SocketTransport_socket_is_not_open,
-  NDN_ERROR_SocketTransport_error_in_send,
-  NDN_ERROR_SocketTransport_error_in_poll,
-  NDN_ERROR_SocketTransport_error_in_recv,
-  NDN_ERROR_SocketTransport_error_in_close,
-  NDN_ERROR_Name_component_does_not_begin_with_the_expected_marker,
-  NDN_ERROR_Time_functions_are_not_supported_by_the_standard_library,
-  NDN_ERROR_Calendar_time_value_out_of_range
-} ndn_Error;
-  
-/**
- * Convert the error code to its string.
- * @param error the error code
- * @return the error string or "unrecognized ndn_Error code"
- */
-char *ndn_getErrorString(int error);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/forwarding-entry.h b/src/c/forwarding-entry.h
deleted file mode 100644
index 38ead4c..0000000
--- a/src/c/forwarding-entry.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_FORWARDING_ENTRY_H
-#define NDN_FORWARDING_ENTRY_H
-
-#include <ndn-cpp-dev/c/common.h>
-#include <ndn-cpp-dev/c/forwarding-flags.h>
-#include "name.h"
-#include "publisher-public-key-digest.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-  ndn_ForwardingEntryFlags_ACTIVE         = 1,
-  ndn_ForwardingEntryFlags_CHILD_INHERIT  = 2,
-  ndn_ForwardingEntryFlags_ADVERTISE      = 4,
-  ndn_ForwardingEntryFlags_LAST           = 8,
-  ndn_ForwardingEntryFlags_CAPTURE       = 16,
-  ndn_ForwardingEntryFlags_LOCAL         = 32,
-  ndn_ForwardingEntryFlags_TAP           = 64,
-  ndn_ForwardingEntryFlags_CAPTURE_OK   = 128
-} ndn_ForwardingEntryFlags;
-
-/**
- * An ndn_ForwardingEntry holds fields for a ForwardingEntry which is used to register a prefix with a hub.
- */
-struct ndn_ForwardingEntry {
-  struct ndn_Blob action;   /**< A Blob whose value is a pointer to a pre-allocated buffer.  0 for none. */
-  struct ndn_Name prefix;
-  struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
-  int faceId;               /**< -1 for none. */
-  struct ndn_ForwardingFlags forwardingFlags;
-  int freshnessSeconds;     /**< -1 for none. */
-};
-
-/**
- * Initialize an ndn_ForwardingEntry struct with the pre-allocated prefixNameComponents,
- * and defaults for all the values.
- * @param self pointer to the ndn_Interest struct
- * @param prefixNameComponents the pre-allocated array of ndn_NameComponent
- * @param maxPrefixNameComponents the number of elements in the allocated prefixNameComponents array
- */
-static inline void ndn_ForwardingEntry_initialize
-  (struct ndn_ForwardingEntry *self, struct ndn_NameComponent *prefixNameComponents, size_t maxPrefixNameComponents) 
-{
-  ndn_Blob_initialize(&self->action, 0, 0);
-  ndn_Name_initialize(&self->prefix, prefixNameComponents, maxPrefixNameComponents);
-  ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
-  self->faceId = -1;
-  ndn_ForwardingFlags_initialize(&self->forwardingFlags);
-  self->freshnessSeconds = -1;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/forwarding-flags.c b/src/c/forwarding-flags.c
deleted file mode 100644
index be52a8b..0000000
--- a/src/c/forwarding-flags.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "forwarding-entry.h"
-
-void ndn_ForwardingFlags_initialize(struct ndn_ForwardingFlags *self)
-{
-  self->active = 1;
-  self->childInherit = 1;
-  self->advertise = 0;
-  self->last = 0;
-  self->capture = 0;
-  self->local = 0;
-  self->tap = 0;
-  self->captureOk = 0;
-}
-
-int ndn_ForwardingFlags_getForwardingEntryFlags(struct ndn_ForwardingFlags *self)
-{
-  int result = 0;
-  
-  if (self->active)
-    result |= ndn_ForwardingEntryFlags_ACTIVE;
-  if (self->childInherit)
-    result |= ndn_ForwardingEntryFlags_CHILD_INHERIT;
-  if (self->advertise)
-    result |= ndn_ForwardingEntryFlags_ADVERTISE;
-  if (self->last)
-    result |= ndn_ForwardingEntryFlags_LAST;
-  if (self->capture)
-    result |= ndn_ForwardingEntryFlags_CAPTURE;
-  if (self->local)
-    result |= ndn_ForwardingEntryFlags_LOCAL;
-  if (self->tap)
-    result |= ndn_ForwardingEntryFlags_TAP;
-  if (self->captureOk)
-    result |= ndn_ForwardingEntryFlags_CAPTURE_OK;
-  
-  return result;
-}
-
-void ndn_ForwardingFlags_setForwardingEntryFlags(struct ndn_ForwardingFlags *self, int forwardingEntryFlags)
-{
-  self->active = (forwardingEntryFlags & ndn_ForwardingEntryFlags_ACTIVE) ? 1 : 0;
-  self->childInherit = (forwardingEntryFlags & ndn_ForwardingEntryFlags_CHILD_INHERIT) ? 1 : 0;
-  self->advertise = (forwardingEntryFlags & ndn_ForwardingEntryFlags_ADVERTISE) ? 1 : 0;
-  self->last = (forwardingEntryFlags & ndn_ForwardingEntryFlags_LAST) ? 1 : 0;
-  self->capture = (forwardingEntryFlags & ndn_ForwardingEntryFlags_CAPTURE) ? 1 : 0;
-  self->local = (forwardingEntryFlags & ndn_ForwardingEntryFlags_LOCAL) ? 1 : 0;
-  self->tap = (forwardingEntryFlags & ndn_ForwardingEntryFlags_TAP) ? 1 : 0;
-  self->captureOk = (forwardingEntryFlags & ndn_ForwardingEntryFlags_CAPTURE_OK) ? 1 : 0;
-}
diff --git a/src/c/interest.c b/src/c/interest.c
deleted file mode 100644
index 44c3ff6..0000000
--- a/src/c/interest.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "util/ndn_memory.h"
-#include "interest.h"
-
-int ndn_Exclude_compareComponents(struct ndn_NameComponent *component1, struct ndn_NameComponent *component2)
-{
-  if (component1->value.length < component2->value.length)
-    return -1;
-  if (component1->value.length > component2->value.length)
-    return 1;
-
-  // The components are equal length.  Just do a byte compare.  
-  return ndn_memcmp(component1->value.value, component2->value.value, component1->value.length);
-}
-
-int ndn_Exclude_matches(struct ndn_Exclude *self, struct ndn_NameComponent *component)
-{
-  size_t i;
-  for (i = 0; i < self->nEntries; ++i) {
-    if (self->entries[i].type == ndn_Exclude_ANY) {
-      struct ndn_ExcludeEntry *lowerBound = 0;
-      if (i > 0)
-        lowerBound = self->entries + (i - 1);
-      
-      // Find the upper bound, possibly skipping over multiple ANY in a row.
-      size_t iUpperBound;
-      struct ndn_ExcludeEntry *upperBound = 0;
-      for (iUpperBound = i + 1; iUpperBound < self->nEntries; ++iUpperBound) {
-        if (self->entries[iUpperBound].type == ndn_Exclude_COMPONENT) {
-          upperBound = self->entries + iUpperBound;
-          break;
-        }
-      }
-      
-      // If lowerBound != 0, we already checked component equals lowerBound on the last pass.
-      // If upperBound != 0, we will check component equals upperBound on the next pass.
-      if (upperBound != 0) {
-        if (lowerBound != 0) {
-          if (ndn_Exclude_compareComponents(component, &lowerBound->component) > 0 &&
-              ndn_Exclude_compareComponents(component, &upperBound->component) < 0)
-            return 1;
-        }
-        else {
-          if (ndn_Exclude_compareComponents(component, &upperBound->component) < 0)
-            return 1;
-        }
-        
-        // Make i equal iUpperBound on the next pass.
-        i = iUpperBound - 1;
-      }
-      else {
-        if (lowerBound != 0) {
-          if (ndn_Exclude_compareComponents(component, &lowerBound->component) > 0)
-            return 1;
-        }
-        else
-          // this.values has only ANY.
-          return 1;
-      }
-    }
-    else {
-      if (ndn_Exclude_compareComponents(component, &self->entries[i].component) == 0)
-        return 1;
-    }
-  }
-  
-  return 0;  
-}
-
-int ndn_Interest_matchesName(struct ndn_Interest *self, struct ndn_Name *name)
-{
-  if (!ndn_Name_match(&self->name, name))
-    return 0;
-  
-  if (self->minSuffixComponents >= 0 &&
-    // Add 1 for the implicit digest.
-    !(name->nComponents + 1 - self->name.nComponents >= self->minSuffixComponents))
-    return 0;
-  if (self->maxSuffixComponents >= 0 &&
-    // Add 1 for the implicit digest.
-    !(name->nComponents + 1 - self->name.nComponents <= self->maxSuffixComponents))
-    return 0;
-  if (self->exclude.nEntries > 0 && name->nComponents > self->name.nComponents &&
-      ndn_Exclude_matches(&self->exclude, name->components + self->name.nComponents))
-    return 0;
-  
-  return 1; 
-}
diff --git a/src/c/interest.h b/src/c/interest.h
deleted file mode 100644
index 8f0a587..0000000
--- a/src/c/interest.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_INTEREST_H
-#define NDN_INTEREST_H
-
-#include <ndn-cpp-dev/c/interest-types.h>
-#include "name.h"
-#include "publisher-public-key-digest.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * An ndn_ExcludeEntry holds an ndn_ExcludeType, and if it is a COMPONENT, it holds a pointer to the component value.
- */
-struct ndn_ExcludeEntry {
-  ndn_ExcludeType type;
-  struct ndn_NameComponent component;
-};
-
-/**
- * 
- * @param self pointer to the ndn_NameComponent struct
- * @param type one of the ndn_ExcludeType enum
- * @param component the pre-allocated buffer for the component value, only used if type is ndn_Exclude_COMPONENT
- * @param componentLength the number of bytes in value, only used if type is ndn_Exclude_COMPONENT
- */
-static inline void ndn_ExcludeEntry_initialize(struct ndn_ExcludeEntry *self, ndn_ExcludeType type, uint8_t *component, size_t componentLength) 
-{
-  self->type = type;
-  ndn_NameComponent_initialize(&self->component, component, componentLength);
-}
-
-/**
- * An ndn_Exclude holds an array of ndn_ExcludeEntry.
- */
-struct ndn_Exclude {
-  struct ndn_ExcludeEntry *entries;  /**< pointer to the array of entries. */
-  size_t maxEntries;                 /**< the number of elements in the allocated entries array */
-  size_t nEntries;                   /**< the number of entries in the exclude, 0 for no exclude */
-};
-/**
- * Initialize an ndn_Exclude struct with the entries array.
- * @param self A pointer to the ndn_Exclude struct.
- * @param entries the pre-allocated array of ndn_ExcludeEntry
- * @param maxEntries the number of elements in the allocated entries array
- */
-static inline void ndn_Exclude_initialize(struct ndn_Exclude *self, struct ndn_ExcludeEntry *entries, size_t maxEntries) 
-{
-  self->entries = entries;
-  self->maxEntries = maxEntries;
-  self->nEntries = 0;
-}
-
-/**
- * Compare the components using NDN component ordering.
- * A component is less if it is shorter, otherwise if equal length do a byte comparison.
- * @param component1 A pointer to the first name component.
- * @param component2 A pointer to the second name component.
- * @return -1 if component1 is less than component2, 1 if greater or 0 if equal.
- */
-int ndn_Exclude_compareComponents(struct ndn_NameComponent *component1, struct ndn_NameComponent *component2);
-
-/**
- * Check if the component matches any of the exclude criteria.
- * @param self A pointer to the ndn_Exclude struct.
- * @param component A pointer to the name component to check.
- * @return 1 if the component matches any of the exclude criteria, otherwise 0.
- */
-int ndn_Exclude_matches(struct ndn_Exclude *self, struct ndn_NameComponent *component);
-
-/**
- * An ndn_Interest holds an ndn_Name and other fields for an interest.
- */
-struct ndn_Interest {
-  struct ndn_Name name;
-  int minSuffixComponents;  /**< -1 for none */
-  int maxSuffixComponents;  /**< -1 for none */
-  struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
-  struct ndn_Exclude exclude;
-  int childSelector;        /**< -1 for none */
-  int answerOriginKind;     /**< -1 for none */
-  int scope;                /**< -1 for none */
-  ndn_Milliseconds interestLifetimeMilliseconds; /**< milliseconds. -1.0 for none */
-  struct ndn_Blob nonce;    /**< The blob whose value is a pointer to a pre-allocated buffer.  0 for none */
-};
-
-/**
- * Initialize an ndn_Interest struct with the pre-allocated nameComponents and excludeEntries,
- * and defaults for all the values.
- * @param self pointer to the ndn_Interest struct
- * @param nameComponents the pre-allocated array of ndn_NameComponent
- * @param maxNameComponents the number of elements in the allocated nameComponents array
- * @param excludeEntries the pre-allocated array of ndn_ExcludeEntry
- * @param maxExcludeEntries the number of elements in the allocated excludeEntries array
- */
-static inline void ndn_Interest_initialize
-  (struct ndn_Interest *self, struct ndn_NameComponent *nameComponents, size_t maxNameComponents,
-   struct ndn_ExcludeEntry *excludeEntries, size_t maxExcludeEntries) 
-{
-  ndn_Name_initialize(&self->name, nameComponents, maxNameComponents);
-  self->minSuffixComponents = -1;
-  self->maxSuffixComponents = -1;
-  ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
-  ndn_Exclude_initialize(&self->exclude, excludeEntries, maxExcludeEntries);
-  self->childSelector = -1;
-  self->answerOriginKind = -1;
-  self->scope = -1;
-  self->interestLifetimeMilliseconds = -1.0;
-  ndn_Blob_initialize(&self->nonce, 0, 0);
-}
-
-/**
- * Check if self's name matches the given name (using ndn_Name_match) and the given name also conforms to the 
- * interest selectors.
- * @param self A pointer to the ndn_Interest struct.
- * @param name A pointer to the name to check.
- * @return 1 if the name and interest selectors match, 0 otherwise.
- */
-int ndn_Interest_matchesName(struct ndn_Interest *self, struct ndn_Name *name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/c/key-locator.h b/src/c/key-locator.h
deleted file mode 100644
index 1275ba9..0000000
--- a/src/c/key-locator.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_KEY_LOCATOR_H
-#define NDN_KEY_LOCATOR_H
-
-#include <ndn-cpp-dev/c/key-types.h>
-#include "name.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * An ndn_KeyLocator holds the type of key locator and related data.
- */
-struct ndn_KeyLocator {
-  ndn_KeyLocatorType type;     /**< -1 for none */
-  struct ndn_Blob keyData;            /**< A Blob whose value is a pointer to a pre-allocated buffer for the key data as follows:
-    *   If type is ndn_KeyLocatorType_KEY, the key data.
-    *   If type is ndn_KeyLocatorType_CERTIFICATE, the certificate data. 
-    *   If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST, the publisher public key digest. 
-    *   If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_CERTIFICATE_DIGEST, the publisher certificate digest. 
-    *   If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST, the publisher issuer key digest. 
-    *   If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST, the publisher issuer certificate digest. 
-    */
-  struct ndn_Name keyName;     /**< The key name (only used if type is ndn_KeyLocatorType_KEYNAME.) */
-  ndn_KeyNameType keyNameType; /**< The type of data for keyName, -1 for none. (only used if type is ndn_KeyLocatorType_KEYNAME.) */
-};
-
-/**
- * Initialize an ndn_KeyLocator struct with the pre-allocated nameComponents, and defaults for all the values.
- * @param self A pointer to the ndn_KeyLocator struct.
- * @param keyNameComponents The pre-allocated array of ndn_NameComponent.
- * @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
- */
-static inline void ndn_KeyLocator_initialize
-  (struct ndn_KeyLocator *self, struct ndn_NameComponent *keyNameComponents, size_t maxKeyNameComponents) {
-  self->type = (ndn_KeyLocatorType)-1;
-  ndn_Blob_initialize(&self->keyData, 0, 0);
-  ndn_Name_initialize(&self->keyName, keyNameComponents, maxKeyNameComponents);
-  self->keyNameType = (ndn_KeyNameType)-1;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/name.c b/src/c/name.c
deleted file mode 100644
index 147d583..0000000
--- a/src/c/name.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include <string.h>
-#include "util/ndn_memory.h"
-#include "name.h"
-
-uint64_t ndn_NameComponent_toNumber(struct ndn_NameComponent *self)
-{
-  uint64_t result = 0;
-  size_t i;
-  for (i = 0; i < self->value.length; ++i) {
-    result *= 256;
-    result += (uint64_t)self->value.value[i];
-  }
-  
-  return result;
-}
-
-ndn_Error ndn_NameComponent_toNumberWithMarker(struct ndn_NameComponent *self, uint8_t marker, uint64_t *result)
-{
-  if (self->value.length == 0 || self->value.value[0] != marker)
-    return NDN_ERROR_Name_component_does_not_begin_with_the_expected_marker;
-  
-  uint64_t localResult = 0;
-  size_t i;
-  for (i = 1; i < self->value.length; ++i) {
-    localResult *= 256;
-    localResult += (uint64_t)self->value.value[i];
-  }
-  
-  *result = localResult;
-  return NDN_ERROR_success;
-}
-
-int ndn_Name_match(struct ndn_Name *self, struct ndn_Name *name)
-{
-  // This name is longer than the name we are checking it against.
-  if (self->nComponents > name->nComponents)
-    return 0;
-
-  // Check if at least one of given components doesn't match.
-  size_t i;
-  for (i = 0; i < self->nComponents; ++i) {
-    struct ndn_NameComponent *selfComponent = self->components + i;
-    struct ndn_NameComponent *nameComponent = name->components + i;
-
-    if (selfComponent->value.length != nameComponent->value.length ||
-        ndn_memcmp(selfComponent->value.value, nameComponent->value.value, selfComponent->value.length) != 0)
-      return 0;
-  }
-
-  return 1;
-}
-
-ndn_Error ndn_Name_appendComponent(struct ndn_Name *self, uint8_t* value, size_t valueLength)
-{
-  if (self->nComponents >= self->maxComponents)
-      return NDN_ERROR_attempt_to_add_a_component_past_the_maximum_number_of_components_allowed_in_the_name;
-  ndn_NameComponent_initialize(self->components + self->nComponents, value, valueLength);
-  ++self->nComponents;
-      
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_Name_appendString(struct ndn_Name *self, char* value)
-{
-  return ndn_Name_appendComponent(self, (uint8_t*)value, strlen(value));
-}
diff --git a/src/c/name.h b/src/c/name.h
deleted file mode 100644
index c28f1b1..0000000
--- a/src/c/name.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_NAME_H
-#define NDN_NAME_H
-
-#include <ndn-cpp-dev/c/common.h>
-#include "errors.h"
-#include "util/blob.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-  
-/**
- * An ndn_NameComponent holds a pointer to the component value.
- */
-struct ndn_NameComponent {
-  struct ndn_Blob value;     /**< A Blob with a pointer to the pre-allocated buffer for the component value */
-};
-
-/**
- * 
- * @param self pointer to the ndn_NameComponent struct
- * @param value the pre-allocated buffer for the component value
- * @param valueLength the number of bytes in value
- */
-static inline void ndn_NameComponent_initialize(struct ndn_NameComponent *self, uint8_t *value, size_t valueLength) 
-{
-  ndn_Blob_initialize(&self->value, value, valueLength);
-}
-
-/**
- * Interpret the name component as a network-ordered number and return an integer.
- * @param self A pointer to the ndn_NameComponent struct.
- * @return The integer number.
- */
-uint64_t ndn_NameComponent_toNumber(struct ndn_NameComponent *self);
-
-/**
- * Interpret the name component as a network-ordered number with a marker and return an integer.
- * @param self A pointer to the ndn_NameComponent struct.
- * @param marker The required first byte of the component.
- * @param result Return the integer number.
- * @return 0 for success, or an error code if the first byte of the component does not equal the marker.
- */
-ndn_Error ndn_NameComponent_toNumberWithMarker(struct ndn_NameComponent *self, uint8_t marker, uint64_t *result);
-
-/**
- * An ndn_Name holds an array of ndn_NameComponent.
- */
-struct ndn_Name {
-  struct ndn_NameComponent *components; /**< pointer to the array of components. */
-  size_t maxComponents;                 /**< the number of elements in the allocated components array */
-  size_t nComponents;                   /**< the number of components in the name */
-};
-
-/**
- * Initialize an ndn_Name struct with the components array.
- * @param self pointer to the ndn_Name struct
- * @param components the pre-allocated array of ndn_NameComponent
- * @param maxComponents the number of elements in the allocated components array
- */
-static inline void ndn_Name_initialize(struct ndn_Name *self, struct ndn_NameComponent *components, size_t maxComponents) 
-{
-  self->components = components;
-  self->maxComponents = maxComponents;
-  self->nComponents = 0;
-}
-
-/**
- * Return true if the N components of this name are the same as the first N components of the given name.
- * @param self A pointer to the ndn_Name struct.
- * @param name A pointer to the other name to match.
- * @return 1 if this matches the given name, 0 otherwise.  This always returns 1 if this name is empty.
- */
-int ndn_Name_match(struct ndn_Name *self, struct ndn_Name *name);
-
-/**
- * Append a component to this name with the bytes in the given array.
- * @param self pointer to the ndn_Name struct.
- * @param value The bytes of the component.  This does not copy the bytes.
- * @param valueLength The number of bytes in value.
- * @return 0 for success, or an error code if there is no more room in the components array (nComponents is already maxComponents).
- */
-ndn_Error ndn_Name_appendComponent(struct ndn_Name *self, uint8_t* value, size_t valueLength);
-
-/**
- * Append a component to this name with the bytes in the given blob.
- * @param self pointer to the ndn_Name struct.
- * @param value An ndn_Blob with the bytes of the component.  This does not copy the bytes.
- * @return 0 for success, or an error code if there is no more room in the components array (nComponents is already maxComponents).
- */
-static inline ndn_Error ndn_Name_appendBlob(struct ndn_Name *self, struct ndn_Blob *value)
-{
-  return ndn_Name_appendComponent(self, value->value, value->length);
-}
-
-/**
- * Append a component to this name with the bytes in raw string value.
- * @param self pointer to the ndn_Name struct.
- * @param value The null-terminated string, treated as a byte array.  This does not copy the bytes.
- * @return 0 for success, or an error code if there is no more room in the components array (nComponents is already maxComponents).
- */
-ndn_Error ndn_Name_appendString(struct ndn_Name *self, char* value);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/c/publisher-public-key-digest.h b/src/c/publisher-public-key-digest.h
deleted file mode 100644
index 771ac32..0000000
--- a/src/c/publisher-public-key-digest.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_PUBLISHERPUBLICKEYDIGEST_H
-#define NDN_PUBLISHERPUBLICKEYDIGEST_H
-
-#include <ndn-cpp-dev/c/common.h>
-#include "util/blob.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * A PublisherPublicKeyDigest holds a pointer to the publisher public key digest value, if any.
- * We make a separate struct since this is used by multiple other structs.
- */
-struct ndn_PublisherPublicKeyDigest {
-  struct ndn_Blob publisherPublicKeyDigest; /**< A Blob whose value is a pointer to pre-allocated buffer.  0 for none */
-};
-
-/**
- * Initialize an ndn_PublisherPublicKeyDigest struct with 0 for none.
- */
-static inline void ndn_PublisherPublicKeyDigest_initialize(struct ndn_PublisherPublicKeyDigest *self)
-{
-  ndn_Blob_initialize(&self->publisherPublicKeyDigest, 0, 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/transport/socket-transport.c b/src/c/transport/socket-transport.c
deleted file mode 100644
index 09a5b57..0000000
--- a/src/c/transport/socket-transport.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "socket-transport.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <netdb.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <poll.h>
-#include "../util/ndn_memory.h"
-
-ndn_Error ndn_SocketTransport_connect(struct ndn_SocketTransport *self, ndn_SocketType socketType, char *host, unsigned short port)
-{
-  if (self->socketDescriptor >= 0) {
-    close(self->socketDescriptor);
-    self->socketDescriptor = -1;
-  }
-  
-  struct addrinfo hints;
-  ndn_memset((uint8_t *)&hints, 0, sizeof(hints));
-  hints.ai_family = AF_UNSPEC;
-  if (socketType == SOCKET_TCP)
-    hints.ai_socktype = SOCK_STREAM;
-  else if (socketType == SOCKET_UDP)
-    hints.ai_socktype = SOCK_DGRAM;
-  else
-    return NDN_ERROR_unrecognized_ndn_SocketTransport;
-
-  char portString[10];
-  sprintf(portString, "%d", port);
-  
-  struct addrinfo *serverInfo;
-  if (getaddrinfo(host, portString, &hints, &serverInfo) != 0)
-    return NDN_ERROR_SocketTransport_error_in_getaddrinfo;
-
-  // loop through all the results and connect to the first we can
-  struct addrinfo *p;
-  int socketDescriptor;
-  for(p = serverInfo; p != NULL; p = p->ai_next) {
-    if ((socketDescriptor = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1)
-      continue;
-
-    if (connect(socketDescriptor, p->ai_addr, p->ai_addrlen) == -1) {
-      close(socketDescriptor);
-      continue;
-    }
-
-    break;
-  }
-
-  if (p == NULL) {
-    freeaddrinfo(serverInfo);
-    return NDN_ERROR_SocketTransport_cannot_connect_to_socket;
-  }
-
-  freeaddrinfo(serverInfo);
-  self->socketDescriptor = socketDescriptor;
-
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_SocketTransport_send(struct ndn_SocketTransport *self, uint8_t *data, size_t dataLength)
-{
-  if (self->socketDescriptor < 0)
-    return NDN_ERROR_SocketTransport_socket_is_not_open;
-  
-  int nBytes;
-  while (1) {
-    if ((nBytes = send(self->socketDescriptor, data, dataLength, 0)) < 0)
-      return NDN_ERROR_SocketTransport_error_in_send;
-    if (nBytes >= dataLength)
-      break;
-    
-    // Send more.
-    dataLength -= nBytes;
-  }
-
-  return NDN_ERROR_success;  
-}
-
-ndn_Error ndn_SocketTransport_receiveIsReady(struct ndn_SocketTransport *self, int *receiveIsReady)
-{
-  // Default to not ready.
-  *receiveIsReady = 0;
-
-  if (self->socketDescriptor < 0)
-    // The socket is not open.  Just silently return.
-    return NDN_ERROR_success;
-  
-  struct pollfd pollInfo[1];
-  pollInfo[0].fd = self->socketDescriptor;
-  pollInfo[0].events = POLLIN;
-  
-  int pollResult = poll(pollInfo, 1, 0);
-
-  if (pollResult < 0)
-    return NDN_ERROR_SocketTransport_error_in_poll;
-  else if (pollResult == 0)
-    // Timeout, so no data ready.
-    return NDN_ERROR_success;
-  else {
-   if (pollInfo[0].revents & POLLIN)
-     *receiveIsReady = 1;
-  }
-
-  return NDN_ERROR_success;
-}
-
-ndn_Error ndn_SocketTransport_receive
-  (struct ndn_SocketTransport *self, uint8_t *buffer, size_t bufferLength, size_t *nBytesOut)
-{
-  if (self->socketDescriptor < 0)
-    return NDN_ERROR_SocketTransport_socket_is_not_open;
-
-  int nBytes;  
-  if ((nBytes = recv(self->socketDescriptor, buffer, bufferLength, 0)) == -1)
-    return NDN_ERROR_SocketTransport_error_in_recv;
-
-  *nBytesOut = (size_t)nBytes;
-  
-  return NDN_ERROR_success;  
-}
-
-ndn_Error ndn_SocketTransport_close(struct ndn_SocketTransport *self)
-{
-  if (self->socketDescriptor < 0)
-    // Already closed.  Do nothing.
-    return NDN_ERROR_success;
-  
-  if (close(self->socketDescriptor) != 0)
-    return NDN_ERROR_SocketTransport_error_in_close;
-  
-  self->socketDescriptor = -1;
-  
-  return NDN_ERROR_success;
-}
diff --git a/src/c/transport/socket-transport.h b/src/c/transport/socket-transport.h
deleted file mode 100644
index d1dbb56..0000000
--- a/src/c/transport/socket-transport.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_SOCKETTRANSPORT_H
-#define NDN_SOCKETTRANSPORT_H
-
-#include <sys/socket.h>
-#include <ndn-cpp-dev/c/common.h>
-#include "../errors.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-  SOCKET_TCP,
-  SOCKET_UDP
-} ndn_SocketType;
-  
-struct ndn_SocketTransport {
-  int socketDescriptor; /**< -1 if not connected */
-};
-  
-/**
- * Initialize the ndn_SocketTransport struct with default values for no connection yet.
- * @param self A pointer to the ndn_SocketTransport struct.
- */
-static inline void ndn_SocketTransport_initialize(struct ndn_SocketTransport *self)
-{
-  self->socketDescriptor = -1;
-}
-
-/**
- * Connect with TCP or UDP to the host:port.
- * @param self A pointer to the ndn_SocketTransport struct.
- * @param socketType SOCKET_TCP or SOCKET_UDP.
- * @param host The host to connect to.
- * @param port The port to connect to.
- * @return 0 for success, else an error code.
- */
-ndn_Error ndn_SocketTransport_connect(struct ndn_SocketTransport *self, ndn_SocketType socketType, char *host, unsigned short port);
-
-/**
- * Send data to the socket.
- * @param self A pointer to the ndn_SocketTransport struct.
- * @param data A pointer to the buffer of data to send.
- * @param dataLength The number of bytes in data.
- * @return 0 for success, else an error code.
- */
-ndn_Error ndn_SocketTransport_send(struct ndn_SocketTransport *self, uint8_t *data, size_t dataLength);
-
-/**
- * Check if there is data ready on the socket to be received with ndn_SocketTransport_receive.
- * This does not block, and returns immediately.
- * @param self A pointer to the ndn_SocketTransport struct.
- * @param receiveIsReady This will be set to 1 if data is ready, 0 if not.
- * @return 0 for success, else an error code.
- */
-ndn_Error ndn_SocketTransport_receiveIsReady(struct ndn_SocketTransport *self, int *receiveIsReady);
-
-/**
- * Receive data from the socket.  NOTE: This is a blocking call.  You should first call ndn_SocketTransport_receiveIsReady
- * to make sure there is data ready to receive.
- * @param self A pointer to the ndn_SocketTransport struct.
- * @param buffer A pointer to the buffer to receive the data.
- * @param bufferLength The maximum length of buffer.
- * @param nBytes Return the number of bytes received into buffer.
- * @return 0 for success, else an error code.
- */
-ndn_Error ndn_SocketTransport_receive
-  (struct ndn_SocketTransport *self, uint8_t *buffer, size_t bufferLength, size_t *nBytes);
-
-/**
- * Close the socket.
- * @param self A pointer to the ndn_SocketTransport struct.
- * @return 0 for success, else an error code.
- */
-ndn_Error ndn_SocketTransport_close(struct ndn_SocketTransport *self);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/transport/tcp-transport.h b/src/c/transport/tcp-transport.h
deleted file mode 100644
index 55f2e8e..0000000
--- a/src/c/transport/tcp-transport.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* 
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_TCPTRANSPORT_H
-#define NDN_TCPTRANSPORT_H
-
-#include "socket-transport.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ndn_TcpTransport {
-  struct ndn_SocketTransport base;
-};
-  
-/**
- * Initialize the ndn_TcpTransport struct with default values for no connection yet.
- * @param self A pointer to the ndn_TcpTransport struct.
- */
-static inline void ndn_TcpTransport_initialize(struct ndn_TcpTransport *self)
-{
-  ndn_SocketTransport_initialize(&self->base);
-}
-
-/**
- * Connect with TCP to the host:port.
- * @param self A pointer to the ndn_TcpTransport struct.
- * @param host The host to connect to.
- * @param port The port to connect to.
- * @return 0 for success, else an error code.
- */
-static inline ndn_Error ndn_TcpTransport_connect(struct ndn_TcpTransport *self, char *host, unsigned short port)
-{
-  return ndn_SocketTransport_connect(&self->base, SOCKET_TCP, host, port);
-}
-
-/**
- * Send data to the socket.
- * @param self A pointer to the ndn_TcpTransport struct.
- * @param data A pointer to the buffer of data to send.
- * @param dataLength The number of bytes in data.
- * @return 0 for success, else an error code.
- */
-static inline ndn_Error ndn_TcpTransport_send(struct ndn_TcpTransport *self, uint8_t *data, size_t dataLength)
-{
-  return ndn_SocketTransport_send(&self->base, data, dataLength);
-}
-
-/**
- * Check if there is data ready on the socket to be received with ndn_TcpTransport_receive.
- * This does not block, and returns immediately.
- * @param self A pointer to the ndn_TcpTransport struct.
- * @param receiveIsReady This will be set to 1 if data is ready, 0 if not.
- * @return 0 for success, else an error code.
- */
-static inline ndn_Error ndn_TcpTransport_receiveIsReady(struct ndn_TcpTransport *self, int *receiveIsReady)
-{
-  return ndn_SocketTransport_receiveIsReady(&self->base, receiveIsReady);
-}
-
-/**
- * Receive data from the socket.  NOTE: This is a blocking call.  You should first call ndn_SocketTransport_receiveIsReady
- * to make sure there is data ready to receive.
- * @param self A pointer to the ndn_TcpTransport struct.
- * @param buffer A pointer to the buffer to receive the data.
- * @param bufferLength The maximum length of buffer.
- * @param nBytes Return the number of bytes received into buffer.
- * @return 0 for success, else an error code.
- */
-static inline ndn_Error ndn_TcpTransport_receive
-  (struct ndn_TcpTransport *self, uint8_t *buffer, size_t bufferLength, size_t *nBytes)
-{
-  return ndn_SocketTransport_receive(&self->base, buffer, bufferLength, nBytes);
-}
-
-/**
- * Close the socket.
- * @param self A pointer to the ndn_TcpTransport struct.
- * @return 0 for success, else an error code.
- */
-static inline ndn_Error ndn_TcpTransport_close(struct ndn_TcpTransport *self)
-{
-  return ndn_SocketTransport_close(&self->base);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/transport/udp-transport.h b/src/c/transport/udp-transport.h
deleted file mode 100644
index 20d106b..0000000
--- a/src/c/transport/udp-transport.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* 
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_UDPTRANSPORT_H
-#define NDN_UDPTRANSPORT_H
-
-#include "socket-transport.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ndn_UdpTransport {
-  struct ndn_SocketTransport base;
-};
-  
-/**
- * Initialize the ndn_UdpTransport struct with default values for no connection yet.
- * @param self A pointer to the ndn_UdpTransport struct.
- */
-static inline void ndn_UdpTransport_initialize(struct ndn_UdpTransport *self)
-{
-  ndn_SocketTransport_initialize(&self->base);
-}
-
-/**
- * Connect with UDP to the host:port.
- * @param self A pointer to the ndn_UdpTransport struct.
- * @param host The host to connect to.
- * @param port The port to connect to.
- * @return 0 for success, else an error code.
- */
-static inline ndn_Error ndn_UdpTransport_connect(struct ndn_UdpTransport *self, char *host, unsigned short port)
-{
-  return ndn_SocketTransport_connect(&self->base, SOCKET_UDP, host, port);
-}
-
-/**
- * Send data to the socket.
- * @param self A pointer to the ndn_UdpTransport struct.
- * @param data A pointer to the buffer of data to send.
- * @param dataLength The number of bytes in data.
- * @return 0 for success, else an error code.
- */
-static inline ndn_Error ndn_UdpTransport_send(struct ndn_UdpTransport *self, uint8_t *data, size_t dataLength)
-{
-  return ndn_SocketTransport_send(&self->base, data, dataLength);
-}
-
-/**
- * Check if there is data ready on the socket to be received with ndn_UdpTransport_receive.
- * This does not block, and returns immediately.
- * @param self A pointer to the ndn_UdpTransport struct.
- * @param receiveIsReady This will be set to 1 if data is ready, 0 if not.
- * @return 0 for success, else an error code.
- */
-static inline ndn_Error ndn_UdpTransport_receiveIsReady(struct ndn_UdpTransport *self, int *receiveIsReady)
-{
-  return ndn_SocketTransport_receiveIsReady(&self->base, receiveIsReady);
-}
-
-/**
- * Receive data from the socket.  NOTE: This is a blocking call.  You should first call ndn_SocketTransport_receiveIsReady
- * to make sure there is data ready to receive.
- * @param self A pointer to the ndn_UdpTransport struct.
- * @param buffer A pointer to the buffer to receive the data.
- * @param bufferLength The maximum length of buffer.
- * @param nBytes Return the number of bytes received into buffer.
- * @return 0 for success, else an error code.
- */
-static inline ndn_Error ndn_UdpTransport_receive
-  (struct ndn_UdpTransport *self, uint8_t *buffer, size_t bufferLength, size_t *nBytes)
-{
-  return ndn_SocketTransport_receive(&self->base, buffer, bufferLength, nBytes);
-}
-
-/**
- * Close the socket.
- * @param self A pointer to the ndn_UdpTransport struct.
- * @return 0 for success, else an error code.
- */
-static inline ndn_Error ndn_UdpTransport_close(struct ndn_UdpTransport *self)
-{
-  return ndn_SocketTransport_close(&self->base);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/util/blob.h b/src/c/util/blob.h
deleted file mode 100644
index 94bbaf9..0000000
--- a/src/c/util/blob.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BLOB_H
-#define NDN_BLOB_H
-
-#include <ndn-cpp-dev/c/common.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * An ndn_Blob holds a pointer to a read-only pre-allocated buffer and its length.
- */
-struct ndn_Blob {
-  uint8_t *value; /**< pointer to the pre-allocated buffer for the value. Must be treated as read only. */
-  size_t length;  /**< the number of bytes in value. */
-};
-
-/**
- * Initialize the ndn_Blob struct with the given value.
- * @param self pointer to the ndn_Blob struct.
- * @param value The pre-allocated buffer for the value, or 0 for none.
- * @param length The number of bytes in value.
- */
-static inline void ndn_Blob_initialize(struct ndn_Blob *self, uint8_t *value, size_t length) 
-{
-  self->value = value;
-  self->length = length;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/util/dynamic-uint8-array.c b/src/c/util/dynamic-uint8-array.c
deleted file mode 100644
index 23bfd7c..0000000
--- a/src/c/util/dynamic-uint8-array.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "dynamic-uint8-array.h"
-
-ndn_Error ndn_DynamicUInt8Array_reallocArray(struct ndn_DynamicUInt8Array *self, size_t length)
-{
-  if (!self->realloc)
-    return NDN_ERROR_DynamicUInt8Array_realloc_function_pointer_not_supplied;
-  
-  // See if double is enough.
-  size_t newLength = self->length * 2;
-  if (length > newLength)
-    // The needed length is much greater, so use it.
-    newLength = length;
-    
-  uint8_t *newArray = (*self->realloc)(self, self->array, newLength);
-  if (!newArray)
-    return NDN_ERROR_DynamicUInt8Array_realloc_failed;
-  
-  self->array = newArray;
-  self->length = newLength;
-  
-  return NDN_ERROR_success;
-}
diff --git a/src/c/util/dynamic-uint8-array.h b/src/c/util/dynamic-uint8-array.h
deleted file mode 100644
index 6548662..0000000
--- a/src/c/util/dynamic-uint8-array.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_DYNAMICUCHARARRAY_H
-#define NDN_DYNAMICUCHARARRAY_H
-
-#include "../errors.h"
-#include "ndn_memory.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ndn_DynamicUInt8Array {
-  uint8_t *array; /**< the allocated array buffer */
-  size_t length;  /**< the length of the allocated array buffer */
-  uint8_t * (*realloc)
-    (struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length); /**< a pointer to a function that reallocates array and returns a new pointer to a buffer of
-                                                                                      * length bytes, or 0 for error.  On success, the contents of the old buffer are copied to the new one.
-                                                                                      * On success, the original array pointer will no longer be used.
-                                                                                      * self is a pointer to the struct ndn_DynamicUInt8Array which is calling realloc.
-                                                                                      * This function pointer may be 0 (which causes an error if a reallocate is necessary). */
-};
-
-/**
- * Initialize an ndn_DynamicUInt8Array struct with the given array buffer.
- * @param self pointer to the ndn_DynamicUInt8Array struct
- * @param array the allocated array buffer
- * @param length the length of the allocated array buffer
- * @param reallocFunction see ndn_DynamicUInt8Array_ensureLength.  This may be 0.
- */
-static inline void ndn_DynamicUInt8Array_initialize
-  (struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length, 
-   uint8_t * (*reallocFunction)(struct ndn_DynamicUInt8Array *self, uint8_t *, size_t)) 
-{
-  self->array = array;
-  self->length = length;
-  self->realloc = reallocFunction;
-}
-
-/**
- * Do the work of ndn_DynamicUInt8Array_ensureLength if realloc is necessary.
- * If the self->realloc function pointer is null, then return an error.
- * If not null, call self->realloc to reallocate self->array, and update self->length (which may be greater than length).
- * @param self pointer to the ndn_DynamicUInt8Array struct
- * @param length the needed minimum size for self->length
- * @return 0 for success, else an error code if can't reallocate the array
- */
-ndn_Error ndn_DynamicUInt8Array_reallocArray(struct ndn_DynamicUInt8Array *self, size_t length);
-
-/**
- * Ensure that self->length is greater than or equal to length.  If it is, just return 0 for success.
- * Otherwise, if the self->realloc function pointer is null, then return an error.
- * If not null, call self->realloc to reallocate self->array, and update self->length (which may be greater than length).
- * @param self pointer to the ndn_DynamicUInt8Array struct
- * @param length the needed minimum size for self->length
- * @return 0 for success, else an error code if need to reallocate the array but can't
- */
-static inline ndn_Error ndn_DynamicUInt8Array_ensureLength(struct ndn_DynamicUInt8Array *self, size_t length) 
-{
-  if (self->length >= length)
-    return NDN_ERROR_success;
-
-  return ndn_DynamicUInt8Array_reallocArray(self, length);
-}
-
-/**
- * Copy value into self->array at offset, using ndn_DynamicUInt8Array_ensureLength to make sure self->array has enough length.
- * @param self pointer to the ndn_DynamicUInt8Array struct
- * @param value the buffer to copy from
- * @param valueLength the length of the value buffer
- * @param offset the offset in self->array to copy to
- * @return 0 for success, else an error code if need to reallocate the array but can't
- */
-static inline ndn_Error ndn_DynamicUInt8Array_set
-  (struct ndn_DynamicUInt8Array *self, uint8_t *value, size_t valueLength, size_t offset) 
-{
-  ndn_Error error;
-  if ((error = ndn_DynamicUInt8Array_ensureLength(self, valueLength + offset)))
-    return error;
-  ndn_memcpy(self->array + offset, value, valueLength);
-  return NDN_ERROR_success;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/c/util/ndn_memory.c b/src/c/util/ndn_memory.c
deleted file mode 100644
index a9c3510..0000000
--- a/src/c/util/ndn_memory.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "ndn_memory.h"
-
-#if !NDN_CPP_HAVE_MEMCMP
-int ndn_memcmp(const uint8_t *buf1, const uint8_t *buf2, size_t len)
-{
-  size_t i;
-  
-  for (i = 0; i < len; i++) {
-    if (buf1[i] > buf2[i])
-      return 1;
-    else if (buf1[i] < buf2[i])
-      return -1;
-  }
-  
-  return 0;
-}
-#else
-int ndn_memcmp_stub_to_avoid_empty_file_warning = 0;
-#endif
-
-#if !NDN_CPP_HAVE_MEMCPY
-void ndn_memcpy(uint8_t *dest, const uint8_t *src, size_t len)
-{
-  size_t i;
-  
-  for (i = 0; i < len; i++)
-    dest[i] = src[i];
-}
-#else
-int ndn_memcpy_stub_to_avoid_empty_file_warning = 0;
-#endif
-
-#if !NDN_CPP_HAVE_MEMSET
-void ndn_memset(uint8_t *dest, int val, size_t len)
-{
-  size_t i;
-  
-  for (i = 0; i < len; i++)
-    dest[i] = (uint8_t)val;
-}
-#else
-int ndn_memset_stub_to_avoid_empty_file_warning = 0;
-#endif
diff --git a/src/c/util/ndn_memory.h b/src/c/util/ndn_memory.h
deleted file mode 100644
index d0779be..0000000
--- a/src/c/util/ndn_memory.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-/*
- * Based on NDN_CPP_HAVE_MEMCPY and NDN_CPP_HAVE_MEMSET in ndn-cpp-config.h, use the library version or a local implementation of memcmp, memcpy and memset.
- */
-
-#ifndef NDN_MEMORY_H
-#define NDN_MEMORY_H
-
-#include <ndn-cpp-dev/c/common.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if NDN_CPP_HAVE_MEMCMP
-#include <memory.h>
-/**
- * Use the library version of memcmp.
- */
-static inline int ndn_memcmp(const uint8_t *buf1, const uint8_t *buf2, size_t len) { return memcmp(buf1, buf2, len); }
-#else
-/**
- * Use a local implementation of memcmp instead of the library version.
- */
-int ndn_memcmp(const uint8_t *buf1, const uint8_t *buf2, size_t len);
-#endif
-
-#if NDN_CPP_HAVE_MEMCPY
-#include <memory.h>
-/**
- * Use the library version of memcpy.
- */
-static inline void ndn_memcpy(uint8_t *dest, const uint8_t *src, size_t len) { memcpy(dest, src, len); }
-#else
-/**
- * Use a local implementation of memcpy instead of the library version.
- */
-void ndn_memcpy(uint8_t *dest, const uint8_t *src, size_t len);
-#endif
-
-#if NDN_CPP_HAVE_MEMSET
-#include <memory.h>
-/**
- * Use the library version of memset.
- */
-static inline void ndn_memset(uint8_t *dest, int val, size_t len) { memset(dest, val, len); }
-#else
-/**
- * Use a local implementation of memset instead of the library version.
- */
-void ndn_memset(uint8_t *dest, int val, size_t len);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/c/util/ndn_realloc.c b/src/c/util/ndn_realloc.c
deleted file mode 100644
index f3147f4..0000000
--- a/src/c/util/ndn_realloc.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include <stdlib.h>
-#include "ndn_realloc.h"
-
-uint8_t *ndn_realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length)
-{
-  return (uint8_t *)realloc(array, length);
-}
diff --git a/src/c/util/ndn_realloc.h b/src/c/util/ndn_realloc.h
deleted file mode 100644
index 7aeb6af..0000000
--- a/src/c/util/ndn_realloc.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_NDN_REALLOC_H
-#define NDN_NDN_REALLOC_H
-
-#include "dynamic-uint8-array.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Wrap the C stdlib realloc to convert to/from void * to uint8_t *.
- * This can be used by ndn_DynamicUInt8Array_initialize.
- * @param self This is ignored.
- * @param array the allocated array buffer to realloc.
- * @param length the length for the new array buffer.
- * @return the new allocated array buffer.
- */
-uint8_t *ndn_realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/c/util/time.h b/src/c/util/time.h
deleted file mode 100644
index 674ef21..0000000
--- a/src/c/util/time.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_TIME_H
-#define NDN_TIME_H
-
-#include <ndn-cpp-dev/c/common.h>
-#include "../errors.h"
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-/**
- * Use gettimeofday to return the current time in milliseconds.
- * @return The current time in milliseconds since 1/1/1970, including fractions of a millisecond according to timeval.tv_usec.
- */
-ndn_MillisecondsSince1970 
-ndn_getNowMilliseconds();
-
-/**
- * Convert the time from milliseconds to an ISO time string, for example "20131018T184138.423355".
- * @param milliseconds The time in milliseconds since 1/1/1970, including fractions of a millisecond.
- * @param isoString A buffer of at least 23 bytes to receive the null-terminated ISO time string.
- * @return 0 for success, else an error code including if we don't have necessary standard library support.
- */
-ndn_Error
-ndn_toIsoString(ndn_MillisecondsSince1970 milliseconds, char *isoString);
-
-/**
- * Parse the ISO time string and return the time in milliseconds.
- * @param isoString The ISO time string, for example "20131018T184138.423355".
- * @param milliseconds Return the time in milliseconds since 1/1/1970, including fractions of a millisecond.
- * @return 0 for success, else an error code including if we don't have necessary standard library support.
- */
-ndn_Error
-ndn_fromIsoString(const char* isoString, ndn_MillisecondsSince1970 *milliseconds);
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/encoding/binary-xml-decoder.hpp b/src/encoding/binary-xml-decoder.hpp
deleted file mode 100644
index e7583e5..0000000
--- a/src/encoding/binary-xml-decoder.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLDECODER_HPP
-#define NDN_BINARYXMLDECODER_HPP
-
-#include <stdexcept>
-#include "../c/errors.h"
-#include "../c/encoding/binary-xml-decoder.h"
-
-using namespace std;
-
-namespace ndn {
-  
-/**
- * A BinaryXmlDecoder extends a C ndn_BinaryXmlDecoder struct and wraps related functions.
- */
-class BinaryXmlDecoder : public ndn_BinaryXmlDecoder {
-public:
-  /**
-   * Initialize the base ndn_BinaryXmlDecoder struct with the input.
-   */
-  BinaryXmlDecoder(const uint8_t *input, size_t inputLength) 
-  {
-    ndn_BinaryXmlDecoder_initialize(this, (uint8_t *)input, inputLength);
-  }
-  
-  /**
-   * Decode the header from the input starting at offset, and if it is a DTAG where the value is the expectedTag,
-   * then return true, else false.  Do not update offset, including if throwing an exception.
-   * @param expectedTag the expected value for DTAG
-   * @return true if got the expected tag, else false
-   */
-  bool 
-  peekDTag(unsigned int expectedTag) 
-  {
-    int gotExpectedTag;
-    ndn_Error error;
-    if ((error = ndn_BinaryXmlDecoder_peekDTag(this, expectedTag, &gotExpectedTag)))
-      throw runtime_error(ndn_getErrorString(error));
-    
-    return gotExpectedTag;
-  }
-};
-
-}
-
-#endif
diff --git a/src/encoding/binary-xml-encoder.hpp b/src/encoding/binary-xml-encoder.hpp
deleted file mode 100644
index 6ae3913..0000000
--- a/src/encoding/binary-xml-encoder.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLENCODER_HPP
-#define NDN_BINARYXMLENCODER_HPP
-
-#include <vector>
-#include <ndn-cpp-dev/common.hpp>
-#include "../util/dynamic-uint8-vector.hpp"
-#include "../c/encoding/binary-xml-encoder.h"
-
-namespace ndn {
-  
-/**
- * A BinaryXmlEncoder extends a C ndn_BinaryXmlEncoder struct and wraps related functions.
- */
-class BinaryXmlEncoder : public ndn_BinaryXmlEncoder {
-public:
-  /**
-   * Initialize the base ndn_BinaryXmlEncoder struct with the initialLength.  Use simpleRealloc.
-   * @param initialLength The initial size of the output.  If omitted, use 16.
-   */
-  BinaryXmlEncoder(size_t initialLength = 16) 
-  : output_(16)
-  {
-    ndn_BinaryXmlEncoder_initialize(this, &output_);
-  }
-  
-  /**
-   * Resize the output vector to the correct encoding length and return.
-   * @return The encoding as a shared_ptr.  Assume that the caller now owns the vector.
-   */
-  const ptr_lib::shared_ptr<std::vector<uint8_t> >& 
-  getOutput() 
-  {
-    output_.get()->resize(offset);
-    return output_.get();
-  }
-  
-  DynamicUInt8Vector output_;
-};
-
-}
-
-#endif
diff --git a/src/encoding/binary-xml-structure-decoder.hpp b/src/encoding/binary-xml-structure-decoder.hpp
deleted file mode 100644
index 2707763..0000000
--- a/src/encoding/binary-xml-structure-decoder.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLSTRUCTUREDECODER_HPP
-#define NDN_BINARYXMLSTRUCTUREDECODER_HPP
-
-#include <stdexcept>
-#include "../c/encoding/BinaryXMLStructureDecoder.h"
-
-namespace ndn {
-  
-/**
- * A BinaryXmlStructureDecoder extends a C ndn_BinaryXmlStructureDecoder struct and wraps related functions.
- */
-class BinaryXmlStructureDecoder : private ndn_BinaryXmlStructureDecoder {
-public:
-  BinaryXmlStructureDecoder() 
-  {
-    ndn_BinaryXmlStructureDecoder_initialize(this);
-  }
-  
-  /**
-   * Continue scanning input starting from getOffset() to find the element end.  
-   * If the end of the element which started at offset 0 is found, then return true and getOffset() is the length of 
-   *   the element.  Otherwise return false, which means you should read more into input and call again.
-   * @param input the input buffer. You have to pass in input each time because the buffer could be reallocated.
-   * @param inputLength the number of bytes in input.
-   * @return true if found the element end, false if need to read more. (This is the same as returning gotElementEnd().)
-   */
-  bool 
-  findElementEnd(uint8_t *input, size_t inputLength) 
-  {
-    ndn_Error error;
-    if ((error = ndn_BinaryXmlStructureDecoder_findElementEnd(this, input, inputLength)))
-      throw runtime_error(ndn_getErrorString(error));
-    return gotElementEnd();
-  }
-  
-  size_t 
-  getOffset() const { return offset; }
-  
-  bool 
-  gotElementEnd() const { return gotElementEnd != 0; }
-};
-
-}
-
-#endif
diff --git a/src/encoding/binary-xml-wire-format.cpp b/src/encoding/binary-xml-wire-format.cpp
deleted file mode 100644
index dce8b7b..0000000
--- a/src/encoding/binary-xml-wire-format.cpp
+++ /dev/null
@@ -1,336 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include <stdexcept>
-#include <ndn-cpp-dev/interest.hpp>
-#include <ndn-cpp-dev/data.hpp>
-#include <ndn-cpp-dev/forwarding-entry.hpp>
-#include <ndn-cpp-dev/encoding/binary-xml-wire-format.hpp>
-#include "../c/encoding/binary-xml-interest.h"
-#include "../c/encoding/binary-xml-data.h"
-#include "../c/encoding/binary-xml-forwarding-entry.h"
-#include "binary-xml-encoder.hpp"
-#include "binary-xml-decoder.hpp"
-
-using namespace std;
-
-namespace ndn {
-
-namespace c {
-
-class Exclude : public ndn::Exclude
-{
-public:
-  void
-  get(struct ndn_Exclude& excludeStruct) const
-  {
-    if (excludeStruct.maxEntries < size())
-      throw runtime_error("excludeStruct.maxEntries must be >= this exclude getEntryCount()");
-
-    int entries = 0;
-    for (Exclude::const_reverse_iterator i = rbegin (); i != rend (); i++)
-      {
-        if (!i->first.empty())
-          {
-            excludeStruct.entries[entries].type = ndn_Exclude_COMPONENT;
-            excludeStruct.entries[entries].component.value.value = const_cast<uint8_t*>(i->first.getValue().buf());
-            excludeStruct.entries[entries].component.value.length = i->first.getValue().size();
-            ++entries;
-          }
-        if (i->second)
-          {
-            excludeStruct.entries[entries].type = ndn_Exclude_ANY;
-            ++entries;
-          }
-      }
-
-    excludeStruct.nEntries = entries;
-  }
-
-  void
-  set(const struct ndn_Exclude& excludeStruct)
-  {
-    clear();
-
-    if (excludeStruct.nEntries == 0)
-      return;
-
-    int i = 0;
-    if (excludeStruct.entries[i].type == ndn_Exclude_ANY) {
-      appendExclude("/", true);
-      i++;
-    }
-
-    while (i < excludeStruct.nEntries) {
-      ndn_ExcludeEntry *entry = &excludeStruct.entries[i];
-
-      if (entry->type != ndn_Exclude_COMPONENT)
-        throw runtime_error("unrecognized ndn_ExcludeType");
-
-      Name::Component excludedComponent (entry->component.value.value, entry->component.value.length);
-      ++i;
-      entry = &excludeStruct.entries[i];
-
-      if (i < excludeStruct.nEntries) {
-        if (entry->type == ndn_Exclude_ANY) {
-          appendExclude(excludedComponent, true);
-          ++i;
-        }
-        else
-          appendExclude(excludedComponent, false);
-      }
-      else
-        appendExclude(excludedComponent, false);
-    }
-  }
-};
-
-class Name : public ndn::Name
-{
-public:
-  void 
-  get(struct ndn_Name& nameStruct) const
-  {
-    if (nameStruct.maxComponents < size())
-      throw runtime_error("nameStruct.maxComponents must be >= this name getNComponents()");
-  
-    nameStruct.nComponents = size();
-    for (size_t i = 0; i < nameStruct.nComponents; ++i) {
-      nameStruct.components[i].value.value = const_cast<uint8_t*>(ndn::Name::get(i).getValue().buf());
-      nameStruct.components[i].value.length = ndn::Name::get(i).getValue().size();
-    }
-  }
-  
-  void 
-  set(const struct ndn_Name& nameStruct) 
-  {
-    clear();
-    for (size_t i = 0; i < nameStruct.nComponents; ++i)
-      append(nameStruct.components[i].value.value, nameStruct.components[i].value.length);  
-  }
-};
-
-class Interest : public ndn::Interest
-{
-public:
-  void 
-  get(struct ndn_Interest& interestStruct) const 
-  {
-    reinterpret_cast<const c::Name&>(getName()).get(interestStruct.name);
-    interestStruct.minSuffixComponents = getMinSuffixComponents();
-    interestStruct.maxSuffixComponents = getMaxSuffixComponents();
-    // publisherPublicKeyDigest_.get(interestStruct.publisherPublicKeyDigest);
-    reinterpret_cast<const c::Exclude&>(getExclude()).get(interestStruct.exclude);
-    interestStruct.childSelector = getChildSelector();
-    interestStruct.answerOriginKind = getMustBeFresh() ?
-      (ndn_Interest_ANSWER_CONTENT_STORE | ndn_Interest_ANSWER_GENERATED)
-      :
-      (ndn_Interest_ANSWER_CONTENT_STORE | ndn_Interest_ANSWER_GENERATED | ndn_Interest_ANSWER_STALE);
-    interestStruct.scope = getScope();
-    interestStruct.interestLifetimeMilliseconds = getInterestLifetime();
-
-    interestStruct.nonce.length = 4;
-    interestStruct.nonce.value = const_cast<uint8_t*>(reinterpret_cast<const uint8_t *>(getNonce()));
-  }  
-
-  void 
-  set(const struct ndn_Interest& interestStruct) 
-  {
-    reinterpret_cast<c::Name&>(getName()).set(interestStruct.name);
-    setMinSuffixComponents(interestStruct.minSuffixComponents);
-    setMaxSuffixComponents(interestStruct.maxSuffixComponents);
-  
-    // publisherPublicKeyDigest_.set(interestStruct.publisherPublicKeyDigest);
-  
-    reinterpret_cast<c::Exclude&>(getExclude()).set(interestStruct.exclude);
-    setChildSelector(interestStruct.childSelector);
-    // answerOriginKind_ = interestStruct.answerOriginKind;
-    setScope(interestStruct.scope);
-    setInterestLifetime(interestStruct.interestLifetimeMilliseconds);
-
-    setNonce(*reinterpret_cast<uint32_t*>(interestStruct.nonce.value));
-  }
-};
-
-class Data : public ndn::Data
-{
-public:
-  void 
-  get(struct ndn_Data& dataStruct) const 
-  {
-    // signature_->get(dataStruct.signature);
-    // name_.get(dataStruct.name);
-    // metaInfo_.get(dataStruct.metaInfo);
-    // content_.get(dataStruct.content);
-  }
-
-  void 
-  set(const struct ndn_Data& dataStruct)
-  {
-    // signature_->set(dataStruct.signature);
-    // name_.set(dataStruct.name);
-    // metaInfo_.set(dataStruct.metaInfo);
-    // content_ = Blob(dataStruct.content);
-  }
-};
-
-class ForwardingEntry : public ndn::ForwardingEntry
-{
-public:
-  void 
-  get(struct ndn_ForwardingEntry& forwardingEntryStruct) const 
-  {
-    reinterpret_cast<const c::Name&>(getPrefix()).get(forwardingEntryStruct.prefix);
-    // publisherPublicKeyDigest_.get(forwardingEntryStruct.publisherPublicKeyDigest);
-    forwardingEntryStruct.faceId = getFaceId();
-    // forwardingEntryStruct.forwardingFlags = getForwardingFlags();
-    forwardingEntryStruct.freshnessSeconds = getFreshnessPeriod() / 1000;
-
-    forwardingEntryStruct.action.length = getAction().size();
-    if (getAction().size() > 0)
-      forwardingEntryStruct.action.value = (uint8_t *)&getAction();
-    else
-      forwardingEntryStruct.action.value = 0;
-  }
-
-  void 
-  set(const struct ndn_ForwardingEntry& forwardingEntryStruct) 
-  {
-    if (forwardingEntryStruct.action.value && forwardingEntryStruct.action.length > 0)
-      setAction(string(forwardingEntryStruct.action.value, forwardingEntryStruct.action.value + forwardingEntryStruct.action.length));
-    else
-      setAction("");
-
-    Name prefix;
-    reinterpret_cast<c::Name&>(prefix).set(forwardingEntryStruct.prefix);
-    setPrefix(prefix);
-    // publisherPublicKeyDigest_.set(forwardingEntryStruct.publisherPublicKeyDigest);  
-    setFaceId(forwardingEntryStruct.faceId);
-    // setForwardingFlags(forwardingEntryStruct.forwardingFlags);
-    setFreshnessPeriod(forwardingEntryStruct.freshnessSeconds * 1000);
-  }
-};
-
-}
-
-
-// This is declared in the WireFormat class.
-WireFormat*
-WireFormat::newInitialDefaultWireFormat() 
-{
-  return new BinaryXmlWireFormat();
-}
-  
-Blob 
-BinaryXmlWireFormat::encodeInterest(const Interest& interest) 
-{
-  struct ndn_NameComponent nameComponents[100];
-  struct ndn_ExcludeEntry excludeEntries[100];
-  struct ndn_Interest interestStruct;
-  ndn_Interest_initialize
-    (&interestStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]), 
-     excludeEntries, sizeof(excludeEntries) / sizeof(excludeEntries[0]));
-  reinterpret_cast<const c::Interest&>(interest).get(interestStruct);
-
-  BinaryXmlEncoder encoder;
-  ndn_Error error;
-  if ((error = ndn_encodeBinaryXmlInterest(&interestStruct, &encoder)))
-    throw runtime_error(ndn_getErrorString(error));
-     
-  return encoder.getOutput();
-}
-
-void 
-BinaryXmlWireFormat::decodeInterest(Interest& interest, const uint8_t *input, size_t inputLength)
-{
-  struct ndn_NameComponent nameComponents[100];
-  struct ndn_ExcludeEntry excludeEntries[100];
-  struct ndn_Interest interestStruct;
-  ndn_Interest_initialize
-    (&interestStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]), 
-     excludeEntries, sizeof(excludeEntries) / sizeof(excludeEntries[0]));
-    
-  BinaryXmlDecoder decoder(input, inputLength);  
-  ndn_Error error;
-  if ((error = ndn_decodeBinaryXmlInterest(&interestStruct, &decoder)))
-    throw runtime_error(ndn_getErrorString(error));
-
-  reinterpret_cast<c::Interest&>(interest).set(interestStruct);
-}
-
-Blob 
-BinaryXmlWireFormat::encodeData(const Data& data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset) 
-{
-  struct ndn_NameComponent nameComponents[100];
-  struct ndn_NameComponent keyNameComponents[100];
-  struct ndn_Data dataStruct;
-  ndn_Data_initialize
-    (&dataStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]), 
-     keyNameComponents, sizeof(keyNameComponents) / sizeof(keyNameComponents[0]));
-  reinterpret_cast<const c::Data&>(data).get(dataStruct);
-
-  BinaryXmlEncoder encoder(1500);
-  ndn_Error error;
-  if ((error = ndn_encodeBinaryXmlData(&dataStruct, signedPortionBeginOffset, signedPortionEndOffset, &encoder)))
-    throw runtime_error(ndn_getErrorString(error));
-     
-  return encoder.getOutput();
-}
-
-void 
-BinaryXmlWireFormat::decodeData
-  (Data& data, const uint8_t *input, size_t inputLength, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset)
-{
-  struct ndn_NameComponent nameComponents[100];
-  struct ndn_NameComponent keyNameComponents[100];
-  struct ndn_Data dataStruct;
-  ndn_Data_initialize
-    (&dataStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]), 
-     keyNameComponents, sizeof(keyNameComponents) / sizeof(keyNameComponents[0]));
-    
-  BinaryXmlDecoder decoder(input, inputLength);  
-  ndn_Error error;
-  if ((error = ndn_decodeBinaryXmlData(&dataStruct, signedPortionBeginOffset, signedPortionEndOffset, &decoder)))
-    throw runtime_error(ndn_getErrorString(error));
-
-  reinterpret_cast<c::Data&>(data).set(dataStruct);
-}
-
-Blob 
-BinaryXmlWireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry) 
-{
-  struct ndn_NameComponent prefixNameComponents[100];
-  struct ndn_ForwardingEntry forwardingEntryStruct;
-  ndn_ForwardingEntry_initialize
-    (&forwardingEntryStruct, prefixNameComponents, sizeof(prefixNameComponents) / sizeof(prefixNameComponents[0]));
-  reinterpret_cast<const c::ForwardingEntry&>(forwardingEntry).get(forwardingEntryStruct);
-
-  BinaryXmlEncoder encoder;
-  ndn_Error error;
-  if ((error = ndn_encodeBinaryXmlForwardingEntry(&forwardingEntryStruct, &encoder)))
-    throw runtime_error(ndn_getErrorString(error));
-     
-  return encoder.getOutput();
-}
-
-void 
-BinaryXmlWireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, size_t inputLength)
-{
-  struct ndn_NameComponent prefixNameComponents[100];
-  struct ndn_ForwardingEntry forwardingEntryStruct;
-  ndn_ForwardingEntry_initialize
-    (&forwardingEntryStruct, prefixNameComponents, sizeof(prefixNameComponents) / sizeof(prefixNameComponents[0]));
-    
-  BinaryXmlDecoder decoder(input, inputLength);  
-  ndn_Error error;
-  if ((error = ndn_decodeBinaryXmlForwardingEntry(&forwardingEntryStruct, &decoder)))
-    throw runtime_error(ndn_getErrorString(error));
-
-  reinterpret_cast<c::ForwardingEntry&>(forwardingEntry).set(forwardingEntryStruct);
-}
-
-}
diff --git a/src/encoding/element-listener.cpp b/src/encoding/element-listener.cpp
deleted file mode 100644
index 3b56717..0000000
--- a/src/encoding/element-listener.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include <ndn-cpp-dev/encoding/element-listener.hpp>
-
-namespace ndn {
-
-void 
-ElementListener::staticOnReceivedElement(struct ndn_ElementListener *self, uint8_t *element, size_t elementLength)
-{
-  ((ElementListener *)self)->onReceivedElement(element, elementLength);
-}
-
-}
diff --git a/src/encoding/wire-format.cpp b/src/encoding/wire-format.cpp
deleted file mode 100644
index cff24e5..0000000
--- a/src/encoding/wire-format.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include <stdexcept>
-#include <ndn-cpp-dev/encoding/wire-format.hpp>
-
-using namespace std;
-
-namespace ndn {
-
-static bool gotInitialDefaultWireFormat = false;
-
-WireFormat* WireFormat::defaultWireFormat_ = 0;
-
-WireFormat*
-WireFormat::getDefaultWireFormat()
-{
-  if (!defaultWireFormat_ && !gotInitialDefaultWireFormat) {
-    // There is no defaultWireFormat_ and we have not yet initialized initialDefaultWireFormat_, so initialize and use it.
-    gotInitialDefaultWireFormat = true;
-    // NOTE: This allocates one object which we never free for the life of the application.
-    defaultWireFormat_ = newInitialDefaultWireFormat();
-  }
-  
-  return defaultWireFormat_;
-}
-
-Blob 
-WireFormat::encodeInterest(const Interest& interest) 
-{
-  throw logic_error("unimplemented");
-}
-
-void 
-WireFormat::decodeInterest(Interest& interest, const uint8_t *input, size_t inputLength) 
-{
-  throw logic_error("unimplemented");
-}
-
-Blob 
-WireFormat::encodeData(const Data& data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset) 
-{
-  throw logic_error("unimplemented");
-}
-
-void 
-WireFormat::decodeData
-  (Data& data, const uint8_t *input, size_t inputLength, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset) 
-{
-  throw logic_error("unimplemented");
-}
-
-Blob 
-WireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry) 
-{
-  throw logic_error("unimplemented");
-}
-
-void 
-WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, size_t inputLength) 
-{
-  throw logic_error("unimplemented");
-}
-
-}
diff --git a/src/name.cpp b/src/name.cpp
index 7a3d171..3e2d1fe 100644
--- a/src/name.cpp
+++ b/src/name.cpp
@@ -10,8 +10,7 @@
 #include <algorithm>
 #include <string.h>
 #include <ndn-cpp-dev/name.hpp>
-#include "c/util/ndn_memory.h"
-#include "c/util/time.h"
+#include "util/time.hpp"
 
 #include "util/string-helper.hpp"
 
@@ -91,7 +90,7 @@
     return 1;
 
   // The components are equal length.  Just do a byte compare.  
-  return ndn_memcmp(getValue().buf(), other.getValue().buf(), getValue().size());
+  return memcmp(getValue().buf(), other.getValue().buf(), getValue().size());
 }
 
 // const Block &
diff --git a/src/node.cpp b/src/node.cpp
index fe192cc..fb216ca 100644
--- a/src/node.cpp
+++ b/src/node.cpp
@@ -6,7 +6,7 @@
  */
 
 #include <stdexcept>
-#include "c/util/time.h"
+#include "util/time.hpp"
 
 #include <ndn-cpp-dev/forwarding-entry.hpp>
 #include <ndn-cpp-dev/face-instance.hpp>
diff --git a/src/security/sec-public-info-sqlite3.cpp b/src/security/sec-public-info-sqlite3.cpp
index 8b68ac6..2072091 100644
--- a/src/security/sec-public-info-sqlite3.cpp
+++ b/src/security/sec-public-info-sqlite3.cpp
@@ -17,7 +17,8 @@
 #include <fstream>
 #include <boost/filesystem.hpp>
 #include "../util/logging.hpp"
-#include "../c/util/time.h"
+#include "../util/time.hpp"
+
 #include <ndn-cpp-dev/data.hpp>
 #include <ndn-cpp-dev/security/identity-certificate.hpp>
 #include <ndn-cpp-dev/security/sec-public-info-sqlite3.hpp>
diff --git a/src/transport/tcp-transport.cpp b/src/transport/tcp-transport.cpp
index f75dcd2..2e78cc3 100644
--- a/src/transport/tcp-transport.cpp
+++ b/src/transport/tcp-transport.cpp
@@ -10,7 +10,6 @@
 
 #include <ndn-cpp-dev/face.hpp>
 #include <ndn-cpp-dev/transport/tcp-transport.hpp>
-#include "../c/util/ndn_memory.h"
 
 #include <boost/asio.hpp>
 #if NDN_CPP_HAVE_CXX11
@@ -179,7 +178,8 @@
         if (partialDataSize_ > 0)
           {
             size_t newDataSize = std::min(bytes_recvd, MAX_LENGTH-partialDataSize_);
-            ndn_memcpy(partialData_ + partialDataSize_, inputBuffer_, newDataSize);
+            std::copy(inputBuffer_, inputBuffer_ + newDataSize, partialData_ + partialDataSize_);
+
             partialDataSize_ += newDataSize;
               
             size_t offset = 0;
@@ -194,7 +194,7 @@
                         
                     offset = 0;
                     partialDataSize_ = bytes_recvd - newDataSize;
-                    ndn_memcpy(partialData_, inputBuffer_ + newDataSize, partialDataSize_);
+                    std::copy(inputBuffer_ + newDataSize, inputBuffer_ + newDataSize + partialDataSize_, partialData_);
 
                     processAll(partialData_, offset, partialDataSize_);
 
@@ -212,7 +212,7 @@
                 if (offset > 0)
                   {
                     partialDataSize_ -= offset;
-                    ndn_memcpy(partialData_, partialData_ + offset, partialDataSize_);
+                    std::copy(partialData_ + offset, partialData_ + offset + partialDataSize_, partialData_);
                   }
                 else if (offset == 0 && partialDataSize_ == MAX_LENGTH)
                   {
@@ -235,7 +235,7 @@
                 if (offset > 0)
                   {
                     partialDataSize_ = bytes_recvd - offset;
-                    ndn_memcpy(partialData_, inputBuffer_ + offset, partialDataSize_);
+                    std::copy(inputBuffer_ + offset, inputBuffer_ + offset + partialDataSize_, partialData_);
                   }
               }
           }
diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
index 954b12c..5d26e15 100644
--- a/src/transport/unix-transport.cpp
+++ b/src/transport/unix-transport.cpp
@@ -10,7 +10,6 @@
 
 #include <ndn-cpp-dev/face.hpp>
 #include <ndn-cpp-dev/transport/unix-transport.hpp>
-#include "../c/util/ndn_memory.h"
 
 #include <boost/asio.hpp>
 #if NDN_CPP_HAVE_CXX11
@@ -148,7 +147,8 @@
         if (partialDataSize_ > 0)
           {
             size_t newDataSize = std::min(bytes_recvd, MAX_LENGTH-partialDataSize_);
-            ndn_memcpy(partialData_ + partialDataSize_, inputBuffer_, newDataSize);
+            std::copy(inputBuffer_, inputBuffer_ + newDataSize, partialData_ + partialDataSize_);
+
             partialDataSize_ += newDataSize;
               
             size_t offset = 0;
@@ -163,7 +163,7 @@
                         
                     offset = 0;
                     partialDataSize_ = bytes_recvd - newDataSize;
-                    ndn_memcpy(partialData_, inputBuffer_ + newDataSize, partialDataSize_);
+                    std::copy(inputBuffer_ + newDataSize, inputBuffer_ + newDataSize + partialDataSize_, partialData_);
 
                     processAll(partialData_, offset, partialDataSize_);
 
@@ -181,7 +181,7 @@
                 if (offset > 0)
                   {
                     partialDataSize_ -= offset;
-                    ndn_memcpy(partialData_, partialData_ + offset, partialDataSize_);
+                    std::copy(partialData_ + offset, partialData_ + offset + partialDataSize_, partialData_);
                   }
                 else if (offset == 0 && partialDataSize_ == MAX_LENGTH)
                   {
@@ -204,7 +204,7 @@
                 if (offset > 0)
                   {
                     partialDataSize_ = bytes_recvd - offset;
-                    ndn_memcpy(partialData_, inputBuffer_ + offset, partialDataSize_);
+                    std::copy(inputBuffer_ + offset, inputBuffer_ + offset + partialDataSize_, partialData_);
                   }
               }
           }
diff --git a/src/util/blob-stream.hpp b/src/util/blob-stream.hpp
deleted file mode 100644
index 3bad4b7..0000000
--- a/src/util/blob-stream.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BLOB_STREAM_HPP
-#define NDN_BLOB_STREAM_HPP
-
-#include <ndn-cpp-dev/common.hpp>
-
-#if NDN_CPP_USE_SYSTEM_BOOST
-#include <boost/iostreams/detail/ios.hpp>
-#include <boost/iostreams/categories.hpp>
-#include <boost/iostreams/stream.hpp>
-namespace ndnboost = boost;
-#else
-// We can use ndnboost::iostreams because this is internal and will not conflict with the application if it uses boost::iostreams.
-#include <ndnboost/iostreams/detail/ios.hpp>
-#include <ndnboost/iostreams/categories.hpp>
-#include <ndnboost/iostreams/stream.hpp>
-#endif
-
-namespace ndn {
-
-class blob_append_device {
-public:
-  typedef char  char_type;
-  typedef ndnboost::iostreams::sink_tag category;
-  
-  blob_append_device(std::vector<uint8_t>& container)
-  : container_(container)
-  {
-  }
-  
-  std::streamsize
-  write(const char_type* s, std::streamsize n)
-  {
-    std::copy(s, s+n, std::back_inserter(container_));
-    return n;
-  }
-  
-protected:
-  std::vector<uint8_t>& container_;
-};
-
-/**
- * This is called "blob_stream" but it doesn't use an ndn::Blob which is immutable.  It uses a pointer to a vector<uint8_t>.
- * This is inteded for internal library use, not exported in the API.
- */
-struct blob_stream : public ndnboost::iostreams::stream<blob_append_device>
-{
-  blob_stream()
-    : buffer_(new std::vector<uint8_t>())
-    , device_(*buffer_)
-  {
-    open(device_);
-  }
-
-  ptr_lib::shared_ptr<std::vector<uint8_t> >
-  buf()
-  {
-    flush();
-    return buffer_;
-  }
-
-private:
-  ptr_lib::shared_ptr<std::vector<uint8_t> > buffer_;
-  blob_append_device device_;
-};
-
-}
-
-#endif
diff --git a/src/util/blob.cpp b/src/util/blob.cpp
deleted file mode 100644
index 46297c6..0000000
--- a/src/util/blob.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "../c/util/blob.h"
-#include <ndn-cpp-dev/util/blob.hpp>
-
-using namespace std;
-
-namespace ndn {
-
-Blob::Blob(const struct ndn_Blob& blobStruct)
-  : ptr_lib::shared_ptr<const vector<uint8_t> >(new vector<uint8_t>(blobStruct.value, blobStruct.value + blobStruct.length))
-{
-}
-
-void 
-Blob::get(struct ndn_Blob& blobStruct) const 
-{
-  blobStruct.length = size(); 
-  if (size() > 0)
-    blobStruct.value = (uint8_t*)buf();
-  else
-    blobStruct.value = 0;
-}
-
-}
diff --git a/src/util/changed-event.cpp b/src/util/changed-event.cpp
deleted file mode 100644
index 08dcb98..0000000
--- a/src/util/changed-event.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "changed-event.hpp"
-
-using namespace std;
-
-namespace ndn {
-
-void 
-ChangedEvent::fire()
-{
-  for (size_t i = 0; i < listeners_.size(); ++i)
-    listeners_[i]();
-}
-
-}
diff --git a/src/util/changed-event.hpp b/src/util/changed-event.hpp
deleted file mode 100644
index aee8549..0000000
--- a/src/util/changed-event.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_CHANGED_EVENT_HPP
-#define NDN_CHANGED_EVENT_HPP
-
-#include <vector>
-#include <ndn-cpp-dev/common.hpp>
-
-namespace ndn {
-
-/**
- * An OnChanged function object is called to notify a listener of a changed event.
- */
-typedef func_lib::function<void()> OnChanged;
-
-class ChangedEvent {
-public:
-  /**
-   * Add onChanged to the listener list. This does not check if a duplicate is already in the list.
-   * @param onChanged The OnChanged function object.
-   */
-  void 
-  add(OnChanged onChanged)
-  {
-    listeners_.push_back(onChanged);
-  }
-  
-  /**
-   * Call all the listeners.
-   */
-  void 
-  fire();
-
-#if 0  
-private:
-#endif
-  std::vector<OnChanged> listeners_;
-};
-
-}
-
-#endif
diff --git a/src/c/util/crypto.c b/src/util/crypto.cpp
similarity index 82%
rename from src/c/util/crypto.c
rename to src/util/crypto.cpp
index 384e5b8..ce17259 100644
--- a/src/c/util/crypto.c
+++ b/src/util/crypto.cpp
@@ -4,7 +4,9 @@
  * See COPYING for copyright and distribution information.
  */
 
-#include "ndn-cpp-dev/c/util/crypto.h"
+#include "ndn-cpp-dev/util/crypto.hpp"
+
+namespace ndn {
 
 void ndn_digestSha256(const uint8_t *data, size_t dataLength, uint8_t *digest)
 {
@@ -13,3 +15,5 @@
   SHA256_Update(&sha256, data, dataLength);
   SHA256_Final(digest, &sha256);
 }
+
+} // namespace ndn
diff --git a/src/util/dynamic-uint8-vector.cpp b/src/util/dynamic-uint8-vector.cpp
deleted file mode 100644
index 197fc0e..0000000
--- a/src/util/dynamic-uint8-vector.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include "dynamic-uint8-vector.hpp"
-
-using namespace std;
-
-namespace ndn {
-
-DynamicUInt8Vector::DynamicUInt8Vector(size_t initialLength)
-: vector_(new vector<uint8_t>(initialLength))
-{
-  ndn_DynamicUInt8Array_initialize(this, &vector_->front(), initialLength, DynamicUInt8Vector::realloc);
-}
-
-uint8_t*
-DynamicUInt8Vector::realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length)
-{
-  // Because this method is private, assume there is not a problem with upcasting.
-  DynamicUInt8Vector *thisObject = (DynamicUInt8Vector *)self;
-  
-  if (array != &thisObject->vector_->front())
-    // We don't expect this to ever happen. The caller didn't pass the array from this object.
-    return 0;
-  
-  thisObject->vector_->resize(length);
-  return &thisObject->vector_->front();
-}
-
-}
diff --git a/src/util/dynamic-uint8-vector.hpp b/src/util/dynamic-uint8-vector.hpp
deleted file mode 100644
index 55ed1ee..0000000
--- a/src/util/dynamic-uint8-vector.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_DYNAMIC_UCHAR_VECTOR_HPP
-#define NDN_DYNAMIC_UCHAR_VECTOR_HPP
-
-#include <vector>
-#include <ndn-cpp-dev/common.hpp>
-#include "../c/util/dynamic-uint8-array.h"
-
-namespace ndn {
-
-/**
- * A DynamicUInt8Vector extends ndn_DynamicUInt8Array to hold a shared_ptr<vector<uint8_t> > for use with
- * C functions which need an ndn_DynamicUInt8Array.
- */
-class DynamicUInt8Vector : public ndn_DynamicUInt8Array {
-public:
-  /**
-   * Create a new DynamicUInt8Vector with an initial length.
-   * @param initialLength The initial size of the allocated vector.
-   */
-  DynamicUInt8Vector(size_t initialLength);
-  
-  /**
-   * Get the shared_ptr to the allocated vector.
-   * @return The shared_ptr to the allocated vector. 
-   */
-  ptr_lib::shared_ptr<std::vector<uint8_t> >& 
-  get() { return vector_; }
-  
-private:
-  /**
-   * Implement the static realloc function using vector resize.
-   * @param self A pointer to this object.
-   * @param array Should be the front of the vector.
-   * @param length The new length for the vector.
-   * @return The front of the allocated vector.
-   */
-  static uint8_t*
-  realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length);
-  
-  ptr_lib::shared_ptr<std::vector<uint8_t> > vector_;
-};
-
-}
-
-#endif
diff --git a/src/util/ndnd-id-fetcher.hpp b/src/util/ndnd-id-fetcher.hpp
index 6a1224e..e10eb38 100644
--- a/src/util/ndnd-id-fetcher.hpp
+++ b/src/util/ndnd-id-fetcher.hpp
@@ -9,7 +9,7 @@
 #define NDN_NDND_ID_FETCHER_HPP
 
 #include <ndn-cpp-dev/common.hpp>
-#include "ndn-cpp-dev/c/util/crypto.h"
+#include "ndn-cpp-dev/util/crypto.hpp"
 
 namespace ndn {
 
diff --git a/src/c/util/time.c b/src/util/time.cpp
similarity index 76%
rename from src/c/util/time.c
rename to src/util/time.cpp
index 00719c2..03eb81b 100644
--- a/src/c/util/time.c
+++ b/src/util/time.cpp
@@ -14,9 +14,11 @@
 #include <math.h>
 #include <string.h>
 #include <stdio.h>
-#include "time.h"
+#include "time.hpp"
 
-ndn_MillisecondsSince1970 
+namespace ndn {
+
+MillisecondsSince1970 
 ndn_getNowMilliseconds()
 {
   struct timeval t;
@@ -25,15 +27,15 @@
   return t.tv_sec * 1000.0 + t.tv_usec / 1000.0;
 }
 
-ndn_Error
-ndn_toIsoString(ndn_MillisecondsSince1970 milliseconds, char *isoString)
+int
+ndn_toIsoString(MillisecondsSince1970 milliseconds, char *isoString)
 {
 #if NDN_CPP_HAVE_GMTIME_SUPPORT
   if (milliseconds < 0)
-    return NDN_ERROR_Calendar_time_value_out_of_range;
+    return -1;
   else if (milliseconds > 2e14)
     // 2e14 is about the year 8300.  We don't want to go over a 4-digit year.
-    return NDN_ERROR_Calendar_time_value_out_of_range;
+    return -1;
   
   double secondsSince1970 = milliseconds / 1000.0;
   char fractionBuffer[10];
@@ -48,14 +50,14 @@
   sprintf(isoString, "%04d%02d%02dT%02d%02d%02d%s", 1900 + gmt->tm_year, gmt->tm_mon + 1, gmt->tm_mday,
     gmt->tm_hour, gmt->tm_min, gmt->tm_sec, fraction);
   
-  return NDN_ERROR_success;
+  return 0;
 #else
-  return NDN_ERROR_Time_functions_are_not_supported_by_the_standard_library;
+  return -1;
 #endif
 }
 
-ndn_Error
-ndn_fromIsoString(const char* isoString, ndn_MillisecondsSince1970 *milliseconds)
+int
+ndn_fromIsoString(const char* isoString, MillisecondsSince1970 *milliseconds)
 {
 #if NDN_CPP_HAVE_GMTIME_SUPPORT
   // Initialize time zone, etc.
@@ -74,8 +76,10 @@
   tm1.tm_sec = 0;
   
   *milliseconds = (timegm(&tm1) + seconds) * 1000.0;
-  return NDN_ERROR_success;
+  return 0;
 #else
-  return NDN_ERROR_Time_functions_are_not_supported_by_the_standard_library;
+  return -1;
 #endif
 }
+
+} // namespace ndn
diff --git a/src/util/time.hpp b/src/util/time.hpp
index 90482d9..5e5dc7c 100644
--- a/src/util/time.hpp
+++ b/src/util/time.hpp
@@ -8,11 +8,19 @@
 #ifndef NDN_TIME_HPP
 #define NDN_TIME_HPP
 
-#include <stdexcept>
-#include "../c/util/time.h"
+#include "ndn-cpp-dev/common.hpp"
 
 namespace ndn {
 
+MillisecondsSince1970 
+ndn_getNowMilliseconds();
+
+int
+ndn_toIsoString(MillisecondsSince1970 milliseconds, char *isoString);
+
+int
+ndn_fromIsoString(const char* isoString, MillisecondsSince1970 *milliseconds);
+
 /**
  * Convert to the ISO string representation of the time.
  * @param time Milliseconds since 1/1/1970.
@@ -22,9 +30,9 @@
 toIsoString(const MillisecondsSince1970& time)
 {
   char isoString[25];
-  ndn_Error error;
+  int error;
   if ((error = ndn_toIsoString(time, isoString)))
-    throw std::runtime_error(ndn_getErrorString(error));
+    throw std::runtime_error("toIsoString");
   
   return isoString;
 }
@@ -38,9 +46,9 @@
 fromIsoString(const std::string& isoString)
 {
   MillisecondsSince1970 milliseconds;
-  ndn_Error error;
+  int error;
   if ((error = ndn_fromIsoString(isoString.c_str(), &milliseconds)))
-    throw std::runtime_error(ndn_getErrorString(error));
+    throw std::runtime_error("fromIsoString");
   
   return milliseconds;
 }
