Changing ccn to ndn

Change-Id: Iba4ec8e48dd5345903cc3518aaf98d4d37d89ff1
diff --git a/build/ndn-js.js b/build/ndn-js.js
index 6299758..d1f552f 100644
--- a/build/ndn-js.js
+++ b/build/ndn-js.js
@@ -2,7 +2,7 @@
  * @author: Jeff Thompson
  * See COPYING for copyright and distribution information.
  * Provide the callback closure for the async communication methods in the NDN class.
- * This is a port of Closure.py from PyCCN, written by: 
+ * This is a port of Closure.py from PyNDN, written by: 
  * Derek Kulinski <takeda@takeda.tk>
  * Jeff Burke <jburke@ucla.edu>
  */
@@ -134,7 +134,7 @@
 		if (LOG > 3) console.log(ev);
 		if (LOG > 3) console.log('ws.onopen: WebSocket connection opened.');
 		if (LOG > 3) console.log('ws.onopen: ReadyState: ' + this.readyState);
-        // NDN.registerPrefix will fetch the ccndid when needed.
+        // NDN.registerPrefix will fetch the ndndid when needed.
         
         onopenCallback();
 	}
@@ -179,11 +179,11 @@
 /**
  * @author: Meki Cheraoui
  * See COPYING for copyright and distribution information.
- * This class contains all CCNx tags
+ * This class contains all NDNx tags
  */
 
 
-var CCNProtocolDTags = {
+var NDNProtocolDTags = {
 
 	/**
 	 * Note if you add one of these, add it to the reverse string map as well.
@@ -300,11 +300,11 @@
 	 ConfigSliceOp : 126,
 
 	// Remember to keep in sync with schema/tagnames.csvsdict
-	 CCNProtocolDataUnit : 17702112,
-	 CCNPROTOCOL_DATA_UNIT : "CCNProtocolDataUnit"
+	 NDNProtocolDataUnit : 17702112,
+	 NDNPROTOCOL_DATA_UNIT : "NDNProtocolDataUnit"
 };
 
-var CCNProtocolDTagsStrings = [
+var NDNProtocolDTagsStrings = [
 	null, null, null, null, null, null, null, null, null, null, null,
 	null, null,
 	"Any", "Name", "Component", "Certificate", "Collection", "CompleteName",
@@ -330,18 +330,18 @@
 
 
 //TESTING
-//console.log(exports.CCNProtocolDTagsStrings[17]);
+//console.log(exports.NDNProtocolDTagsStrings[17]);
 
 /**
  * @author: Meki Cheraoui
  * See COPYING for copyright and distribution information.
- * This class represents CCNTime Objects
+ * This class represents NDNTime Objects
  */
 
 /**
  * @constructor
  */
-var CCNTime = function CCNTime(input) {
+var NDNTime = function NDNTime(input) {
 	this.NANOS_MAX = 999877929;
 	
 	if(typeof input =='number')
@@ -352,23 +352,23 @@
 };
 
 
-CCNTime.prototype.getJavascriptDate = function(){
+NDNTime.prototype.getJavascriptDate = function(){
 	var d = new Date();
 	d.setTime( this.msec );
 	return d
 };
 
 	/**
-	 * Create a CCNTime
+	 * Create a NDNTime
 	 * @param timestamp source timestamp to initialize from, some precision will be lost
 	 */
 
 
 	/**
-	 * Create a CCNTime from its binary encoding
-	 * @param binaryTime12 the binary representation of a CCNTime
+	 * Create a NDNTime from its binary encoding
+	 * @param binaryTime12 the binary representation of a NDNTime
 	 */
-/*CCNTime.prototype.setDateBinary = function(
+/*NDNTime.prototype.setDateBinary = function(
 	//byte [] 
 		binaryTime12) {
 
@@ -390,7 +390,7 @@
 };
 
 //byte[]
-CCNTime.prototype.toBinaryTime = function() {
+NDNTime.prototype.toBinaryTime = function() {
 
 	return this.msec; //unsignedLongToByteArray(this.date.getTime());
 
@@ -568,20 +568,20 @@
 }
 
 
-Name.prototype.from_ccnb = function(/*XMLDecoder*/ decoder)  {
+Name.prototype.from_ndnb = function(/*XMLDecoder*/ decoder)  {
 		decoder.readStartElement(this.getElementLabel());
 
 		
 		this.components = new Array(); //new ArrayList<byte []>();
 
-		while (decoder.peekStartElement(CCNProtocolDTags.Component)) {
-			this.add(decoder.readBinaryElement(CCNProtocolDTags.Component));
+		while (decoder.peekStartElement(NDNProtocolDTags.Component)) {
+			this.add(decoder.readBinaryElement(NDNProtocolDTags.Component));
 		}
 		
 		decoder.readEndElement();
 };
 
-Name.prototype.to_ccnb = function(/*XMLEncoder*/ encoder)  {
+Name.prototype.to_ndnb = function(/*XMLEncoder*/ encoder)  {
 		
 		if( this.components ==null ) 
 			throw new Error("CANNOT ENCODE EMPTY CONTENT NAME");
@@ -589,13 +589,13 @@
 		encoder.writeStartElement(this.getElementLabel());
 		var count = this.components.length;
 		for (var i=0; i < count; i++) {
-			encoder.writeElement(CCNProtocolDTags.Component, this.components[i]);
+			encoder.writeElement(NDNProtocolDTags.Component, this.components[i]);
 		}
 		encoder.writeEndElement();
 };
 
 Name.prototype.getElementLabel = function(){
-	return CCNProtocolDTags.Name;
+	return NDNProtocolDTags.Name;
 };
 
 /**
@@ -774,7 +774,7 @@
 Name.ContentDigestSuffix = new Uint8Array([0x00]);
 
 /**
- * Return component as an escaped string according to "CCNx URI Scheme".
+ * Return component as an escaped string according to "NDNx URI Scheme".
  * We can't use encodeURIComponent because that doesn't encode all the characters we want to.
  */
 Name.toEscapedString = function(component) {
@@ -808,7 +808,7 @@
 };
 
 /**
- * Return component as a Uint8Array by decoding the escapedString according to "CCNx URI Scheme".
+ * Return component as a Uint8Array by decoding the escapedString according to "NDNx URI Scheme".
  * If escapedString is "", "." or ".." then return null, which means to skip the component in the name.
  */
 Name.fromEscapedString = function(escapedString) {
@@ -940,7 +940,7 @@
 ContentObject.prototype.encodeObject = function encodeObject(obj){
 	var enc = new BinaryXMLEncoder();
  
-	obj.to_ccnb(enc);
+	obj.to_ndnb(enc);
 	
 	var num = enc.getReducedOstream();
 
@@ -952,7 +952,7 @@
 ContentObject.prototype.encodeContent = function encodeContent(obj){
 	var enc = new BinaryXMLEncoder();
 	 
-	enc.writeElement(CCNProtocolDTags.Content, this.content);
+	enc.writeElement(NDNProtocolDTags.Content, this.content);
 
 	var num = enc.getReducedOstream();
 
@@ -971,14 +971,14 @@
 /**
  * @deprecated Use BinaryXmlWireFormat.decodeContentObject.
  */
-ContentObject.prototype.from_ccnb = function(/*XMLDecoder*/ decoder) {
+ContentObject.prototype.from_ndnb = function(/*XMLDecoder*/ decoder) {
   BinaryXmlWireFormat.decodeContentObject(this, decoder);
 };
 
 /**
  * @deprecated Use BinaryXmlWireFormat.encodeContentObject.
  */
-ContentObject.prototype.to_ccnb = function(/*XMLEncoder*/ encoder)  {
+ContentObject.prototype.to_ndnb = function(/*XMLEncoder*/ encoder)  {
   BinaryXmlWireFormat.encodeContentObject(this, encoder);
 };
 
@@ -1002,7 +1002,7 @@
   wireFormat.decodeContentObject(this, input);
 };
 
-ContentObject.prototype.getElementLabel= function(){return CCNProtocolDTags.ContentObject;};
+ContentObject.prototype.getElementLabel= function(){return NDNProtocolDTags.ContentObject;};
 
 /**
  * Create a new Signature with the optional values.
@@ -1014,31 +1014,31 @@
 	this.digestAlgorithm = digestAlgorithm
 };
 
-Signature.prototype.from_ccnb =function( decoder) {
+Signature.prototype.from_ndnb =function( decoder) {
 		decoder.readStartElement(this.getElementLabel());
 		
 		if(LOG>4)console.log('STARTED DECODING SIGNATURE');
 		
-		if (decoder.peekStartElement(CCNProtocolDTags.DigestAlgorithm)) {
+		if (decoder.peekStartElement(NDNProtocolDTags.DigestAlgorithm)) {
 			if(LOG>4)console.log('DIGIEST ALGORITHM FOUND');
-			this.digestAlgorithm = decoder.readUTF8Element(CCNProtocolDTags.DigestAlgorithm); 
+			this.digestAlgorithm = decoder.readUTF8Element(NDNProtocolDTags.DigestAlgorithm); 
 		}
-		if (decoder.peekStartElement(CCNProtocolDTags.Witness)) {
+		if (decoder.peekStartElement(NDNProtocolDTags.Witness)) {
 			if(LOG>4)console.log('WITNESS FOUND');
-			this.Witness = decoder.readBinaryElement(CCNProtocolDTags.Witness); 
+			this.Witness = decoder.readBinaryElement(NDNProtocolDTags.Witness); 
 		}
 		
 		//FORCE TO READ A SIGNATURE
 
 			if(LOG>4)console.log('SIGNATURE FOUND');
-			this.signature = decoder.readBinaryElement(CCNProtocolDTags.SignatureBits);
+			this.signature = decoder.readBinaryElement(NDNProtocolDTags.SignatureBits);
 
 		decoder.readEndElement();
 	
 };
 
 
-Signature.prototype.to_ccnb= function( encoder){
+Signature.prototype.to_ndnb= function( encoder){
     	
 	if (!this.validate()) {
 		throw new Error("Cannot encode: field values missing.");
@@ -1046,21 +1046,21 @@
 	
 	encoder.writeStartElement(this.getElementLabel());
 	
-	if ((null != this.digestAlgorithm) && (!this.digestAlgorithm.equals(CCNDigestHelper.DEFAULT_DIGEST_ALGORITHM))) {
-		encoder.writeElement(CCNProtocolDTags.DigestAlgorithm, OIDLookup.getDigestOID(this.DigestAlgorithm));
+	if ((null != this.digestAlgorithm) && (!this.digestAlgorithm.equals(NDNDigestHelper.DEFAULT_DIGEST_ALGORITHM))) {
+		encoder.writeElement(NDNProtocolDTags.DigestAlgorithm, OIDLookup.getDigestOID(this.DigestAlgorithm));
 	}
 	
 	if (null != this.Witness) {
 		// needs to handle null witness
-		encoder.writeElement(CCNProtocolDTags.Witness, this.Witness);
+		encoder.writeElement(NDNProtocolDTags.Witness, this.Witness);
 	}
 
-	encoder.writeElement(CCNProtocolDTags.SignatureBits, this.signature);
+	encoder.writeElement(NDNProtocolDTags.SignatureBits, this.signature);
 
 	encoder.writeEndElement();   		
 };
 
-Signature.prototype.getElementLabel = function() { return CCNProtocolDTags.Signature; };
+Signature.prototype.getElementLabel = function() { return NDNProtocolDTags.Signature; };
 
 
 Signature.prototype.validate = function() {
@@ -1078,7 +1078,7 @@
  */
 var SignedInfo = function SignedInfo(publisher, timestamp, type, locator, freshnessSeconds, finalBlockID) {
   this.publisher = publisher; //publisherPublicKeyDigest
-  this.timestamp=timestamp; // CCN Time
+  this.timestamp=timestamp; // NDN Time
   this.type=type; // ContentType
   this.locator =locator;//KeyLocator
   this.freshnessSeconds =freshnessSeconds; // Integer
@@ -1122,7 +1122,7 @@
 	var time = d.getTime();
 	
 
-    this.timestamp = new CCNTime( time );
+    this.timestamp = new NDNTime( time );
     
     if(LOG>4)console.log('TIME msec is');
 
@@ -1142,23 +1142,23 @@
 
 };
 
-SignedInfo.prototype.from_ccnb = function( decoder){
+SignedInfo.prototype.from_ndnb = function( decoder){
 
 		decoder.readStartElement( this.getElementLabel() );
 		
-		if (decoder.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)) {
+		if (decoder.peekStartElement(NDNProtocolDTags.PublisherPublicKeyDigest)) {
 			if(LOG>4)console.log('DECODING PUBLISHER KEY');
 			this.publisher = new PublisherPublicKeyDigest();
-			this.publisher.from_ccnb(decoder);
+			this.publisher.from_ndnb(decoder);
 		}
 
-		if (decoder.peekStartElement(CCNProtocolDTags.Timestamp)) {
+		if (decoder.peekStartElement(NDNProtocolDTags.Timestamp)) {
 			if(LOG>4)console.log('DECODING TIMESTAMP');
-			this.timestamp = decoder.readDateTime(CCNProtocolDTags.Timestamp);
+			this.timestamp = decoder.readDateTime(NDNProtocolDTags.Timestamp);
 		}
 
-		if (decoder.peekStartElement(CCNProtocolDTags.Type)) {
-			var binType = decoder.readBinaryElement(CCNProtocolDTags.Type);//byte [] 
+		if (decoder.peekStartElement(NDNProtocolDTags.Type)) {
+			var binType = decoder.readBinaryElement(NDNProtocolDTags.Type);//byte [] 
 		
 			
 			//TODO Implement type of Key Reading
@@ -1179,26 +1179,26 @@
 			this.type = ContentType.DATA; // default
 		}
 		
-		if (decoder.peekStartElement(CCNProtocolDTags.FreshnessSeconds)) {
-			this.freshnessSeconds = decoder.readIntegerElement(CCNProtocolDTags.FreshnessSeconds);
+		if (decoder.peekStartElement(NDNProtocolDTags.FreshnessSeconds)) {
+			this.freshnessSeconds = decoder.readIntegerElement(NDNProtocolDTags.FreshnessSeconds);
 			if(LOG>4)console.log('FRESHNESS IN SECONDS IS '+ this.freshnessSeconds);
 		}
 		
-		if (decoder.peekStartElement(CCNProtocolDTags.FinalBlockID)) {
+		if (decoder.peekStartElement(NDNProtocolDTags.FinalBlockID)) {
 			if(LOG>4)console.log('DECODING FINAL BLOCKID');
-			this.finalBlockID = decoder.readBinaryElement(CCNProtocolDTags.FinalBlockID);
+			this.finalBlockID = decoder.readBinaryElement(NDNProtocolDTags.FinalBlockID);
 		}
 		
-		if (decoder.peekStartElement(CCNProtocolDTags.KeyLocator)) {
+		if (decoder.peekStartElement(NDNProtocolDTags.KeyLocator)) {
 			if(LOG>4)console.log('DECODING KEY LOCATOR');
 			this.locator = new KeyLocator();
-			this.locator.from_ccnb(decoder);
+			this.locator.from_ndnb(decoder);
 		}
 				
 		decoder.readEndElement();
 };
 
-SignedInfo.prototype.to_ccnb = function( encoder)  {
+SignedInfo.prototype.to_ndnb = function( encoder)  {
 		if (!this.validate()) {
 			throw new Error("Cannot encode : field values missing.");
 		}
@@ -1207,28 +1207,28 @@
 		if (null!=this.publisher) {
 			if(LOG>3) console.log('ENCODING PUBLISHER KEY' + this.publisher.publisherPublicKeyDigest);
 
-			this.publisher.to_ccnb(encoder);
+			this.publisher.to_ndnb(encoder);
 		}
 
 		if (null!=this.timestamp) {
-			encoder.writeDateTime(CCNProtocolDTags.Timestamp, this.timestamp );
+			encoder.writeDateTime(NDNProtocolDTags.Timestamp, this.timestamp );
 		}
 		
 		if (null!=this.type && this.type !=0) {
 			
-			encoder.writeElement(CCNProtocolDTags.type, this.type);
+			encoder.writeElement(NDNProtocolDTags.type, this.type);
 		}
 		
 		if (null!=this.freshnessSeconds) {
-			encoder.writeElement(CCNProtocolDTags.FreshnessSeconds, this.freshnessSeconds);
+			encoder.writeElement(NDNProtocolDTags.FreshnessSeconds, this.freshnessSeconds);
 		}
 
 		if (null!=this.finalBlockID) {
-			encoder.writeElement(CCNProtocolDTags.FinalBlockID, this.finalBlockID);
+			encoder.writeElement(NDNProtocolDTags.FinalBlockID, this.finalBlockID);
 		}
 
 		if (null!=this.locator) {
-			this.locator.to_ccnb(encoder);
+			this.locator.to_ndnb(encoder);
 		}
 
 		encoder.writeEndElement();   		
@@ -1244,7 +1244,7 @@
 };
 
 SignedInfo.prototype.getElementLabel = function() { 
-	return CCNProtocolDTags.SignedInfo;
+	return NDNProtocolDTags.SignedInfo;
 };
 
 SignedInfo.prototype.validate = function() {
@@ -1433,14 +1433,14 @@
 /**
  * @deprecated Use BinaryXmlWireFormat.decodeInterest.
  */
-Interest.prototype.from_ccnb = function(/*XMLDecoder*/ decoder) {
+Interest.prototype.from_ndnb = function(/*XMLDecoder*/ decoder) {
   BinaryXmlWireFormat.decodeInterest(this, decoder);
 };
 
 /**
  * @deprecated Use BinaryXmlWireFormat.encodeInterest.
  */
-Interest.prototype.to_ccnb = function(/*XMLEncoder*/ encoder){
+Interest.prototype.to_ndnb = function(/*XMLEncoder*/ encoder){
   BinaryXmlWireFormat.encodeInterest(this, encoder);
 };
 
@@ -1513,20 +1513,20 @@
 
 Exclude.ANY = "*";
 
-Exclude.prototype.from_ccnb = function(/*XMLDecoder*/ decoder) {
-	decoder.readStartElement(CCNProtocolDTags.Exclude);
+Exclude.prototype.from_ndnb = function(/*XMLDecoder*/ decoder) {
+	decoder.readStartElement(NDNProtocolDTags.Exclude);
 
 	while (true) {
-        if (decoder.peekStartElement(CCNProtocolDTags.Component))
-            this.values.push(decoder.readBinaryElement(CCNProtocolDTags.Component));
-        else if (decoder.peekStartElement(CCNProtocolDTags.Any)) {
-            decoder.readStartElement(CCNProtocolDTags.Any);
+        if (decoder.peekStartElement(NDNProtocolDTags.Component))
+            this.values.push(decoder.readBinaryElement(NDNProtocolDTags.Component));
+        else if (decoder.peekStartElement(NDNProtocolDTags.Any)) {
+            decoder.readStartElement(NDNProtocolDTags.Any);
             decoder.readEndElement();
             this.values.push(Exclude.ANY);
         }
-        else if (decoder.peekStartElement(CCNProtocolDTags.Bloom)) {
+        else if (decoder.peekStartElement(NDNProtocolDTags.Bloom)) {
             // Skip the Bloom and treat it as Any.
-            decoder.readBinaryElement(CCNProtocolDTags.Bloom);
+            decoder.readBinaryElement(NDNProtocolDTags.Bloom);
             this.values.push(Exclude.ANY);
         }
         else
@@ -1536,20 +1536,20 @@
     decoder.readEndElement();
 };
 
-Exclude.prototype.to_ccnb = function(/*XMLEncoder*/ encoder)  {
+Exclude.prototype.to_ndnb = function(/*XMLEncoder*/ encoder)  {
 	if (this.values == null || this.values.length == 0)
 		return;
 
-	encoder.writeStartElement(CCNProtocolDTags.Exclude);
+	encoder.writeStartElement(NDNProtocolDTags.Exclude);
     
     // TODO: Do we want to order the components (except for ANY)?
     for (var i = 0; i < this.values.length; ++i) {
         if (this.values[i] == Exclude.ANY) {
-            encoder.writeStartElement(CCNProtocolDTags.Any);
+            encoder.writeStartElement(NDNProtocolDTags.Any);
             encoder.writeEndElement();
         }
         else
-            encoder.writeElement(CCNProtocolDTags.Component, this.values[i]);
+            encoder.writeElement(NDNProtocolDTags.Component, this.values[i]);
     }
 
 	encoder.writeEndElement();
@@ -1659,7 +1659,7 @@
  * @constructor
  */
 var Key = function Key(){
-    /* TODO: Port from PyCCN:
+    /* TODO: Port from PyNDN:
 	generateRSA()
 	privateToDER()
 	publicToDER()
@@ -1699,13 +1699,13 @@
   }
 };
 
-KeyLocator.prototype.from_ccnb = function(decoder) {
+KeyLocator.prototype.from_ndnb = function(decoder) {
 
 	decoder.readStartElement(this.getElementLabel());
 
-	if (decoder.peekStartElement(CCNProtocolDTags.Key)) {
+	if (decoder.peekStartElement(NDNProtocolDTags.Key)) {
 		try {
-			var encodedKey = decoder.readBinaryElement(CCNProtocolDTags.Key);
+			var encodedKey = decoder.readBinaryElement(NDNProtocolDTags.Key);
 			// This is a DER-encoded SubjectPublicKeyInfo.
 			
 			//TODO FIX THIS, This should create a Key Object instead of keeping bytes
@@ -1726,9 +1726,9 @@
 			throw new Error("Cannot parse key: ");
 		}
 
-	} else if ( decoder.peekStartElement(CCNProtocolDTags.Certificate)) {
+	} else if ( decoder.peekStartElement(NDNProtocolDTags.Certificate)) {
 		try {
-			var encodedCert = decoder.readBinaryElement(CCNProtocolDTags.Certificate);
+			var encodedCert = decoder.readBinaryElement(NDNProtocolDTags.Certificate);
 			
 			/*
 			 * Certificates not yet working
@@ -1753,13 +1753,13 @@
 		this.type = KeyLocatorType.KEYNAME;
 		
 		this.keyName = new KeyName();
-		this.keyName.from_ccnb(decoder);
+		this.keyName.from_ndnb(decoder);
 	}
 	decoder.readEndElement();
 };
 	
 
-KeyLocator.prototype.to_ccnb = function( encoder) {
+KeyLocator.prototype.to_ndnb = function( encoder) {
 	
 	if(LOG>4) console.log('type is is ' + this.type);
 	//TODO Check if Name is missing
@@ -1773,26 +1773,26 @@
 	
 	if (this.type == KeyLocatorType.KEY) {
 		if(LOG>5)console.log('About to encode a public key' +this.publicKey);
-		encoder.writeElement(CCNProtocolDTags.Key, this.publicKey);
+		encoder.writeElement(NDNProtocolDTags.Key, this.publicKey);
 		
 	} else if (this.type == KeyLocatorType.CERTIFICATE) {
 		
 		try {
-			encoder.writeElement(CCNProtocolDTags.Certificate, this.certificate);
+			encoder.writeElement(NDNProtocolDTags.Certificate, this.certificate);
 		} catch ( e) {
 			throw new Error("CertificateEncodingException attempting to write key locator: " + e);
 		}
 		
 	} else if (this.type == KeyLocatorType.KEYNAME) {
 		
-		this.keyName.to_ccnb(encoder);
+		this.keyName.to_ndnb(encoder);
 	}
 	encoder.writeEndElement();
 	
 };
 
 KeyLocator.prototype.getElementLabel = function() {
-	return CCNProtocolDTags.KeyLocator; 
+	return NDNProtocolDTags.KeyLocator; 
 };
 
 KeyLocator.prototype.validate = function() {
@@ -1809,39 +1809,39 @@
 
 };
 
-KeyName.prototype.from_ccnb=function( decoder){
+KeyName.prototype.from_ndnb=function( decoder){
 	
 
 	decoder.readStartElement(this.getElementLabel());
 
 	this.contentName = new Name();
-	this.contentName.from_ccnb(decoder);
+	this.contentName.from_ndnb(decoder);
 	
 	if(LOG>4) console.log('KEY NAME FOUND: ');
 	
 	if ( PublisherID.peek(decoder) ) {
 		this.publisherID = new PublisherID();
-		this.publisherID.from_ccnb(decoder);
+		this.publisherID.from_ndnb(decoder);
 	}
 	
 	decoder.readEndElement();
 };
 
-KeyName.prototype.to_ccnb = function( encoder) {
+KeyName.prototype.to_ndnb = function( encoder) {
 	if (!this.validate()) {
 		throw new Error("Cannot encode : field values missing.");
 	}
 	
 	encoder.writeStartElement(this.getElementLabel());
 	
-	this.contentName.to_ccnb(encoder);
+	this.contentName.to_ndnb(encoder);
 	if (null != this.publisherID)
-		this.publisherID.to_ccnb(encoder);
+		this.publisherID.to_ndnb(encoder);
 
 	encoder.writeEndElement();   		
 };
 	
-KeyName.prototype.getElementLabel = function() { return CCNProtocolDTags.KeyName; };
+KeyName.prototype.getElementLabel = function() { return NDNProtocolDTags.KeyName; };
 
 KeyName.prototype.validate = function() {
 		// DKS -- do we do recursive validation?
@@ -1859,19 +1859,19 @@
  * @constructor
  */
 var PublisherType = function PublisherType(tag){
-    	this.KEY =(CCNProtocolDTags.PublisherPublicKeyDigest);
-    	this.CERTIFICATE= (CCNProtocolDTags.PublisherCertificateDigest);
-    	this.ISSUER_KEY=	(CCNProtocolDTags.PublisherIssuerKeyDigest);
-    	this.ISSUER_CERTIFICATE	=(CCNProtocolDTags.PublisherIssuerCertificateDigest);
+    	this.KEY =(NDNProtocolDTags.PublisherPublicKeyDigest);
+    	this.CERTIFICATE= (NDNProtocolDTags.PublisherCertificateDigest);
+    	this.ISSUER_KEY=	(NDNProtocolDTags.PublisherIssuerKeyDigest);
+    	this.ISSUER_CERTIFICATE	=(NDNProtocolDTags.PublisherIssuerCertificateDigest);
 
     	this.Tag = tag;
 }; 
 
 var isTypeTagVal = function(tagVal) {
-		if ((tagVal == CCNProtocolDTags.PublisherPublicKeyDigest) ||
-			(tagVal == CCNProtocolDTags.PublisherCertificateDigest) ||
-			(tagVal == CCNProtocolDTags.PublisherIssuerKeyDigest) ||
-			(tagVal == CCNProtocolDTags.PublisherIssuerCertificateDigest)) {
+		if ((tagVal == NDNProtocolDTags.PublisherPublicKeyDigest) ||
+			(tagVal == NDNProtocolDTags.PublisherCertificateDigest) ||
+			(tagVal == NDNProtocolDTags.PublisherIssuerKeyDigest) ||
+			(tagVal == NDNProtocolDTags.PublisherIssuerCertificateDigest)) {
 			return true;
 		}
 		return false;
@@ -1897,7 +1897,7 @@
 };
 
 
-PublisherID.prototype.from_ccnb = function(decoder) {
+PublisherID.prototype.from_ndnb = function(decoder) {
 		
 		// We have a choice here of one of 4 binary element types.
 		var nextTag = decoder.peekStartElementAsLong();
@@ -1917,7 +1917,7 @@
 		}
 };
 
-PublisherID.prototype.to_ccnb = function(encoder) {
+PublisherID.prototype.to_ndnb = function(encoder) {
 	if (!this.validate()) {
 		throw new Error("Cannot encode " + this.getClass().getName() + ": field values missing.");
 	}
@@ -1968,7 +1968,7 @@
     
 };
 
-PublisherPublicKeyDigest.prototype.from_ccnb = function( decoder) {		
+PublisherPublicKeyDigest.prototype.from_ndnb = function( decoder) {		
 
 		this.publisherPublicKeyDigest = decoder.readBinaryElement(this.getElementLabel());
 		
@@ -1988,7 +1988,7 @@
 		}
 	};
 
-PublisherPublicKeyDigest.prototype.to_ccnb= function( encoder) {
+PublisherPublicKeyDigest.prototype.to_ndnb= function( encoder) {
 		//TODO Check that the ByteArray for the key is present
 		if (!this.validate()) {
 			throw new Error("Cannot encode : field values missing.");
@@ -1997,7 +1997,7 @@
 		encoder.writeElement(this.getElementLabel(), this.publisherPublicKeyDigest);
 };
 	
-PublisherPublicKeyDigest.prototype.getElementLabel = function() { return CCNProtocolDTags.PublisherPublicKeyDigest; };
+PublisherPublicKeyDigest.prototype.getElementLabel = function() { return NDNProtocolDTags.PublisherPublicKeyDigest; };
 
 PublisherPublicKeyDigest.prototype.validate =function() {
 		return (null != this.publisherPublicKeyDigest);
@@ -2029,31 +2029,31 @@
 /**
  * Used by NetworkObject to decode the object from a network stream.
  */
-FaceInstance.prototype.from_ccnb = function(//XMLDecoder 
+FaceInstance.prototype.from_ndnb = function(//XMLDecoder 
 	decoder) {
 
 	decoder.readStartElement(this.getElementLabel());
 	
-	if (decoder.peekStartElement(CCNProtocolDTags.Action)) {
+	if (decoder.peekStartElement(NDNProtocolDTags.Action)) {
 		
-		this.action = decoder.readUTF8Element(CCNProtocolDTags.Action);
+		this.action = decoder.readUTF8Element(NDNProtocolDTags.Action);
 		
 	}
-	if (decoder.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)) {
+	if (decoder.peekStartElement(NDNProtocolDTags.PublisherPublicKeyDigest)) {
 		
 		this.publisherPublicKeyDigest = new PublisherPublicKeyDigest();
-		this.publisherPublicKeyDigest.from_ccnb(decoder);
+		this.publisherPublicKeyDigest.from_ndnb(decoder);
 		
 	}
-	if (decoder.peekStartElement(CCNProtocolDTags.FaceID)) {
+	if (decoder.peekStartElement(NDNProtocolDTags.FaceID)) {
 		
-		this.faceID = decoder.readIntegerElement(CCNProtocolDTags.FaceID);
+		this.faceID = decoder.readIntegerElement(NDNProtocolDTags.FaceID);
 		
 	}
-	if (decoder.peekStartElement(CCNProtocolDTags.IPProto)) {
+	if (decoder.peekStartElement(NDNProtocolDTags.IPProto)) {
 		
 		//int
-		var pI = decoder.readIntegerElement(CCNProtocolDTags.IPProto);
+		var pI = decoder.readIntegerElement(NDNProtocolDTags.IPProto);
 		
 		this.ipProto = null;
 		
@@ -2068,31 +2068,31 @@
 		} else {
 			
 			throw new Error("FaceInstance.decoder.  Invalid " + 
-					CCNProtocolDTags.tagToString(CCNProtocolDTags.IPProto) + " field: " + pI);
+					NDNProtocolDTags.tagToString(NDNProtocolDTags.IPProto) + " field: " + pI);
 			
 		}
 	}
 	
-	if (decoder.peekStartElement(CCNProtocolDTags.Host)) {
+	if (decoder.peekStartElement(NDNProtocolDTags.Host)) {
 		
-		this.host = decoder.readUTF8Element(CCNProtocolDTags.Host);
+		this.host = decoder.readUTF8Element(NDNProtocolDTags.Host);
 		
 	}
 	
-	if (decoder.peekStartElement(CCNProtocolDTags.Port)) {
-		this.Port = decoder.readIntegerElement(CCNProtocolDTags.Port); 
+	if (decoder.peekStartElement(NDNProtocolDTags.Port)) {
+		this.Port = decoder.readIntegerElement(NDNProtocolDTags.Port); 
 	}
 	
-	if (decoder.peekStartElement(CCNProtocolDTags.MulticastInterface)) {
-		this.multicastInterface = decoder.readUTF8Element(CCNProtocolDTags.MulticastInterface); 
+	if (decoder.peekStartElement(NDNProtocolDTags.MulticastInterface)) {
+		this.multicastInterface = decoder.readUTF8Element(NDNProtocolDTags.MulticastInterface); 
 	}
 	
-	if (decoder.peekStartElement(CCNProtocolDTags.MulticastTTL)) {
-		this.multicastTTL = decoder.readIntegerElement(CCNProtocolDTags.MulticastTTL); 
+	if (decoder.peekStartElement(NDNProtocolDTags.MulticastTTL)) {
+		this.multicastTTL = decoder.readIntegerElement(NDNProtocolDTags.MulticastTTL); 
 	}
 	
-	if (decoder.peekStartElement(CCNProtocolDTags.FreshnessSeconds)) {
-		this.freshnessSeconds = decoder.readIntegerElement(CCNProtocolDTags.FreshnessSeconds); 
+	if (decoder.peekStartElement(NDNProtocolDTags.FreshnessSeconds)) {
+		this.freshnessSeconds = decoder.readIntegerElement(NDNProtocolDTags.FreshnessSeconds); 
 	}
 	decoder.readEndElement();
 }
@@ -2100,7 +2100,7 @@
 /**
  * Used by NetworkObject to encode the object to a network stream.
  */
-FaceInstance.prototype.to_ccnb = function(//XMLEncoder
+FaceInstance.prototype.to_ndnb = function(//XMLEncoder
 	encoder){
 
 	//if (!this.validate()) {
@@ -2110,39 +2110,39 @@
 	encoder.writeStartElement(this.getElementLabel());
 	
 	if (null != this.action && this.action.length != 0)
-		encoder.writeElement(CCNProtocolDTags.Action, this.action);	
+		encoder.writeElement(NDNProtocolDTags.Action, this.action);	
 	
 	if (null != this.publisherPublicKeyDigest) {
-		this.publisherPublicKeyDigest.to_ccnb(encoder);
+		this.publisherPublicKeyDigest.to_ndnb(encoder);
 	}
 	if (null != this.faceID) {
-		encoder.writeElement(CCNProtocolDTags.FaceID, this.faceID);
+		encoder.writeElement(NDNProtocolDTags.FaceID, this.faceID);
 	}
 	if (null != this.ipProto) {
-		//encoder.writeElement(CCNProtocolDTags.IPProto, this.IpProto.value());
-		encoder.writeElement(CCNProtocolDTags.IPProto, this.ipProto);
+		//encoder.writeElement(NDNProtocolDTags.IPProto, this.IpProto.value());
+		encoder.writeElement(NDNProtocolDTags.IPProto, this.ipProto);
 	}
 	if (null != this.host && this.host.length != 0) {
-		encoder.writeElement(CCNProtocolDTags.Host, this.host);	
+		encoder.writeElement(NDNProtocolDTags.Host, this.host);	
 	}
 	if (null != this.Port) {
-		encoder.writeElement(CCNProtocolDTags.Port, this.Port);
+		encoder.writeElement(NDNProtocolDTags.Port, this.Port);
 	}
 	if (null != this.multicastInterface && this.multicastInterface.length != 0) {
-		encoder.writeElement(CCNProtocolDTags.MulticastInterface, this.multicastInterface);
+		encoder.writeElement(NDNProtocolDTags.MulticastInterface, this.multicastInterface);
 	}
 	if (null !=  this.multicastTTL) {
-		encoder.writeElement(CCNProtocolDTags.MulticastTTL, this.multicastTTL);
+		encoder.writeElement(NDNProtocolDTags.MulticastTTL, this.multicastTTL);
 	}
 	if (null != this.freshnessSeconds) {
-		encoder.writeElement(CCNProtocolDTags.FreshnessSeconds, this.freshnessSeconds);
+		encoder.writeElement(NDNProtocolDTags.FreshnessSeconds, this.freshnessSeconds);
 	}
 	encoder.writeEndElement();   			
 }
 
 
 FaceInstance.prototype.getElementLabel = function() {
-  return CCNProtocolDTags.FaceInstance;
+  return NDNProtocolDTags.FaceInstance;
 };
 
 /**
@@ -2156,50 +2156,50 @@
  * @constructor
  * @param {String} action
  * @param {Name} prefixName
- * @param {PublisherPublicKeyDigest} ccndId
+ * @param {PublisherPublicKeyDigest} ndndId
  * @param {number} faceID
  * @param {number} flags
  * @param {number} lifetime in seconds
  */
-var ForwardingEntry = function ForwardingEntry(action, prefixName, ccndId, faceID, flags, lifetime) {
+var ForwardingEntry = function ForwardingEntry(action, prefixName, ndndId, faceID, flags, lifetime) {
 	this.action = action;
 	this.prefixName = prefixName;
-	this.ccndID = ccndId;
+	this.ndndID = ndndId;
 	this.faceID = faceID;
 	this.flags = flags;
 	this.lifetime = lifetime;
 };
 
-ForwardingEntry.prototype.from_ccnb =function(
+ForwardingEntry.prototype.from_ndnb =function(
 	//XMLDecoder 
 	decoder) 
 	//throws ContentDecodingException
 	{
 			decoder.readStartElement(this.getElementLabel());
-			if (decoder.peekStartElement(CCNProtocolDTags.Action)) {
-				this.action = decoder.readUTF8Element(CCNProtocolDTags.Action); 
+			if (decoder.peekStartElement(NDNProtocolDTags.Action)) {
+				this.action = decoder.readUTF8Element(NDNProtocolDTags.Action); 
 			}
-			if (decoder.peekStartElement(CCNProtocolDTags.Name)) {
+			if (decoder.peekStartElement(NDNProtocolDTags.Name)) {
 				this.prefixName = new Name();
-				this.prefixName.from_ccnb(decoder) ;
+				this.prefixName.from_ndnb(decoder) ;
 			}
-			if (decoder.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)) {
-				this.CcndId = new PublisherPublicKeyDigest();
-				this.CcndId.from_ccnb(decoder);
+			if (decoder.peekStartElement(NDNProtocolDTags.PublisherPublicKeyDigest)) {
+				this.NdndId = new PublisherPublicKeyDigest();
+				this.NdndId.from_ndnb(decoder);
 			}
-			if (decoder.peekStartElement(CCNProtocolDTags.FaceID)) {
-				this.faceID = decoder.readIntegerElement(CCNProtocolDTags.FaceID); 
+			if (decoder.peekStartElement(NDNProtocolDTags.FaceID)) {
+				this.faceID = decoder.readIntegerElement(NDNProtocolDTags.FaceID); 
 			}
-			if (decoder.peekStartElement(CCNProtocolDTags.ForwardingFlags)) {
-				this.flags = decoder.readIntegerElement(CCNProtocolDTags.ForwardingFlags); 
+			if (decoder.peekStartElement(NDNProtocolDTags.ForwardingFlags)) {
+				this.flags = decoder.readIntegerElement(NDNProtocolDTags.ForwardingFlags); 
 			}
-			if (decoder.peekStartElement(CCNProtocolDTags.FreshnessSeconds)) {
-				this.lifetime = decoder.readIntegerElement(CCNProtocolDTags.FreshnessSeconds); 
+			if (decoder.peekStartElement(NDNProtocolDTags.FreshnessSeconds)) {
+				this.lifetime = decoder.readIntegerElement(NDNProtocolDTags.FreshnessSeconds); 
 			}
 			decoder.readEndElement();
 		};
 
-ForwardingEntry.prototype.to_ccnb =function(
+ForwardingEntry.prototype.to_ndnb =function(
 	//XMLEncoder 
 encoder) 
 {
@@ -2210,26 +2210,26 @@
 			//}
 			encoder.writeStartElement(this.getElementLabel());
 			if (null != this.action && this.action.length != 0)
-				encoder.writeElement(CCNProtocolDTags.Action, this.action);	
+				encoder.writeElement(NDNProtocolDTags.Action, this.action);	
 			if (null != this.prefixName) {
-				this.prefixName.to_ccnb(encoder);
+				this.prefixName.to_ndnb(encoder);
 			}
-			if (null != this.CcndId) {
-				this.CcndId.to_ccnb(encoder);
+			if (null != this.NdndId) {
+				this.NdndId.to_ndnb(encoder);
 			}
 			if (null != this.faceID) {
-				encoder.writeElement(CCNProtocolDTags.FaceID, this.faceID);
+				encoder.writeElement(NDNProtocolDTags.FaceID, this.faceID);
 			}
 			if (null != this.flags) {
-				encoder.writeElement(CCNProtocolDTags.ForwardingFlags, this.flags);
+				encoder.writeElement(NDNProtocolDTags.ForwardingFlags, this.flags);
 			}
 			if (null != this.lifetime) {
-				encoder.writeElement(CCNProtocolDTags.FreshnessSeconds, this.lifetime);
+				encoder.writeElement(NDNProtocolDTags.FreshnessSeconds, this.lifetime);
 			}
 			encoder.writeEndElement();   			
 		};
 
-ForwardingEntry.prototype.getElementLabel = function() { return CCNProtocolDTags.ForwardingEntry; }
+ForwardingEntry.prototype.getElementLabel = function() { return NDNProtocolDTags.ForwardingEntry; }
 /**
  * @author: Jeff Thompson
  * See COPYING for copyright and distribution information.
@@ -2286,7 +2286,7 @@
     return this.array.subarray(begin, end);
 };
 /**
- * This class is used to encode ccnb binary elements (blob, type/value pairs).
+ * This class is used to encode ndnb binary elements (blob, type/value pairs).
  * 
  * @author: Meki Cheraoui
  * See COPYING for copyright and distribution information.
@@ -2409,10 +2409,10 @@
 
 //returns a string
 stringToTag = function(/*long*/ tagVal) {
-	if ((tagVal >= 0) && (tagVal < CCNProtocolDTagsStrings.length)) {
-		return CCNProtocolDTagsStrings[tagVal];
-	} else if (tagVal == CCNProtocolDTags.CCNProtocolDataUnit) {
-		return CCNProtocolDTags.CCNPROTOCOL_DATA_UNIT;
+	if ((tagVal >= 0) && (tagVal < NDNProtocolDTagsStrings.length)) {
+		return NDNProtocolDTagsStrings[tagVal];
+	} else if (tagVal == NDNProtocolDTags.NDNProtocolDataUnit) {
+		return NDNProtocolDTags.NDNPROTOCOL_DATA_UNIT;
 	}
 	return null;
 };
@@ -2420,13 +2420,13 @@
 //returns a Long
 tagToString =  function(/*String*/ tagName) {
 	// the slow way, but right now we don't care.... want a static lookup for the forward direction
-	for (var i=0; i < CCNProtocolDTagsStrings.length; ++i) {
-		if ((null != CCNProtocolDTagsStrings[i]) && (CCNProtocolDTagsStrings[i] == tagName)) {
+	for (var i=0; i < NDNProtocolDTagsStrings.length; ++i) {
+		if ((null != NDNProtocolDTagsStrings[i]) && (NDNProtocolDTagsStrings[i] == tagName)) {
 			return i;
 		}
 	}
-	if (CCNProtocolDTags.CCNPROTOCOL_DATA_UNIT == tagName) {
-		return CCNProtocolDTags.CCNProtocolDataUnit;
+	if (NDNProtocolDTags.NDNPROTOCOL_DATA_UNIT == tagName) {
+		return NDNProtocolDTags.NDNProtocolDataUnit;
 	}
 	return null;
 };
@@ -2608,7 +2608,7 @@
 BinaryXMLEncoder.prototype.writeDateTime = function(
 		//String 
 		tag, 
-		//CCNTime 
+		//NDNTime 
 		dateTime) {
 	
 	if(LOG>4)console.log('ENCODING DATE with LONG VALUE');
@@ -2677,7 +2677,7 @@
 };
 
 /**
- * This class is used to decode ccnb binary elements (blob, type/value pairs).
+ * This class is used to decode ndnb binary elements (blob, type/value pairs).
  * 
  * @author: Meki Cheraoui
  * See COPYING for copyright and distribution information.
@@ -2721,10 +2721,10 @@
 
 //returns a string
 tagToString = function(/*long*/ tagVal) {
-	if ((tagVal >= 0) && (tagVal < CCNProtocolDTagsStrings.length)) {
-		return CCNProtocolDTagsStrings[tagVal];
-	} else if (tagVal == CCNProtocolDTags.CCNProtocolDataUnit) {
-		return CCNProtocolDTags.CCNPROTOCOL_DATA_UNIT;
+	if ((tagVal >= 0) && (tagVal < NDNProtocolDTagsStrings.length)) {
+		return NDNProtocolDTagsStrings[tagVal];
+	} else if (tagVal == NDNProtocolDTags.NDNProtocolDataUnit) {
+		return NDNProtocolDTags.NDNPROTOCOL_DATA_UNIT;
 	}
 	return null;
 };
@@ -2732,13 +2732,13 @@
 //returns a Long
 stringToTag =  function(/*String*/ tagName) {
 	// the slow way, but right now we don't care.... want a static lookup for the forward direction
-	for (var i=0; i < CCNProtocolDTagsStrings.length; ++i) {
-		if ((null != CCNProtocolDTagsStrings[i]) && (CCNProtocolDTagsStrings[i] == tagName)) {
+	for (var i=0; i < NDNProtocolDTagsStrings.length; ++i) {
+		if ((null != NDNProtocolDTagsStrings[i]) && (NDNProtocolDTagsStrings[i] == tagName)) {
 			return i;
 		}
 	}
-	if (CCNProtocolDTags.CCNPROTOCOL_DATA_UNIT == tagName) {
-		return CCNProtocolDTags.CCNProtocolDataUnit;
+	if (NDNProtocolDTags.NDNPROTOCOL_DATA_UNIT == tagName) {
+		return NDNProtocolDTags.NDNProtocolDataUnit;
 	}
 	return null;
 };
@@ -3077,7 +3077,7 @@
 };
 
 
-//CCNTime
+//NDNTime
 BinaryXMLDecoder.prototype.readDateTime = function(
 	//long 
 	startTag)  {
@@ -3100,8 +3100,8 @@
 	if(LOG>4) console.log(lontimestamp);
 	
 
-	//CCNTime 
-	var timestamp = new CCNTime(lontimestamp);
+	//NDNTime 
+	var timestamp = new NDNTime(lontimestamp);
 	//timestamp.setDateBinary(byteTimestamp);
 	
 	if (null == timestamp) {
@@ -3292,7 +3292,7 @@
 ContentDecodingException.prototype.name = "ContentDecodingException";
 
 /**
- * This class uses BinaryXMLDecoder to follow the structure of a ccnb binary element to 
+ * This class uses BinaryXMLDecoder to follow the structure of a ndnb binary element to 
  * determine its end.
  * 
  * @author: Jeff Thompson
@@ -3321,7 +3321,7 @@
  *   which started at offset 0 then return true, else false.
  * If this returns false, you should read more into input and call again.
  * You have to pass in input each time because the array could be reallocated.
- * This throws an exception for badly formed ccnb.
+ * This throws an exception for badly formed ndnb.
  */
 BinaryXMLStructureDecoder.prototype.findElementEnd = function(
     // Uint8Array
@@ -3400,7 +3400,7 @@
                 var type = typeAndVal.t;
                 if (type == XML_DATTR)
                     // We already consumed the item. READ_HEADER_OR_CLOSE again.
-                    // ccnb has rules about what must follow an attribute, but we are just scanning.
+                    // ndnb has rules about what must follow an attribute, but we are just scanning.
                     this.startHeader();
                 else if (type == XML_DTAG || type == XML_EXT) {
                     // Start a new level and READ_HEADER_OR_CLOSE again.
@@ -3414,7 +3414,7 @@
                     // Minimum tag or attribute length is 1.
                     this.nBytesToRead = typeAndVal.v + 1;
                     this.state = BinaryXMLStructureDecoder.READ_BYTES;
-                    // ccnb has rules about what must follow an attribute, but we are just scanning.
+                    // ndnb has rules about what must follow an attribute, but we are just scanning.
                 }
                 else if (type == XML_BLOB || type == XML_UDATA) {
                     this.nBytesToRead = typeAndVal.v;
@@ -3579,37 +3579,37 @@
  * @param {BinaryXMLEncoder} encoder
  */
 BinaryXmlWireFormat.encodeInterest = function(interest, encoder) {
-	encoder.writeStartElement(CCNProtocolDTags.Interest);
+	encoder.writeStartElement(NDNProtocolDTags.Interest);
 		
-	interest.name.to_ccnb(encoder);
+	interest.name.to_ndnb(encoder);
 	
 	if (null != interest.minSuffixComponents) 
-		encoder.writeElement(CCNProtocolDTags.MinSuffixComponents, interest.minSuffixComponents);	
+		encoder.writeElement(NDNProtocolDTags.MinSuffixComponents, interest.minSuffixComponents);	
 
 	if (null != interest.maxSuffixComponents) 
-		encoder.writeElement(CCNProtocolDTags.MaxSuffixComponents, interest.maxSuffixComponents);
+		encoder.writeElement(NDNProtocolDTags.MaxSuffixComponents, interest.maxSuffixComponents);
 
 	if (null != interest.publisherPublicKeyDigest)
-		interest.publisherPublicKeyDigest.to_ccnb(encoder);
+		interest.publisherPublicKeyDigest.to_ndnb(encoder);
 		
 	if (null != interest.exclude)
-		interest.exclude.to_ccnb(encoder);
+		interest.exclude.to_ndnb(encoder);
 		
 	if (null != interest.childSelector) 
-		encoder.writeElement(CCNProtocolDTags.ChildSelector, interest.childSelector);
+		encoder.writeElement(NDNProtocolDTags.ChildSelector, interest.childSelector);
 
 	if (interest.DEFAULT_ANSWER_ORIGIN_KIND != interest.answerOriginKind && interest.answerOriginKind!=null) 
-		encoder.writeElement(CCNProtocolDTags.AnswerOriginKind, interest.answerOriginKind);
+		encoder.writeElement(NDNProtocolDTags.AnswerOriginKind, interest.answerOriginKind);
 		
 	if (null != interest.scope) 
-		encoder.writeElement(CCNProtocolDTags.Scope, interest.scope);
+		encoder.writeElement(NDNProtocolDTags.Scope, interest.scope);
 		
 	if (null != interest.interestLifetime) 
-		encoder.writeElement(CCNProtocolDTags.InterestLifetime, 
+		encoder.writeElement(NDNProtocolDTags.InterestLifetime, 
                 DataUtils.nonNegativeIntToBigEndian((interest.interestLifetime / 1000.0) * 4096));
 		
 	if (null != interest.nonce)
-		encoder.writeElement(CCNProtocolDTags.Nonce, interest.nonce);
+		encoder.writeElement(NDNProtocolDTags.Nonce, interest.nonce);
 		
 	encoder.writeEndElement();
 };
@@ -3620,58 +3620,58 @@
  * @param {BinaryXMLDecoder} decoder
  */
 BinaryXmlWireFormat.decodeInterest = function(interest, decoder) {
-	decoder.readStartElement(CCNProtocolDTags.Interest);
+	decoder.readStartElement(NDNProtocolDTags.Interest);
 
 	interest.name = new Name();
-	interest.name.from_ccnb(decoder);
+	interest.name.from_ndnb(decoder);
 
-	if (decoder.peekStartElement(CCNProtocolDTags.MinSuffixComponents))
-		interest.minSuffixComponents = decoder.readIntegerElement(CCNProtocolDTags.MinSuffixComponents);
+	if (decoder.peekStartElement(NDNProtocolDTags.MinSuffixComponents))
+		interest.minSuffixComponents = decoder.readIntegerElement(NDNProtocolDTags.MinSuffixComponents);
   else
     interest.minSuffixComponents = null;
 
-	if (decoder.peekStartElement(CCNProtocolDTags.MaxSuffixComponents)) 
-		interest.maxSuffixComponents = decoder.readIntegerElement(CCNProtocolDTags.MaxSuffixComponents);
+	if (decoder.peekStartElement(NDNProtocolDTags.MaxSuffixComponents)) 
+		interest.maxSuffixComponents = decoder.readIntegerElement(NDNProtocolDTags.MaxSuffixComponents);
   else
     interest.maxSuffixComponents = null;
 			
-	if (decoder.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)) {
+	if (decoder.peekStartElement(NDNProtocolDTags.PublisherPublicKeyDigest)) {
 		interest.publisherPublicKeyDigest = new PublisherPublicKeyDigest();
-		interest.publisherPublicKeyDigest.from_ccnb(decoder);
+		interest.publisherPublicKeyDigest.from_ndnb(decoder);
 	}
   else
     interest.publisherPublicKeyDigest = null;
 
-	if (decoder.peekStartElement(CCNProtocolDTags.Exclude)) {
+	if (decoder.peekStartElement(NDNProtocolDTags.Exclude)) {
 		interest.exclude = new Exclude();
-		interest.exclude.from_ccnb(decoder);
+		interest.exclude.from_ndnb(decoder);
 	}
   else
     interest.exclude = null;
 		
-	if (decoder.peekStartElement(CCNProtocolDTags.ChildSelector))
-		interest.childSelector = decoder.readIntegerElement(CCNProtocolDTags.ChildSelector);
+	if (decoder.peekStartElement(NDNProtocolDTags.ChildSelector))
+		interest.childSelector = decoder.readIntegerElement(NDNProtocolDTags.ChildSelector);
   else
     interest.childSelector = null;
 		
-	if (decoder.peekStartElement(CCNProtocolDTags.AnswerOriginKind))
-		interest.answerOriginKind = decoder.readIntegerElement(CCNProtocolDTags.AnswerOriginKind);
+	if (decoder.peekStartElement(NDNProtocolDTags.AnswerOriginKind))
+		interest.answerOriginKind = decoder.readIntegerElement(NDNProtocolDTags.AnswerOriginKind);
   else
     interest.answerOriginKind = null;
 		
-	if (decoder.peekStartElement(CCNProtocolDTags.Scope))
-		interest.scope = decoder.readIntegerElement(CCNProtocolDTags.Scope);
+	if (decoder.peekStartElement(NDNProtocolDTags.Scope))
+		interest.scope = decoder.readIntegerElement(NDNProtocolDTags.Scope);
   else
     interest.scope = null;
 
-	if (decoder.peekStartElement(CCNProtocolDTags.InterestLifetime))
+	if (decoder.peekStartElement(NDNProtocolDTags.InterestLifetime))
 		interest.interestLifetime = 1000.0 * DataUtils.bigEndianToUnsignedInt
-               (decoder.readBinaryElement(CCNProtocolDTags.InterestLifetime)) / 4096;
+               (decoder.readBinaryElement(NDNProtocolDTags.InterestLifetime)) / 4096;
   else
     interest.interestLifetime = null;              
 		
-	if (decoder.peekStartElement(CCNProtocolDTags.Nonce))
-		interest.nonce = decoder.readBinaryElement(CCNProtocolDTags.Nonce);
+	if (decoder.peekStartElement(NDNProtocolDTags.Nonce))
+		interest.nonce = decoder.readBinaryElement(NDNProtocolDTags.Nonce);
   else
     interest.nonce = null;
 		
@@ -3688,17 +3688,17 @@
 	encoder.writeStartElement(contentObject.getElementLabel());
 
 	if (null != contentObject.signature) 
-    contentObject.signature.to_ccnb(encoder);
+    contentObject.signature.to_ndnb(encoder);
 		
 	contentObject.startSIG = encoder.offset;
 
 	if (null != contentObject.name) 
-    contentObject.name.to_ccnb(encoder);
+    contentObject.name.to_ndnb(encoder);
 	
 	if (null != contentObject.signedInfo) 
-    contentObject.signedInfo.to_ccnb(encoder);
+    contentObject.signedInfo.to_ndnb(encoder);
 
-	encoder.writeElement(CCNProtocolDTags.Content, contentObject.content);
+	encoder.writeElement(NDNProtocolDTags.Content, contentObject.content);
 	
 	contentObject.endSIG = encoder.offset;
 	
@@ -3716,9 +3716,9 @@
 	// TODO VALIDATE THAT ALL FIELDS EXCEPT SIGNATURE ARE PRESENT
   decoder.readStartElement(contentObject.getElementLabel());
 
-	if( decoder.peekStartElement(CCNProtocolDTags.Signature) ){
+	if( decoder.peekStartElement(NDNProtocolDTags.Signature) ){
 		contentObject.signature = new Signature();
-		contentObject.signature.from_ccnb(decoder);
+		contentObject.signature.from_ndnb(decoder);
 	}
   else
     contentObject.signature = null;
@@ -3726,16 +3726,16 @@
 	contentObject.startSIG = decoder.offset;
 
 	contentObject.name = new Name();
-	contentObject.name.from_ccnb(decoder);
+	contentObject.name.from_ndnb(decoder);
 		
-	if( decoder.peekStartElement(CCNProtocolDTags.SignedInfo) ){
+	if( decoder.peekStartElement(NDNProtocolDTags.SignedInfo) ){
 		contentObject.signedInfo = new SignedInfo();
-		contentObject.signedInfo.from_ccnb(decoder);
+		contentObject.signedInfo.from_ndnb(decoder);
 	}
   else
     contentObject.signedInfo = null;
 
-  contentObject.content = decoder.readBinaryElement(CCNProtocolDTags.Content, null, true);
+  contentObject.content = decoder.readBinaryElement(NDNProtocolDTags.Content, null, true);
 		
 	contentObject.endSIG = decoder.offset;
 		
@@ -3851,7 +3851,7 @@
 
      } while (i < input.length);
 
-     //return unescape(output);
+     return output;
   };
 
 /**
@@ -4079,7 +4079,7 @@
 function encodeForwardingEntry(co) {
 	var enc = new BinaryXMLEncoder();
  
-	co.to_ccnb(enc);
+	co.to_ndnb(enc);
 	
 	var bytes = enc.getReducedOstream();
 
@@ -4101,7 +4101,7 @@
 
 	var faceInstance = new FaceInstance();
 
-	faceInstance.from_ccnb(decoder);
+	faceInstance.from_ndnb(decoder);
 
 	return faceInstance;
 	
@@ -4128,7 +4128,7 @@
 	
 	var forwardingEntry = new ForwardingEntry();
 
-	forwardingEntry.from_ccnb(decoder);
+	forwardingEntry.from_ndnb(decoder);
 
 	return forwardingEntry;
 	
@@ -7657,12 +7657,12 @@
   // Event handler
   this.onopen = (settings.onopen || function() { if (LOG > 3) console.log("NDN connection established."); });
   this.onclose = (settings.onclose || function() { if (LOG > 3) console.log("NDN connection closed."); });
-	this.ccndid = null;
+	this.ndndid = null;
 };
 
 NDN.UNOPEN = 0;  // created but not opened yet
-NDN.OPENED = 1;  // connection to ccnd opened
-NDN.CLOSED = 2;  // connection to ccnd closed
+NDN.OPENED = 1;  // connection to ndnd opened
+NDN.CLOSED = 2;  // connection to ndnd closed
 
 /**
  * Return true if necessary JavaScript support is available, else log an error and return false.
@@ -7680,7 +7680,7 @@
 
 NDN.supported = NDN.getSupported();
 
-NDN.ccndIdFetcher = new Name('/%C1.M.S.localhost/%C1.M.SRV/ccnd/KEY');
+NDN.ndndIdFetcher = new Name('/%C1.M.S.localhost/%C1.M.SRV/ndnd/KEY');
 
 NDN.prototype.createRoute = function(host, port) {
 	this.host=host;
@@ -7884,13 +7884,13 @@
 NDN.prototype.registerPrefix = function(name, closure, flag) {
     var thisNDN = this;
     var onConnected = function() {
-    	if (thisNDN.ccndid == null) {
-            // Fetch ccndid first, then register.
-            var interest = new Interest(NDN.ccndIdFetcher);
+    	if (thisNDN.ndndid == null) {
+            // Fetch ndndid first, then register.
+            var interest = new Interest(NDN.ndndIdFetcher);
     		interest.interestLifetime = 4000; // milliseconds
-            if (LOG>3) console.log('Expressing interest for ccndid from ccnd.');
+            if (LOG>3) console.log('Expressing interest for ndndid from ndnd.');
             thisNDN.reconnectAndExpressInterest
-               (interest, new NDN.FetchCcndidClosure(thisNDN, name, closure, flag));
+               (interest, new NDN.FetchNdndidClosure(thisNDN, name, closure, flag));
         }
         else	
             thisNDN.registerPrefixHelper(name, closure, flag);
@@ -7907,10 +7907,10 @@
 };
 
 /**
- * This is a closure to receive the ContentObject for NDN.ccndIdFetcher and call
+ * This is a closure to receive the ContentObject for NDN.ndndIdFetcher and call
  *   registerPrefixHelper(name, callerClosure, flag).
  */
-NDN.FetchCcndidClosure = function FetchCcndidClosure(ndn, name, callerClosure, flag) {
+NDN.FetchNdndidClosure = function FetchNdndidClosure(ndn, name, callerClosure, flag) {
     // Inherit from Closure.
     Closure.call(this);
     
@@ -7920,9 +7920,9 @@
     this.flag = flag;
 };
 
-NDN.FetchCcndidClosure.prototype.upcall = function(kind, upcallInfo) {
+NDN.FetchNdndidClosure.prototype.upcall = function(kind, upcallInfo) {
     if (kind == Closure.UPCALL_INTEREST_TIMED_OUT) {
-        console.log("Timeout while requesting the ccndid.  Cannot registerPrefix for " +
+        console.log("Timeout while requesting the ndndid.  Cannot registerPrefix for " +
             this.name.to_uri() + " .");
         return Closure.RESULT_OK;
     }
@@ -7935,12 +7935,12 @@
     if (!co.signedInfo || !co.signedInfo.publisher 
 		|| !co.signedInfo.publisher.publisherPublicKeyDigest)
         console.log
-          ("ContentObject doesn't have a publisherPublicKeyDigest. Cannot set ccndid and registerPrefix for "
+          ("ContentObject doesn't have a publisherPublicKeyDigest. Cannot set ndndid and registerPrefix for "
            + this.name.to_uri() + " .");
     else {
-		if (LOG>3) console.log('Got ccndid from ccnd.');
-		this.ndn.ccndid = co.signedInfo.publisher.publisherPublicKeyDigest;
-		if (LOG>3) console.log(this.ndn.ccndid);
+		if (LOG>3) console.log('Got ndndid from ndnd.');
+		this.ndn.ndndid = co.signedInfo.publisher.publisherPublicKeyDigest;
+		if (LOG>3) console.log(this.ndn.ndndid);
         
         this.ndn.registerPrefixHelper(this.name, this.callerClosure, this.flag);
 	}
@@ -7949,7 +7949,7 @@
 };
 
 /**
- * Do the work of registerPrefix once we know we are connected with a ccndid.
+ * Do the work of registerPrefix once we know we are connected with a ndndid.
  */
 NDN.prototype.registerPrefixHelper = function(name, closure, flag) {
 	var fe = new ForwardingEntry('selfreg', name, null, null, 3, 2147483647);
@@ -7963,8 +7963,8 @@
 	var coBinary = encodeToBinaryContentObject(co);
 		
 	//var nodename = unescape('%00%88%E2%F4%9C%91%16%16%D6%21%8E%A0c%95%A5%A6r%11%E0%A0%82%89%A6%A9%85%AB%D6%E2%065%DB%AF');
-	var nodename = this.ccndid;
-	var interestName = new Name(['ccnx', nodename, 'selfreg', coBinary]);
+	var nodename = this.ndndid;
+	var interestName = new Name(['ndnx', nodename, 'selfreg', coBinary]);
 
 	var interest = new Interest(interestName);
 	interest.scope = 1;
@@ -7984,11 +7984,11 @@
     if (LOG>3) console.log('Complete element received. Length ' + element.length + '. Start decoding.');
 	var decoder = new BinaryXMLDecoder(element);
 	// Dispatch according to packet type
-	if (decoder.peekStartElement(CCNProtocolDTags.Interest)) {  // Interest packet
+	if (decoder.peekStartElement(NDNProtocolDTags.Interest)) {  // Interest packet
 		if (LOG > 3) console.log('Interest packet received.');
 				
 		var interest = new Interest();
-		interest.from_ccnb(decoder);
+		interest.from_ndnb(decoder);
 		if (LOG > 3) console.log(interest);
 		var nameStr = escape(interest.name.getName());
 		if (LOG > 3) console.log(nameStr);
@@ -8001,11 +8001,11 @@
 			if (ret == Closure.RESULT_INTEREST_CONSUMED && info.contentObject != null) 
 				this.transport.send(encodeToBinaryContentObject(info.contentObject));
 		}				
-	} else if (decoder.peekStartElement(CCNProtocolDTags.ContentObject)) {  // Content packet
+	} else if (decoder.peekStartElement(NDNProtocolDTags.ContentObject)) {  // Content packet
 		if (LOG > 3) console.log('ContentObject packet received.');
 				
 		var co = new ContentObject();
-		co.from_ccnb(decoder);
+		co.from_ndnb(decoder);
 				
 		var pitEntry = NDN.getEntryForExpressedInterest(co.name);
 		if (pitEntry != null) {
@@ -8219,7 +8219,7 @@
 BinaryXmlElementReader.prototype.onReceivedData = function(/* Uint8Array */ data) {
     // Process multiple objects in the data.
     while(true) {
-        // Scan the input to check if a whole ccnb object has been read.
+        // Scan the input to check if a whole ndnb object has been read.
         this.structureDecoder.seek(0);
         if (this.structureDecoder.findElementEnd(data)) {
             // Got the remainder of an object.  Report to the caller.
diff --git a/build/ndn-js.min.js b/build/ndn-js.min.js
index 1b35fd9..2eb6fc2 100644
--- a/build/ndn-js.min.js
+++ b/build/ndn-js.min.js
@@ -4,88 +4,88 @@
 WebSocketTransport.prototype.connect=function(a,b){null!=this.ws&&delete this.ws;this.ws=new WebSocket("ws://"+a.host+":"+a.port);0<LOG&&console.log("ws connection created.");this.connectedHost=a.host;this.connectedPort=a.port;this.ws.binaryType="arraybuffer";this.elementReader=new BinaryXmlElementReader(a);var c=this;this.ws.onmessage=function(a){a=a.data;if(null==a||void 0==a||""==a)console.log("INVALID ANSWER");else if(a instanceof ArrayBuffer){a=new Uint8Array(a);3<LOG&&console.log("BINARY RESPONSE IS "+
 DataUtils.toHex(a));try{c.elementReader.onReceivedData(a)}catch(b){console.log("NDN.ws.onmessage exception: "+b)}}};this.ws.onopen=function(a){3<LOG&&console.log(a);3<LOG&&console.log("ws.onopen: WebSocket connection opened.");3<LOG&&console.log("ws.onopen: ReadyState: "+this.readyState);b()};this.ws.onerror=function(a){console.log("ws.onerror: ReadyState: "+this.readyState);console.log(a);console.log("ws.onerror: WebSocket error: "+a.data)};this.ws.onclose=function(){console.log("ws.onclose: WebSocket connection closed.");
 c.ws=null;a.readyStatus=NDN.CLOSED;a.onclose()}};WebSocketTransport.prototype.send=function(a){if(null!=this.ws){var b=new Uint8Array(a.length);b.set(a);this.ws.send(b.buffer);3<LOG&&console.log("ws.send() returned.")}else console.log("WebSocket connection is not established.")};
-var CCNProtocolDTags={Any:13,Name:14,Component:15,Certificate:16,Collection:17,CompleteName:18,Content:19,SignedInfo:20,ContentDigest:21,ContentHash:22,Count:24,Header:25,Interest:26,Key:27,KeyLocator:28,KeyName:29,Length:30,Link:31,LinkAuthenticator:32,NameComponentCount:33,RootDigest:36,Signature:37,Start:38,Timestamp:39,Type:40,Nonce:41,Scope:42,Exclude:43,Bloom:44,BloomSeed:45,AnswerOriginKind:47,InterestLifetime:48,Witness:53,SignatureBits:54,DigestAlgorithm:55,BlockSize:56,FreshnessSeconds:58,
+var NDNProtocolDTags={Any:13,Name:14,Component:15,Certificate:16,Collection:17,CompleteName:18,Content:19,SignedInfo:20,ContentDigest:21,ContentHash:22,Count:24,Header:25,Interest:26,Key:27,KeyLocator:28,KeyName:29,Length:30,Link:31,LinkAuthenticator:32,NameComponentCount:33,RootDigest:36,Signature:37,Start:38,Timestamp:39,Type:40,Nonce:41,Scope:42,Exclude:43,Bloom:44,BloomSeed:45,AnswerOriginKind:47,InterestLifetime:48,Witness:53,SignatureBits:54,DigestAlgorithm:55,BlockSize:56,FreshnessSeconds:58,
 FinalBlockID:59,PublisherPublicKeyDigest:60,PublisherCertificateDigest:61,PublisherIssuerKeyDigest:62,PublisherIssuerCertificateDigest:63,ContentObject:64,WrappedKey:65,WrappingKeyIdentifier:66,WrapAlgorithm:67,KeyAlgorithm:68,Label:69,EncryptedKey:70,EncryptedNonceKey:71,WrappingKeyName:72,Action:73,FaceID:74,IPProto:75,Host:76,Port:77,MulticastInterface:78,ForwardingFlags:79,FaceInstance:80,ForwardingEntry:81,MulticastTTL:82,MinSuffixComponents:83,MaxSuffixComponents:84,ChildSelector:85,RepositoryInfo:86,
 Version:87,RepositoryVersion:88,GlobalPrefix:89,LocalName:90,Policy:91,Namespace:92,GlobalPrefixName:93,PolicyVersion:94,KeyValueSet:95,KeyValuePair:96,IntegerValue:97,DecimalValue:98,StringValue:99,BinaryValue:100,NameValue:101,Entry:102,ACL:103,ParameterizedName:104,Prefix:105,Suffix:106,Root:107,ProfileName:108,Parameters:109,InfoString:110,StatusResponse:112,StatusCode:113,StatusText:114,SyncNode:115,SyncNodeKind:116,SyncNodeElement:117,SyncVersion:118,SyncNodeElements:119,SyncContentHash:120,
-SyncLeafCount:121,SyncTreeDepth:122,SyncByteCount:123,ConfigSlice:124,ConfigSliceList:125,ConfigSliceOp:126,CCNProtocolDataUnit:17702112,CCNPROTOCOL_DATA_UNIT:"CCNProtocolDataUnit"},CCNProtocolDTagsStrings=[null,null,null,null,null,null,null,null,null,null,null,null,null,"Any","Name","Component","Certificate","Collection","CompleteName","Content","SignedInfo","ContentDigest","ContentHash",null,"Count","Header","Interest","Key","KeyLocator","KeyName","Length","Link","LinkAuthenticator","NameComponentCount",
+SyncLeafCount:121,SyncTreeDepth:122,SyncByteCount:123,ConfigSlice:124,ConfigSliceList:125,ConfigSliceOp:126,NDNProtocolDataUnit:17702112,NDNPROTOCOL_DATA_UNIT:"NDNProtocolDataUnit"},NDNProtocolDTagsStrings=[null,null,null,null,null,null,null,null,null,null,null,null,null,"Any","Name","Component","Certificate","Collection","CompleteName","Content","SignedInfo","ContentDigest","ContentHash",null,"Count","Header","Interest","Key","KeyLocator","KeyName","Length","Link","LinkAuthenticator","NameComponentCount",
 null,null,"RootDigest","Signature","Start","Timestamp","Type","Nonce","Scope","Exclude","Bloom","BloomSeed",null,"AnswerOriginKind","InterestLifetime",null,null,null,null,"Witness","SignatureBits","DigestAlgorithm","BlockSize",null,"FreshnessSeconds","FinalBlockID","PublisherPublicKeyDigest","PublisherCertificateDigest","PublisherIssuerKeyDigest","PublisherIssuerCertificateDigest","ContentObject","WrappedKey","WrappingKeyIdentifier","WrapAlgorithm","KeyAlgorithm","Label","EncryptedKey","EncryptedNonceKey",
 "WrappingKeyName","Action","FaceID","IPProto","Host","Port","MulticastInterface","ForwardingFlags","FaceInstance","ForwardingEntry","MulticastTTL","MinSuffixComponents","MaxSuffixComponents","ChildSelector","RepositoryInfo","Version","RepositoryVersion","GlobalPrefix","LocalName","Policy","Namespace","GlobalPrefixName","PolicyVersion","KeyValueSet","KeyValuePair","IntegerValue","DecimalValue","StringValue","BinaryValue","NameValue","Entry","ACL","ParameterizedName","Prefix","Suffix","Root","ProfileName",
-"Parameters","InfoString",null,"StatusResponse","StatusCode","StatusText","SyncNode","SyncNodeKind","SyncNodeElement","SyncVersion","SyncNodeElements","SyncContentHash","SyncLeafCount","SyncTreeDepth","SyncByteCount","ConfigSlice","ConfigSliceList","ConfigSliceOp"],CCNTime=function(a){this.NANOS_MAX=999877929;"number"==typeof a?this.msec=a:1<LOG&&console.log("UNRECOGNIZED TYPE FOR TIME")};CCNTime.prototype.getJavascriptDate=function(){var a=new Date;a.setTime(this.msec);return a};
+"Parameters","InfoString",null,"StatusResponse","StatusCode","StatusText","SyncNode","SyncNodeKind","SyncNodeElement","SyncVersion","SyncNodeElements","SyncContentHash","SyncLeafCount","SyncTreeDepth","SyncByteCount","ConfigSlice","ConfigSliceList","ConfigSliceOp"],NDNTime=function(a){this.NANOS_MAX=999877929;"number"==typeof a?this.msec=a:1<LOG&&console.log("UNRECOGNIZED TYPE FOR TIME")};NDNTime.prototype.getJavascriptDate=function(){var a=new Date;a.setTime(this.msec);return a};
 var ExponentialReExpressClosure=function(a,b){Closure.call(this);this.callerClosure=a;b=b||{};this.maxInterestLifetime=b.maxInterestLifetime||16E3};
 ExponentialReExpressClosure.prototype.upcall=function(a,b){try{if(a==Closure.UPCALL_INTEREST_TIMED_OUT){var c=b.interest.interestLifetime;if(null==c)return this.callerClosure.upcall(Closure.UPCALL_INTEREST_TIMED_OUT,b);c*=2;if(c>this.maxInterestLifetime)return this.callerClosure.upcall(Closure.UPCALL_INTEREST_TIMED_OUT,b);var d=b.interest.clone();d.interestLifetime=c;b.ndn.expressInterest(d.name,this,d);return Closure.RESULT_OK}return this.callerClosure.upcall(a,b)}catch(e){return console.log("ExponentialReExpressClosure.upcall exception: "+
 e),Closure.RESULT_ERR}};var Name=function Name(b){if("string"==typeof b)3<LOG&&console.log("Content Name String "+b),this.components=Name.createNameArray(b);else if("object"===typeof b)if(this.components=[],b instanceof Name)this.add(b);else for(var c=0;c<b.length;++c)this.add(b[c]);else null==b?this.components=[]:1<LOG&&console.log("NO CONTENT NAME GIVEN")};Name.prototype.getName=function(){return this.to_uri()};
 Name.createNameArray=function(a){a=a.trim();if(0>=a.length)return[];var b=a.indexOf(":");if(0<=b){var c=a.indexOf("/");if(0>c||b<c)a=a.substr(b+1,a.length-b-1).trim()}if("/"==a[0])if(2<=a.length&&"/"==a[1]){b=a.indexOf("/",2);if(0>b)return[];a=a.substr(b+1,a.length-b-1).trim()}else a=a.substr(1,a.length-1).trim();a=a.split("/");for(b=0;b<a.length;++b)c=Name.fromEscapedString(a[b]),null==c?(a.splice(b,1),--b):a[b]=c;return a};
-Name.prototype.from_ccnb=function(a){a.readStartElement(this.getElementLabel());for(this.components=[];a.peekStartElement(CCNProtocolDTags.Component);)this.add(a.readBinaryElement(CCNProtocolDTags.Component));a.readEndElement()};Name.prototype.to_ccnb=function(a){if(null==this.components)throw Error("CANNOT ENCODE EMPTY CONTENT NAME");a.writeStartElement(this.getElementLabel());for(var b=this.components.length,c=0;c<b;c++)a.writeElement(CCNProtocolDTags.Component,this.components[c]);a.writeEndElement()};
-Name.prototype.getElementLabel=function(){return CCNProtocolDTags.Name};
+Name.prototype.from_ndnb=function(a){a.readStartElement(this.getElementLabel());for(this.components=[];a.peekStartElement(NDNProtocolDTags.Component);)this.add(a.readBinaryElement(NDNProtocolDTags.Component));a.readEndElement()};Name.prototype.to_ndnb=function(a){if(null==this.components)throw Error("CANNOT ENCODE EMPTY CONTENT NAME");a.writeStartElement(this.getElementLabel());for(var b=this.components.length,c=0;c<b;c++)a.writeElement(NDNProtocolDTags.Component,this.components[c]);a.writeEndElement()};
+Name.prototype.getElementLabel=function(){return NDNProtocolDTags.Name};
 Name.prototype.add=function(a){var b;if("string"==typeof a)b=DataUtils.stringToUtf8Array(a);else if("object"==typeof a&&a instanceof Uint8Array)b=new Uint8Array(a);else if("object"==typeof a&&a instanceof ArrayBuffer)b=new Uint8Array(new ArrayBuffer(a.byteLength)),b.set(new Uint8Array(a));else{if("object"==typeof a&&a instanceof Name){a=a==this?this.components.slice(0,this.components.length):a.components;for(b=0;b<a.length;++b)this.components.push(new Uint8Array(a[b]));return this}if("object"==typeof a)b=
-new Uint8Array(a);else throw Error("Cannot add Name element at index "+this.components.length+": Invalid type");}this.components.push(b);return this};Name.prototype.addSegment=function(a){for(var b=1,c=a;0<c;)b++,c>>=8;b=new Uint8Array(b);c=0;b[c]=0;for(c++;0<a;)b[c]=a&255,a>>=8,c++;this.components.push(b);return this};Name.prototype.to_uri=function(){if(0==this.components.length)return"/";for(var a="",b=0;b<this.components.length;++b)a+="/"+Name.toEscapedString(this.components[b]);return a};
-Name.prototype.addSegment=function(a){a=DataUtils.nonNegativeIntToBigEndian(a);var b=new Uint8Array(a.length+1);b.set(a,1);this.components.push(b);return this};Name.prototype.getPrefix=function(a){return new Name(this.components.slice(0,a))};Name.prototype.cut=function(){return new Name(this.components.slice(0,this.components.length-1))};Name.prototype.getComponent=function(a){var b=new ArrayBuffer(this.components[a].length);(new Uint8Array(b)).set(this.components[a]);return b};
+new Uint8Array(a);else throw Error("Cannot add Name element at index "+this.components.length+": Invalid type");}this.components.push(b);return this};Name.prototype.to_uri=function(){if(0==this.components.length)return"/";for(var a="",b=0;b<this.components.length;++b)a+="/"+Name.toEscapedString(this.components[b]);return a};Name.prototype.addSegment=function(a){a=DataUtils.nonNegativeIntToBigEndian(a);var b=new Uint8Array(a.length+1);b.set(a,1);this.components.push(b);return this};
+Name.prototype.getPrefix=function(a){return new Name(this.components.slice(0,a))};Name.prototype.cut=function(){return new Name(this.components.slice(0,this.components.length-1))};Name.prototype.getComponent=function(a){var b=new ArrayBuffer(this.components[a].length);(new Uint8Array(b)).set(this.components[a]);return b};
 Name.prototype.indexOfFileName=function(){for(var a=this.components.length-1;0<=a;--a){var b=this.components[a];if(!(0>=b.length)&&!(0==b[0]||192==b[0]||193==b[0]||245<=b[0]&&255>=b[0]))return a}return-1};Name.prototype.equalsName=function(a){if(this.components.length!=a.components.length)return!1;for(var b=this.components.length-1;0<=b;--b)if(!DataUtils.arraysEqual(this.components[b],a.components[b]))return!1;return!0};
 Name.prototype.getContentDigestValue=function(){for(var a=this.components.length-1;0<=a;--a){var b=Name.getComponentContentDigestValue(this.components[a]);if(null!=b)return b}return null};
 Name.getComponentContentDigestValue=function(a){return a.length==Name.ContentDigestPrefix.length+32+Name.ContentDigestSuffix.length&&DataUtils.arraysEqual(a.subarray(0,Name.ContentDigestPrefix.length),Name.ContentDigestPrefix)&&DataUtils.arraysEqual(a.subarray(a.length-Name.ContentDigestSuffix.length,a.length),Name.ContentDigestSuffix)?a.subarray(Name.ContentDigestPrefix.length,Name.ContentDigestPrefix.length+32):null};Name.ContentDigestPrefix=new Uint8Array([193,46,77,46,71,193,1,170,2,133]);
 Name.ContentDigestSuffix=new Uint8Array([0]);Name.toEscapedString=function(a){for(var b="",c=!1,d=0;d<a.length;++d)if(46!=a[d]){c=!0;break}if(c)for(d=0;d<a.length;++d)c=a[d],b=48<=c&&57>=c||65<=c&&90>=c||97<=c&&122>=c||43==c||45==c||46==c||95==c?b+String.fromCharCode(c):b+("%"+(16>c?"0":"")+c.toString(16).toUpperCase());else{b="...";for(d=0;d<a.length;++d)b+="."}return b};
 Name.fromEscapedString=function(a){a=unescape(a.trim());return null==a.match(/[^.]/)?2>=a.length?null:DataUtils.toNumbersFromString(a.substr(3,a.length-3)):DataUtils.toNumbersFromString(a)};Name.prototype.match=function(a){var b=this.components;a=a.components;if(b.length>a.length)return!1;for(var c=0;c<b.length;++c)if(!DataUtils.arraysEqual(b[c],a[c]))return!1;return!0};
-var ContentObject=function(a,b,c,d){this.name="string"==typeof a?new Name(a):a;this.signedInfo=b;this.content="string"==typeof c?DataUtils.toNumbersFromString(c):c;this.signature=d;this.rawSignatureData=this.endContent=this.endSIG=this.startSIG=null};
+var ContentObject=function(a,b,c){this.name="string"==typeof a?new Name(a):a;this.signedInfo=b;this.content="string"==typeof c?DataUtils.toNumbersFromString(c):c;this.signature=new Signature;this.rawSignatureData=this.endContent=this.endSIG=this.startSIG=null};
 ContentObject.prototype.sign=function(){var a=this.encodeObject(this.name),b=this.encodeObject(this.signedInfo),c=this.encodeContent(),d=new ArrayBuffer(a.length+b.length+c.length),d=new Uint8Array(d);d.set(a,0);d.set(b,a.length);d.set(c,a.length+b.length);4<LOG&&console.log("Signature Data is (binary) "+d);4<LOG&&console.log("Signature Data is (RawString)");4<LOG&&console.log(DataUtils.toString(d));a=new RSAKey;a.readPrivateKeyFromPEMString(globalKeyManager.privateKey);a=a.signByteArrayWithSHA256(d);
-4<LOG&&console.log("SIGNATURE SAVED IS");4<LOG&&console.log(a);4<LOG&&console.log(DataUtils.toNumbers(a.trim()));this.signature.signature=DataUtils.toNumbers(a.trim())};ContentObject.prototype.encodeObject=function(a){var b=new BinaryXMLEncoder;a.to_ccnb(b);return b.getReducedOstream()};ContentObject.prototype.encodeContent=function(){var a=new BinaryXMLEncoder;a.writeElement(CCNProtocolDTags.Content,this.content);return a.getReducedOstream()};
-ContentObject.prototype.saveRawData=function(a){this.rawSignatureData=a.subarray(this.startSIG,this.endSIG)};ContentObject.prototype.from_ccnb=function(a){BinaryXmlWireFormat.decodeContentObject(this,a)};ContentObject.prototype.to_ccnb=function(a){BinaryXmlWireFormat.encodeContentObject(this,a)};ContentObject.prototype.encode=function(a){a=a||BinaryXmlWireFormat.instance;return a.encodeContentObject(this)};
-ContentObject.prototype.decode=function(a,b){b=b||BinaryXmlWireFormat.instance;b.decodeContentObject(this,a)};ContentObject.prototype.getElementLabel=function(){return CCNProtocolDTags.ContentObject};var Signature=function(a,b,c){this.Witness=a;this.signature=b;this.digestAlgorithm=c};
-Signature.prototype.from_ccnb=function(a){a.readStartElement(this.getElementLabel());4<LOG&&console.log("STARTED DECODING SIGNATURE");a.peekStartElement(CCNProtocolDTags.DigestAlgorithm)&&(4<LOG&&console.log("DIGIEST ALGORITHM FOUND"),this.digestAlgorithm=a.readUTF8Element(CCNProtocolDTags.DigestAlgorithm));a.peekStartElement(CCNProtocolDTags.Witness)&&(4<LOG&&console.log("WITNESS FOUND"),this.Witness=a.readBinaryElement(CCNProtocolDTags.Witness));4<LOG&&console.log("SIGNATURE FOUND");this.signature=
-a.readBinaryElement(CCNProtocolDTags.SignatureBits);a.readEndElement()};
-Signature.prototype.to_ccnb=function(a){if(!this.validate())throw Error("Cannot encode: field values missing.");a.writeStartElement(this.getElementLabel());null!=this.digestAlgorithm&&!this.digestAlgorithm.equals(CCNDigestHelper.DEFAULT_DIGEST_ALGORITHM)&&a.writeElement(CCNProtocolDTags.DigestAlgorithm,OIDLookup.getDigestOID(this.DigestAlgorithm));null!=this.Witness&&a.writeElement(CCNProtocolDTags.Witness,this.Witness);a.writeElement(CCNProtocolDTags.SignatureBits,this.signature);a.writeEndElement()};
-Signature.prototype.getElementLabel=function(){return CCNProtocolDTags.Signature};Signature.prototype.validate=function(){return null!=this.signature};
+4<LOG&&console.log("SIGNATURE SAVED IS");4<LOG&&console.log(a);4<LOG&&console.log(DataUtils.toNumbers(a.trim()));this.signature.signature=DataUtils.toNumbers(a.trim())};ContentObject.prototype.encodeObject=function(a){var b=new BinaryXMLEncoder;a.to_ndnb(b);return b.getReducedOstream()};ContentObject.prototype.encodeContent=function(){var a=new BinaryXMLEncoder;a.writeElement(NDNProtocolDTags.Content,this.content);return a.getReducedOstream()};
+ContentObject.prototype.saveRawData=function(a){this.rawSignatureData=a.subarray(this.startSIG,this.endSIG)};ContentObject.prototype.from_ndnb=function(a){BinaryXmlWireFormat.decodeContentObject(this,a)};ContentObject.prototype.to_ndnb=function(a){BinaryXmlWireFormat.encodeContentObject(this,a)};ContentObject.prototype.encode=function(a){a=a||BinaryXmlWireFormat.instance;return a.encodeContentObject(this)};
+ContentObject.prototype.decode=function(a,b){b=b||BinaryXmlWireFormat.instance;b.decodeContentObject(this,a)};ContentObject.prototype.getElementLabel=function(){return NDNProtocolDTags.ContentObject};var Signature=function(a,b,c){this.Witness=a;this.signature=b;this.digestAlgorithm=c};
+Signature.prototype.from_ndnb=function(a){a.readStartElement(this.getElementLabel());4<LOG&&console.log("STARTED DECODING SIGNATURE");a.peekStartElement(NDNProtocolDTags.DigestAlgorithm)&&(4<LOG&&console.log("DIGIEST ALGORITHM FOUND"),this.digestAlgorithm=a.readUTF8Element(NDNProtocolDTags.DigestAlgorithm));a.peekStartElement(NDNProtocolDTags.Witness)&&(4<LOG&&console.log("WITNESS FOUND"),this.Witness=a.readBinaryElement(NDNProtocolDTags.Witness));4<LOG&&console.log("SIGNATURE FOUND");this.signature=
+a.readBinaryElement(NDNProtocolDTags.SignatureBits);a.readEndElement()};
+Signature.prototype.to_ndnb=function(a){if(!this.validate())throw Error("Cannot encode: field values missing.");a.writeStartElement(this.getElementLabel());null!=this.digestAlgorithm&&!this.digestAlgorithm.equals(NDNDigestHelper.DEFAULT_DIGEST_ALGORITHM)&&a.writeElement(NDNProtocolDTags.DigestAlgorithm,OIDLookup.getDigestOID(this.DigestAlgorithm));null!=this.Witness&&a.writeElement(NDNProtocolDTags.Witness,this.Witness);a.writeElement(NDNProtocolDTags.SignatureBits,this.signature);a.writeEndElement()};
+Signature.prototype.getElementLabel=function(){return NDNProtocolDTags.Signature};Signature.prototype.validate=function(){return null!=this.signature};
 var ContentType={DATA:0,ENCR:1,GONE:2,KEY:3,LINK:4,NACK:5},ContentTypeValue={"0":787648,1:1101969,2:1631044,3:2639423,4:2917194,5:3408010},ContentTypeValueReverse={787648:0,1101969:1,1631044:2,2639423:3,2917194:4,3408010:5},SignedInfo=function(a,b,c,d,e,f){this.publisher=a;this.timestamp=b;this.type=c;this.locator=d;this.freshnessSeconds=e;this.finalBlockID=f;this.setFields()};
-SignedInfo.prototype.setFields=function(){var a=globalKeyManager.publicKey;4<LOG&&console.log("PUBLIC KEY TO WRITE TO CONTENT OBJECT IS ");4<LOG&&console.log(a);var a=DataUtils.toNumbers(globalKeyManager.publicKey),b=hex_sha256_from_bytes(a);this.publisher=new PublisherPublicKeyDigest(DataUtils.toNumbers(b));b=(new Date).getTime();this.timestamp=new CCNTime(b);4<LOG&&console.log("TIME msec is");4<LOG&&console.log(this.timestamp.msec);this.type=0;4<LOG&&console.log("PUBLIC KEY TO WRITE TO CONTENT OBJECT IS ");
+SignedInfo.prototype.setFields=function(){var a=globalKeyManager.publicKey;4<LOG&&console.log("PUBLIC KEY TO WRITE TO CONTENT OBJECT IS ");4<LOG&&console.log(a);var a=DataUtils.toNumbers(globalKeyManager.publicKey),b=hex_sha256_from_bytes(a);this.publisher=new PublisherPublicKeyDigest(DataUtils.toNumbers(b));b=(new Date).getTime();this.timestamp=new NDNTime(b);4<LOG&&console.log("TIME msec is");4<LOG&&console.log(this.timestamp.msec);this.type=0;4<LOG&&console.log("PUBLIC KEY TO WRITE TO CONTENT OBJECT IS ");
 4<LOG&&console.log(a);this.locator=new KeyLocator(a,KeyLocatorType.KEY)};
-SignedInfo.prototype.from_ccnb=function(a){a.readStartElement(this.getElementLabel());a.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)&&(4<LOG&&console.log("DECODING PUBLISHER KEY"),this.publisher=new PublisherPublicKeyDigest,this.publisher.from_ccnb(a));a.peekStartElement(CCNProtocolDTags.Timestamp)&&(4<LOG&&console.log("DECODING TIMESTAMP"),this.timestamp=a.readDateTime(CCNProtocolDTags.Timestamp));if(a.peekStartElement(CCNProtocolDTags.Type)){var b=a.readBinaryElement(CCNProtocolDTags.Type);
-4<LOG&&console.log("Binary Type of of Signed Info is "+b);this.type=b;if(null==this.type)throw Error("Cannot parse signedInfo type: bytes.");}else this.type=ContentType.DATA;a.peekStartElement(CCNProtocolDTags.FreshnessSeconds)&&(this.freshnessSeconds=a.readIntegerElement(CCNProtocolDTags.FreshnessSeconds),4<LOG&&console.log("FRESHNESS IN SECONDS IS "+this.freshnessSeconds));a.peekStartElement(CCNProtocolDTags.FinalBlockID)&&(4<LOG&&console.log("DECODING FINAL BLOCKID"),this.finalBlockID=a.readBinaryElement(CCNProtocolDTags.FinalBlockID));
-a.peekStartElement(CCNProtocolDTags.KeyLocator)&&(4<LOG&&console.log("DECODING KEY LOCATOR"),this.locator=new KeyLocator,this.locator.from_ccnb(a));a.readEndElement()};
-SignedInfo.prototype.to_ccnb=function(a){if(!this.validate())throw Error("Cannot encode : field values missing.");a.writeStartElement(this.getElementLabel());null!=this.publisher&&(3<LOG&&console.log("ENCODING PUBLISHER KEY"+this.publisher.publisherPublicKeyDigest),this.publisher.to_ccnb(a));null!=this.timestamp&&a.writeDateTime(CCNProtocolDTags.Timestamp,this.timestamp);null!=this.type&&0!=this.type&&a.writeElement(CCNProtocolDTags.type,this.type);null!=this.freshnessSeconds&&a.writeElement(CCNProtocolDTags.FreshnessSeconds,
-this.freshnessSeconds);null!=this.finalBlockID&&a.writeElement(CCNProtocolDTags.FinalBlockID,this.finalBlockID);null!=this.locator&&this.locator.to_ccnb(a);a.writeEndElement()};SignedInfo.prototype.valueToType=function(){return null};SignedInfo.prototype.getElementLabel=function(){return CCNProtocolDTags.SignedInfo};SignedInfo.prototype.validate=function(){return null==this.publisher||null==this.timestamp||null==this.locator?!1:!0};
+SignedInfo.prototype.from_ndnb=function(a){a.readStartElement(this.getElementLabel());a.peekStartElement(NDNProtocolDTags.PublisherPublicKeyDigest)&&(4<LOG&&console.log("DECODING PUBLISHER KEY"),this.publisher=new PublisherPublicKeyDigest,this.publisher.from_ndnb(a));a.peekStartElement(NDNProtocolDTags.Timestamp)&&(4<LOG&&console.log("DECODING TIMESTAMP"),this.timestamp=a.readDateTime(NDNProtocolDTags.Timestamp));if(a.peekStartElement(NDNProtocolDTags.Type)){var b=a.readBinaryElement(NDNProtocolDTags.Type);
+4<LOG&&console.log("Binary Type of of Signed Info is "+b);this.type=b;if(null==this.type)throw Error("Cannot parse signedInfo type: bytes.");}else this.type=ContentType.DATA;a.peekStartElement(NDNProtocolDTags.FreshnessSeconds)&&(this.freshnessSeconds=a.readIntegerElement(NDNProtocolDTags.FreshnessSeconds),4<LOG&&console.log("FRESHNESS IN SECONDS IS "+this.freshnessSeconds));a.peekStartElement(NDNProtocolDTags.FinalBlockID)&&(4<LOG&&console.log("DECODING FINAL BLOCKID"),this.finalBlockID=a.readBinaryElement(NDNProtocolDTags.FinalBlockID));
+a.peekStartElement(NDNProtocolDTags.KeyLocator)&&(4<LOG&&console.log("DECODING KEY LOCATOR"),this.locator=new KeyLocator,this.locator.from_ndnb(a));a.readEndElement()};
+SignedInfo.prototype.to_ndnb=function(a){if(!this.validate())throw Error("Cannot encode : field values missing.");a.writeStartElement(this.getElementLabel());null!=this.publisher&&(3<LOG&&console.log("ENCODING PUBLISHER KEY"+this.publisher.publisherPublicKeyDigest),this.publisher.to_ndnb(a));null!=this.timestamp&&a.writeDateTime(NDNProtocolDTags.Timestamp,this.timestamp);null!=this.type&&0!=this.type&&a.writeElement(NDNProtocolDTags.type,this.type);null!=this.freshnessSeconds&&a.writeElement(NDNProtocolDTags.FreshnessSeconds,
+this.freshnessSeconds);null!=this.finalBlockID&&a.writeElement(NDNProtocolDTags.FinalBlockID,this.finalBlockID);null!=this.locator&&this.locator.to_ndnb(a);a.writeEndElement()};SignedInfo.prototype.valueToType=function(){return null};SignedInfo.prototype.getElementLabel=function(){return NDNProtocolDTags.SignedInfo};SignedInfo.prototype.validate=function(){return null==this.publisher||null==this.timestamp||null==this.locator?!1:!0};
 var DateFormat=function(){var a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,c=/[^-+\dA-Z]/g,d=function(a,b){a=String(a);for(b=b||2;a.length<b;)a="0"+a;return a};return function(e,f,g){var h=dateFormat;1==arguments.length&&("[object String]"==Object.prototype.toString.call(e)&&!/\d/.test(e))&&(f=e,e=void 0);e=e?new Date(e):new Date;if(isNaN(e))throw SyntaxError("invalid date");
 f=String(h.masks[f]||f||h.masks["default"]);"UTC:"==f.slice(0,4)&&(f=f.slice(4),g=!0);var j=g?"getUTC":"get",l=e[j+"Date"](),n=e[j+"Day"](),m=e[j+"Month"](),p=e[j+"FullYear"](),k=e[j+"Hours"](),q=e[j+"Minutes"](),s=e[j+"Seconds"](),j=e[j+"Milliseconds"](),r=g?0:e.getTimezoneOffset(),t={d:l,dd:d(l),ddd:h.i18n.dayNames[n],dddd:h.i18n.dayNames[n+7],m:m+1,mm:d(m+1),mmm:h.i18n.monthNames[m],mmmm:h.i18n.monthNames[m+12],yy:String(p).slice(2),yyyy:p,h:k%12||12,hh:d(k%12||12),H:k,HH:d(k),M:q,MM:d(q),s:s,
 ss:d(s),l:d(j,3),L:d(99<j?Math.round(j/10):j),t:12>k?"a":"p",tt:12>k?"am":"pm",T:12>k?"A":"P",TT:12>k?"AM":"PM",Z:g?"UTC":(String(e).match(b)||[""]).pop().replace(c,""),o:(0<r?"-":"+")+d(100*Math.floor(Math.abs(r)/60)+Math.abs(r)%60,4),S:["th","st","nd","rd"][3<l%10?0:(10!=l%100-l%10)*l%10]};return f.replace(a,function(a){return a in t?t[a]:a.slice(1,a.length-1)})}}();
 DateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};DateFormat.i18n={dayNames:"Sun Mon Tue Wed Thu Fri Sat Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),monthNames:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec January February March April May June July August September October November December".split(" ")};
 Date.prototype.format=function(a,b){return dateFormat(this,a,b)};var Interest=function(a,b,c,d,e,f,g,h,j,l,n){this.name=a;this.faceInstance=b;this.maxSuffixComponents=d;this.minSuffixComponents=c;this.publisherPublicKeyDigest=e;this.exclude=f;this.childSelector=g;this.answerOriginKind=h;this.scope=j;this.interestLifetime=l;this.nonce=n};Interest.RECURSIVE_POSTFIX="*";Interest.CHILD_SELECTOR_LEFT=0;Interest.CHILD_SELECTOR_RIGHT=1;Interest.ANSWER_CONTENT_STORE=1;Interest.ANSWER_GENERATED=2;
-Interest.ANSWER_STALE=4;Interest.MARK_STALE=16;Interest.DEFAULT_ANSWER_ORIGIN_KIND=Interest.ANSWER_CONTENT_STORE|Interest.ANSWER_GENERATED;Interest.prototype.from_ccnb=function(a){BinaryXmlWireFormat.decodeInterest(this,a)};Interest.prototype.to_ccnb=function(a){BinaryXmlWireFormat.encodeInterest(this,a)};Interest.prototype.encode=function(a){a=a||BinaryXmlWireFormat.instance;return a.encodeInterest(this)};
+Interest.ANSWER_STALE=4;Interest.MARK_STALE=16;Interest.DEFAULT_ANSWER_ORIGIN_KIND=Interest.ANSWER_CONTENT_STORE|Interest.ANSWER_GENERATED;Interest.prototype.from_ndnb=function(a){BinaryXmlWireFormat.decodeInterest(this,a)};Interest.prototype.to_ndnb=function(a){BinaryXmlWireFormat.encodeInterest(this,a)};Interest.prototype.encode=function(a){a=a||BinaryXmlWireFormat.instance;return a.encodeInterest(this)};
 Interest.prototype.decode=function(a,b){b=b||BinaryXmlWireFormat.instance;b.decodeInterest(this,a)};
 Interest.prototype.matches_name=function(a){return!this.name.match(a)||null!=this.minSuffixComponents&&!(a.components.length+1-this.name.components.length>=this.minSuffixComponents)||null!=this.maxSuffixComponents&&!(a.components.length+1-this.name.components.length<=this.maxSuffixComponents)||null!=this.exclude&&a.components.length>this.name.components.length&&this.exclude.matches(a.components[this.name.components.length])?!1:!0};
 Interest.prototype.clone=function(){return new Interest(this.name,this.faceInstance,this.minSuffixComponents,this.maxSuffixComponents,this.publisherPublicKeyDigest,this.exclude,this.childSelector,this.answerOriginKind,this.scope,this.interestLifetime,this.nonce)};var Exclude=function(a){this.values=a||[]};Exclude.ANY="*";
-Exclude.prototype.from_ccnb=function(a){for(a.readStartElement(CCNProtocolDTags.Exclude);;)if(a.peekStartElement(CCNProtocolDTags.Component))this.values.push(a.readBinaryElement(CCNProtocolDTags.Component));else if(a.peekStartElement(CCNProtocolDTags.Any))a.readStartElement(CCNProtocolDTags.Any),a.readEndElement(),this.values.push(Exclude.ANY);else if(a.peekStartElement(CCNProtocolDTags.Bloom))a.readBinaryElement(CCNProtocolDTags.Bloom),this.values.push(Exclude.ANY);else break;a.readEndElement()};
-Exclude.prototype.to_ccnb=function(a){if(!(null==this.values||0==this.values.length)){a.writeStartElement(CCNProtocolDTags.Exclude);for(var b=0;b<this.values.length;++b)this.values[b]==Exclude.ANY?(a.writeStartElement(CCNProtocolDTags.Any),a.writeEndElement()):a.writeElement(CCNProtocolDTags.Component,this.values[b]);a.writeEndElement()}};
+Exclude.prototype.from_ndnb=function(a){for(a.readStartElement(NDNProtocolDTags.Exclude);;)if(a.peekStartElement(NDNProtocolDTags.Component))this.values.push(a.readBinaryElement(NDNProtocolDTags.Component));else if(a.peekStartElement(NDNProtocolDTags.Any))a.readStartElement(NDNProtocolDTags.Any),a.readEndElement(),this.values.push(Exclude.ANY);else if(a.peekStartElement(NDNProtocolDTags.Bloom))a.readBinaryElement(NDNProtocolDTags.Bloom),this.values.push(Exclude.ANY);else break;a.readEndElement()};
+Exclude.prototype.to_ndnb=function(a){if(!(null==this.values||0==this.values.length)){a.writeStartElement(NDNProtocolDTags.Exclude);for(var b=0;b<this.values.length;++b)this.values[b]==Exclude.ANY?(a.writeStartElement(NDNProtocolDTags.Any),a.writeEndElement()):a.writeElement(NDNProtocolDTags.Component,this.values[b]);a.writeEndElement()}};
 Exclude.prototype.to_uri=function(){if(null==this.values||0==this.values.length)return"";for(var a="",b=0;b<this.values.length;++b)0<b&&(a+=","),a=this.values[b]==Exclude.ANY?a+"*":a+Name.toEscapedString(this.values[b]);return a};
 Exclude.prototype.matches=function(a){for(var b=0;b<this.values.length;++b)if(this.values[b]==Exclude.ANY){var c=null;0<b&&(c=this.values[b-1]);var d,e=null;for(d=b+1;d<this.values.length;++d)if(this.values[d]!=Exclude.ANY){e=this.values[d];break}if(null!=e){if(null!=c){if(0<Exclude.compareComponents(a,c)&&0>Exclude.compareComponents(a,e))return!0}else if(0>Exclude.compareComponents(a,e))return!0;b=d-1}else if(null!=c){if(0<Exclude.compareComponents(a,c))return!0}else return!0}else if(DataUtils.arraysEqual(a,
 this.values[b]))return!0;return!1};Exclude.compareComponents=function(a,b){if(a.length<b.length)return-1;if(a.length>b.length)return 1;for(var c=0;c<a.length;++c){if(a[c]<b[c])return-1;if(a[c]>b[c])return 1}return 0};
 var Key=function(){},KeyLocatorType={KEY:1,CERTIFICATE:2,KEYNAME:3},KeyLocator=function(a,b){this.type=b;b==KeyLocatorType.KEYNAME?(3<LOG&&console.log("KeyLocator: SET KEYNAME"),this.keyName=a):b==KeyLocatorType.KEY?(3<LOG&&console.log("KeyLocator: SET KEY"),this.publicKey=a):b==KeyLocatorType.CERTIFICATE&&(3<LOG&&console.log("KeyLocator: SET CERTIFICATE"),this.certificate=a)};
-KeyLocator.prototype.from_ccnb=function(a){a.readStartElement(this.getElementLabel());if(a.peekStartElement(CCNProtocolDTags.Key)){try{this.publicKey=a.readBinaryElement(CCNProtocolDTags.Key),this.type=KeyLocatorType.KEY,4<LOG&&console.log("PUBLIC KEY FOUND: "+this.publicKey)}catch(b){throw Error("Cannot parse key: ",b);}if(null==this.publicKey)throw Error("Cannot parse key: ");}else if(a.peekStartElement(CCNProtocolDTags.Certificate)){try{this.certificate=a.readBinaryElement(CCNProtocolDTags.Certificate),
-this.type=KeyLocatorType.CERTIFICATE,4<LOG&&console.log("CERTIFICATE FOUND: "+this.certificate)}catch(c){throw Error("Cannot decode certificate: "+c);}if(null==this.certificate)throw Error("Cannot parse certificate! ");}else this.type=KeyLocatorType.KEYNAME,this.keyName=new KeyName,this.keyName.from_ccnb(a);a.readEndElement()};
-KeyLocator.prototype.to_ccnb=function(a){4<LOG&&console.log("type is is "+this.type);if(!this.validate())throw new ContentEncodingException("Cannot encode "+this.getClass().getName()+": field values missing.");a.writeStartElement(this.getElementLabel());if(this.type==KeyLocatorType.KEY)5<LOG&&console.log("About to encode a public key"+this.publicKey),a.writeElement(CCNProtocolDTags.Key,this.publicKey);else if(this.type==KeyLocatorType.CERTIFICATE)try{a.writeElement(CCNProtocolDTags.Certificate,this.certificate)}catch(b){throw Error("CertificateEncodingException attempting to write key locator: "+
-b);}else this.type==KeyLocatorType.KEYNAME&&this.keyName.to_ccnb(a);a.writeEndElement()};KeyLocator.prototype.getElementLabel=function(){return CCNProtocolDTags.KeyLocator};KeyLocator.prototype.validate=function(){return null!=this.keyName||null!=this.publicKey||null!=this.certificate};var KeyName=function(){this.contentName=this.contentName;this.publisherID=this.publisherID};
-KeyName.prototype.from_ccnb=function(a){a.readStartElement(this.getElementLabel());this.contentName=new Name;this.contentName.from_ccnb(a);4<LOG&&console.log("KEY NAME FOUND: ");PublisherID.peek(a)&&(this.publisherID=new PublisherID,this.publisherID.from_ccnb(a));a.readEndElement()};
-KeyName.prototype.to_ccnb=function(a){if(!this.validate())throw Error("Cannot encode : field values missing.");a.writeStartElement(this.getElementLabel());this.contentName.to_ccnb(a);null!=this.publisherID&&this.publisherID.to_ccnb(a);a.writeEndElement()};KeyName.prototype.getElementLabel=function(){return CCNProtocolDTags.KeyName};KeyName.prototype.validate=function(){return null!=this.contentName};
-var PublisherType=function(a){this.KEY=CCNProtocolDTags.PublisherPublicKeyDigest;this.CERTIFICATE=CCNProtocolDTags.PublisherCertificateDigest;this.ISSUER_KEY=CCNProtocolDTags.PublisherIssuerKeyDigest;this.ISSUER_CERTIFICATE=CCNProtocolDTags.PublisherIssuerCertificateDigest;this.Tag=a},isTypeTagVal=function(a){return a==CCNProtocolDTags.PublisherPublicKeyDigest||a==CCNProtocolDTags.PublisherCertificateDigest||a==CCNProtocolDTags.PublisherIssuerKeyDigest||a==CCNProtocolDTags.PublisherIssuerCertificateDigest?
+KeyLocator.prototype.from_ndnb=function(a){a.readStartElement(this.getElementLabel());if(a.peekStartElement(NDNProtocolDTags.Key)){try{this.publicKey=a.readBinaryElement(NDNProtocolDTags.Key),this.type=KeyLocatorType.KEY,4<LOG&&console.log("PUBLIC KEY FOUND: "+this.publicKey)}catch(b){throw Error("Cannot parse key: ",b);}if(null==this.publicKey)throw Error("Cannot parse key: ");}else if(a.peekStartElement(NDNProtocolDTags.Certificate)){try{this.certificate=a.readBinaryElement(NDNProtocolDTags.Certificate),
+this.type=KeyLocatorType.CERTIFICATE,4<LOG&&console.log("CERTIFICATE FOUND: "+this.certificate)}catch(c){throw Error("Cannot decode certificate: "+c);}if(null==this.certificate)throw Error("Cannot parse certificate! ");}else this.type=KeyLocatorType.KEYNAME,this.keyName=new KeyName,this.keyName.from_ndnb(a);a.readEndElement()};
+KeyLocator.prototype.to_ndnb=function(a){4<LOG&&console.log("type is is "+this.type);if(!this.validate())throw new ContentEncodingException("Cannot encode "+this.getClass().getName()+": field values missing.");a.writeStartElement(this.getElementLabel());if(this.type==KeyLocatorType.KEY)5<LOG&&console.log("About to encode a public key"+this.publicKey),a.writeElement(NDNProtocolDTags.Key,this.publicKey);else if(this.type==KeyLocatorType.CERTIFICATE)try{a.writeElement(NDNProtocolDTags.Certificate,this.certificate)}catch(b){throw Error("CertificateEncodingException attempting to write key locator: "+
+b);}else this.type==KeyLocatorType.KEYNAME&&this.keyName.to_ndnb(a);a.writeEndElement()};KeyLocator.prototype.getElementLabel=function(){return NDNProtocolDTags.KeyLocator};KeyLocator.prototype.validate=function(){return null!=this.keyName||null!=this.publicKey||null!=this.certificate};var KeyName=function(){this.contentName=this.contentName;this.publisherID=this.publisherID};
+KeyName.prototype.from_ndnb=function(a){a.readStartElement(this.getElementLabel());this.contentName=new Name;this.contentName.from_ndnb(a);4<LOG&&console.log("KEY NAME FOUND: ");PublisherID.peek(a)&&(this.publisherID=new PublisherID,this.publisherID.from_ndnb(a));a.readEndElement()};
+KeyName.prototype.to_ndnb=function(a){if(!this.validate())throw Error("Cannot encode : field values missing.");a.writeStartElement(this.getElementLabel());this.contentName.to_ndnb(a);null!=this.publisherID&&this.publisherID.to_ndnb(a);a.writeEndElement()};KeyName.prototype.getElementLabel=function(){return NDNProtocolDTags.KeyName};KeyName.prototype.validate=function(){return null!=this.contentName};
+var PublisherType=function(a){this.KEY=NDNProtocolDTags.PublisherPublicKeyDigest;this.CERTIFICATE=NDNProtocolDTags.PublisherCertificateDigest;this.ISSUER_KEY=NDNProtocolDTags.PublisherIssuerKeyDigest;this.ISSUER_CERTIFICATE=NDNProtocolDTags.PublisherIssuerCertificateDigest;this.Tag=a},isTypeTagVal=function(a){return a==NDNProtocolDTags.PublisherPublicKeyDigest||a==NDNProtocolDTags.PublisherCertificateDigest||a==NDNProtocolDTags.PublisherIssuerKeyDigest||a==NDNProtocolDTags.PublisherIssuerCertificateDigest?
 !0:!1},PublisherID=function(){this.PUBLISHER_ID_DIGEST_ALGORITHM="SHA-256";this.PUBLISHER_ID_LEN=32;this.publisherType=this.publisherID=null};
-PublisherID.prototype.from_ccnb=function(a){var b=a.peekStartElementAsLong();if(null==b)throw Error("Cannot parse publisher ID.");this.publisherType=new PublisherType(b);if(!isTypeTagVal(b))throw Error("Invalid publisher ID, got unexpected type: "+b);this.publisherID=a.readBinaryElement(b);if(null==this.publisherID)throw new ContentDecodingException(Error("Cannot parse publisher ID of type : "+b+"."));};
-PublisherID.prototype.to_ccnb=function(a){if(!this.validate())throw Error("Cannot encode "+this.getClass().getName()+": field values missing.");a.writeElement(this.getElementLabel(),this.publisherID)};PublisherID.peek=function(a){a=a.peekStartElementAsLong();return null==a?!1:isTypeTagVal(a)};PublisherID.prototype.getElementLabel=function(){return this.publisherType.Tag};PublisherID.prototype.validate=function(){return null!=id()&&null!=type()};
+PublisherID.prototype.from_ndnb=function(a){var b=a.peekStartElementAsLong();if(null==b)throw Error("Cannot parse publisher ID.");this.publisherType=new PublisherType(b);if(!isTypeTagVal(b))throw Error("Invalid publisher ID, got unexpected type: "+b);this.publisherID=a.readBinaryElement(b);if(null==this.publisherID)throw new ContentDecodingException(Error("Cannot parse publisher ID of type : "+b+"."));};
+PublisherID.prototype.to_ndnb=function(a){if(!this.validate())throw Error("Cannot encode "+this.getClass().getName()+": field values missing.");a.writeElement(this.getElementLabel(),this.publisherID)};PublisherID.peek=function(a){a=a.peekStartElementAsLong();return null==a?!1:isTypeTagVal(a)};PublisherID.prototype.getElementLabel=function(){return this.publisherType.Tag};PublisherID.prototype.validate=function(){return null!=id()&&null!=type()};
 var PublisherPublicKeyDigest=function(a){this.PUBLISHER_ID_LEN=64;this.publisherPublicKeyDigest=a};
-PublisherPublicKeyDigest.prototype.from_ccnb=function(a){this.publisherPublicKeyDigest=a.readBinaryElement(this.getElementLabel());4<LOG&&console.log("Publisher public key digest is "+this.publisherPublicKeyDigest);if(null==this.publisherPublicKeyDigest)throw Error("Cannot parse publisher key digest.");this.publisherPublicKeyDigest.length!=this.PUBLISHER_ID_LEN&&0<LOG&&console.log("LENGTH OF PUBLISHER ID IS WRONG! Expected "+this.PUBLISHER_ID_LEN+", got "+this.publisherPublicKeyDigest.length)};
-PublisherPublicKeyDigest.prototype.to_ccnb=function(a){if(!this.validate())throw Error("Cannot encode : field values missing.");3<LOG&&console.log("PUBLISHER KEY DIGEST IS"+this.publisherPublicKeyDigest);a.writeElement(this.getElementLabel(),this.publisherPublicKeyDigest)};PublisherPublicKeyDigest.prototype.getElementLabel=function(){return CCNProtocolDTags.PublisherPublicKeyDigest};PublisherPublicKeyDigest.prototype.validate=function(){return null!=this.publisherPublicKeyDigest};
+PublisherPublicKeyDigest.prototype.from_ndnb=function(a){this.publisherPublicKeyDigest=a.readBinaryElement(this.getElementLabel());4<LOG&&console.log("Publisher public key digest is "+this.publisherPublicKeyDigest);if(null==this.publisherPublicKeyDigest)throw Error("Cannot parse publisher key digest.");this.publisherPublicKeyDigest.length!=this.PUBLISHER_ID_LEN&&0<LOG&&console.log("LENGTH OF PUBLISHER ID IS WRONG! Expected "+this.PUBLISHER_ID_LEN+", got "+this.publisherPublicKeyDigest.length)};
+PublisherPublicKeyDigest.prototype.to_ndnb=function(a){if(!this.validate())throw Error("Cannot encode : field values missing.");3<LOG&&console.log("PUBLISHER KEY DIGEST IS"+this.publisherPublicKeyDigest);a.writeElement(this.getElementLabel(),this.publisherPublicKeyDigest)};PublisherPublicKeyDigest.prototype.getElementLabel=function(){return NDNProtocolDTags.PublisherPublicKeyDigest};PublisherPublicKeyDigest.prototype.validate=function(){return null!=this.publisherPublicKeyDigest};
 var NetworkProtocol={TCP:6,UDP:17},FaceInstance=function(a,b,c,d,e,f,g,h,j){this.action=a;this.publisherPublicKeyDigest=b;this.faceID=c;this.ipProto=d;this.host=e;this.Port=f;this.multicastInterface=g;this.multicastTTL=h;this.freshnessSeconds=j};
-FaceInstance.prototype.from_ccnb=function(a){a.readStartElement(this.getElementLabel());a.peekStartElement(CCNProtocolDTags.Action)&&(this.action=a.readUTF8Element(CCNProtocolDTags.Action));a.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)&&(this.publisherPublicKeyDigest=new PublisherPublicKeyDigest,this.publisherPublicKeyDigest.from_ccnb(a));a.peekStartElement(CCNProtocolDTags.FaceID)&&(this.faceID=a.readIntegerElement(CCNProtocolDTags.FaceID));if(a.peekStartElement(CCNProtocolDTags.IPProto)){var b=
-a.readIntegerElement(CCNProtocolDTags.IPProto);this.ipProto=null;if(NetworkProtocol.TCP==b)this.ipProto=NetworkProtocol.TCP;else if(NetworkProtocol.UDP==b)this.ipProto=NetworkProtocol.UDP;else throw Error("FaceInstance.decoder.  Invalid "+CCNProtocolDTags.tagToString(CCNProtocolDTags.IPProto)+" field: "+b);}a.peekStartElement(CCNProtocolDTags.Host)&&(this.host=a.readUTF8Element(CCNProtocolDTags.Host));a.peekStartElement(CCNProtocolDTags.Port)&&(this.Port=a.readIntegerElement(CCNProtocolDTags.Port));
-a.peekStartElement(CCNProtocolDTags.MulticastInterface)&&(this.multicastInterface=a.readUTF8Element(CCNProtocolDTags.MulticastInterface));a.peekStartElement(CCNProtocolDTags.MulticastTTL)&&(this.multicastTTL=a.readIntegerElement(CCNProtocolDTags.MulticastTTL));a.peekStartElement(CCNProtocolDTags.FreshnessSeconds)&&(this.freshnessSeconds=a.readIntegerElement(CCNProtocolDTags.FreshnessSeconds));a.readEndElement()};
-FaceInstance.prototype.to_ccnb=function(a){a.writeStartElement(this.getElementLabel());null!=this.action&&0!=this.action.length&&a.writeElement(CCNProtocolDTags.Action,this.action);null!=this.publisherPublicKeyDigest&&this.publisherPublicKeyDigest.to_ccnb(a);null!=this.faceID&&a.writeElement(CCNProtocolDTags.FaceID,this.faceID);null!=this.ipProto&&a.writeElement(CCNProtocolDTags.IPProto,this.ipProto);null!=this.host&&0!=this.host.length&&a.writeElement(CCNProtocolDTags.Host,this.host);null!=this.Port&&
-a.writeElement(CCNProtocolDTags.Port,this.Port);null!=this.multicastInterface&&0!=this.multicastInterface.length&&a.writeElement(CCNProtocolDTags.MulticastInterface,this.multicastInterface);null!=this.multicastTTL&&a.writeElement(CCNProtocolDTags.MulticastTTL,this.multicastTTL);null!=this.freshnessSeconds&&a.writeElement(CCNProtocolDTags.FreshnessSeconds,this.freshnessSeconds);a.writeEndElement()};FaceInstance.prototype.getElementLabel=function(){return CCNProtocolDTags.FaceInstance};
-var ForwardingEntry=function(a,b,c,d,e,f){this.action=a;this.prefixName=b;this.ccndID=c;this.faceID=d;this.flags=e;this.lifetime=f};
-ForwardingEntry.prototype.from_ccnb=function(a){a.readStartElement(this.getElementLabel());a.peekStartElement(CCNProtocolDTags.Action)&&(this.action=a.readUTF8Element(CCNProtocolDTags.Action));a.peekStartElement(CCNProtocolDTags.Name)&&(this.prefixName=new Name,this.prefixName.from_ccnb(a));a.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)&&(this.CcndId=new PublisherPublicKeyDigest,this.CcndId.from_ccnb(a));a.peekStartElement(CCNProtocolDTags.FaceID)&&(this.faceID=a.readIntegerElement(CCNProtocolDTags.FaceID));
-a.peekStartElement(CCNProtocolDTags.ForwardingFlags)&&(this.flags=a.readIntegerElement(CCNProtocolDTags.ForwardingFlags));a.peekStartElement(CCNProtocolDTags.FreshnessSeconds)&&(this.lifetime=a.readIntegerElement(CCNProtocolDTags.FreshnessSeconds));a.readEndElement()};
-ForwardingEntry.prototype.to_ccnb=function(a){a.writeStartElement(this.getElementLabel());null!=this.action&&0!=this.action.length&&a.writeElement(CCNProtocolDTags.Action,this.action);null!=this.prefixName&&this.prefixName.to_ccnb(a);null!=this.CcndId&&this.CcndId.to_ccnb(a);null!=this.faceID&&a.writeElement(CCNProtocolDTags.FaceID,this.faceID);null!=this.flags&&a.writeElement(CCNProtocolDTags.ForwardingFlags,this.flags);null!=this.lifetime&&a.writeElement(CCNProtocolDTags.FreshnessSeconds,this.lifetime);
-a.writeEndElement()};ForwardingEntry.prototype.getElementLabel=function(){return CCNProtocolDTags.ForwardingEntry};var DynamicUint8Array=function(a){a||(a=16);this.array=new Uint8Array(a);this.length=a};DynamicUint8Array.prototype.ensureLength=function(a){if(!(this.array.length>=a)){var b=2*this.array.length;a>b&&(b=a);a=new Uint8Array(b);a.set(this.array);this.array=a;this.length=b}};DynamicUint8Array.prototype.set=function(a,b){this.ensureLength(a.length+b);this.array.set(a,b)};
+FaceInstance.prototype.from_ndnb=function(a){a.readStartElement(this.getElementLabel());a.peekStartElement(NDNProtocolDTags.Action)&&(this.action=a.readUTF8Element(NDNProtocolDTags.Action));a.peekStartElement(NDNProtocolDTags.PublisherPublicKeyDigest)&&(this.publisherPublicKeyDigest=new PublisherPublicKeyDigest,this.publisherPublicKeyDigest.from_ndnb(a));a.peekStartElement(NDNProtocolDTags.FaceID)&&(this.faceID=a.readIntegerElement(NDNProtocolDTags.FaceID));if(a.peekStartElement(NDNProtocolDTags.IPProto)){var b=
+a.readIntegerElement(NDNProtocolDTags.IPProto);this.ipProto=null;if(NetworkProtocol.TCP==b)this.ipProto=NetworkProtocol.TCP;else if(NetworkProtocol.UDP==b)this.ipProto=NetworkProtocol.UDP;else throw Error("FaceInstance.decoder.  Invalid "+NDNProtocolDTags.tagToString(NDNProtocolDTags.IPProto)+" field: "+b);}a.peekStartElement(NDNProtocolDTags.Host)&&(this.host=a.readUTF8Element(NDNProtocolDTags.Host));a.peekStartElement(NDNProtocolDTags.Port)&&(this.Port=a.readIntegerElement(NDNProtocolDTags.Port));
+a.peekStartElement(NDNProtocolDTags.MulticastInterface)&&(this.multicastInterface=a.readUTF8Element(NDNProtocolDTags.MulticastInterface));a.peekStartElement(NDNProtocolDTags.MulticastTTL)&&(this.multicastTTL=a.readIntegerElement(NDNProtocolDTags.MulticastTTL));a.peekStartElement(NDNProtocolDTags.FreshnessSeconds)&&(this.freshnessSeconds=a.readIntegerElement(NDNProtocolDTags.FreshnessSeconds));a.readEndElement()};
+FaceInstance.prototype.to_ndnb=function(a){a.writeStartElement(this.getElementLabel());null!=this.action&&0!=this.action.length&&a.writeElement(NDNProtocolDTags.Action,this.action);null!=this.publisherPublicKeyDigest&&this.publisherPublicKeyDigest.to_ndnb(a);null!=this.faceID&&a.writeElement(NDNProtocolDTags.FaceID,this.faceID);null!=this.ipProto&&a.writeElement(NDNProtocolDTags.IPProto,this.ipProto);null!=this.host&&0!=this.host.length&&a.writeElement(NDNProtocolDTags.Host,this.host);null!=this.Port&&
+a.writeElement(NDNProtocolDTags.Port,this.Port);null!=this.multicastInterface&&0!=this.multicastInterface.length&&a.writeElement(NDNProtocolDTags.MulticastInterface,this.multicastInterface);null!=this.multicastTTL&&a.writeElement(NDNProtocolDTags.MulticastTTL,this.multicastTTL);null!=this.freshnessSeconds&&a.writeElement(NDNProtocolDTags.FreshnessSeconds,this.freshnessSeconds);a.writeEndElement()};FaceInstance.prototype.getElementLabel=function(){return NDNProtocolDTags.FaceInstance};
+var ForwardingEntry=function(a,b,c,d,e,f){this.action=a;this.prefixName=b;this.ndndID=c;this.faceID=d;this.flags=e;this.lifetime=f};
+ForwardingEntry.prototype.from_ndnb=function(a){a.readStartElement(this.getElementLabel());a.peekStartElement(NDNProtocolDTags.Action)&&(this.action=a.readUTF8Element(NDNProtocolDTags.Action));a.peekStartElement(NDNProtocolDTags.Name)&&(this.prefixName=new Name,this.prefixName.from_ndnb(a));a.peekStartElement(NDNProtocolDTags.PublisherPublicKeyDigest)&&(this.NdndId=new PublisherPublicKeyDigest,this.NdndId.from_ndnb(a));a.peekStartElement(NDNProtocolDTags.FaceID)&&(this.faceID=a.readIntegerElement(NDNProtocolDTags.FaceID));
+a.peekStartElement(NDNProtocolDTags.ForwardingFlags)&&(this.flags=a.readIntegerElement(NDNProtocolDTags.ForwardingFlags));a.peekStartElement(NDNProtocolDTags.FreshnessSeconds)&&(this.lifetime=a.readIntegerElement(NDNProtocolDTags.FreshnessSeconds));a.readEndElement()};
+ForwardingEntry.prototype.to_ndnb=function(a){a.writeStartElement(this.getElementLabel());null!=this.action&&0!=this.action.length&&a.writeElement(NDNProtocolDTags.Action,this.action);null!=this.prefixName&&this.prefixName.to_ndnb(a);null!=this.NdndId&&this.NdndId.to_ndnb(a);null!=this.faceID&&a.writeElement(NDNProtocolDTags.FaceID,this.faceID);null!=this.flags&&a.writeElement(NDNProtocolDTags.ForwardingFlags,this.flags);null!=this.lifetime&&a.writeElement(NDNProtocolDTags.FreshnessSeconds,this.lifetime);
+a.writeEndElement()};ForwardingEntry.prototype.getElementLabel=function(){return NDNProtocolDTags.ForwardingEntry};var DynamicUint8Array=function(a){a||(a=16);this.array=new Uint8Array(a);this.length=a};DynamicUint8Array.prototype.ensureLength=function(a){if(!(this.array.length>=a)){var b=2*this.array.length;a>b&&(b=a);a=new Uint8Array(b);a.set(this.array);this.array=a;this.length=b}};DynamicUint8Array.prototype.set=function(a,b){this.ensureLength(a.length+b);this.array.set(a,b)};
 DynamicUint8Array.prototype.subarray=function(a,b){return this.array.subarray(a,b)};
 var XML_EXT=0,XML_TAG=1,XML_DTAG=2,XML_ATTR=3,XML_DATTR=4,XML_BLOB=5,XML_UDATA=6,XML_CLOSE=0,XML_SUBTYPE_PROCESSING_INSTRUCTIONS=16,XML_TT_BITS=3,XML_TT_MASK=(1<<XML_TT_BITS)-1,XML_TT_VAL_BITS=XML_TT_BITS+1,XML_TT_VAL_MASK=(1<<XML_TT_VAL_BITS)-1,XML_REG_VAL_BITS=7,XML_REG_VAL_MASK=(1<<XML_REG_VAL_BITS)-1,XML_TT_NO_MORE=1<<XML_REG_VAL_BITS,BYTE_MASK=255,LONG_BYTES=8,LONG_BITS=64,bits_11=2047,bits_18=262143,bits_32=4294967295,BinaryXMLEncoder=function(){this.ostream=new DynamicUint8Array(100);this.offset=
 0;this.CODEC_NAME="Binary"};BinaryXMLEncoder.prototype.writeUString=function(a){this.encodeUString(a,XML_UDATA)};BinaryXMLEncoder.prototype.writeBlob=function(a){3<LOG&&console.log(a);this.encodeBlob(a,a.length)};BinaryXMLEncoder.prototype.writeStartElement=function(a,b){null==a?this.encodeUString(a,XML_TAG):this.encodeTypeAndVal(XML_DTAG,a);null!=b&&this.writeAttributes(b)};
 BinaryXMLEncoder.prototype.writeEndElement=function(){this.ostream.ensureLength(this.offset+1);this.ostream.array[this.offset]=XML_CLOSE;this.offset+=1};BinaryXMLEncoder.prototype.writeAttributes=function(a){if(null!=a)for(var b=0;b<a.length;b++){var c=a[b].k,d=a[b].v,e=stringToTag(c);null==e?this.encodeUString(c,XML_ATTR):this.encodeTypeAndVal(XML_DATTR,e);this.encodeUString(d)}};
-stringToTag=function(a){return 0<=a&&a<CCNProtocolDTagsStrings.length?CCNProtocolDTagsStrings[a]:a==CCNProtocolDTags.CCNProtocolDataUnit?CCNProtocolDTags.CCNPROTOCOL_DATA_UNIT:null};tagToString=function(a){for(var b=0;b<CCNProtocolDTagsStrings.length;++b)if(null!=CCNProtocolDTagsStrings[b]&&CCNProtocolDTagsStrings[b]==a)return b;return CCNProtocolDTags.CCNPROTOCOL_DATA_UNIT==a?CCNProtocolDTags.CCNProtocolDataUnit:null};
+stringToTag=function(a){return 0<=a&&a<NDNProtocolDTagsStrings.length?NDNProtocolDTagsStrings[a]:a==NDNProtocolDTags.NDNProtocolDataUnit?NDNProtocolDTags.NDNPROTOCOL_DATA_UNIT:null};tagToString=function(a){for(var b=0;b<NDNProtocolDTagsStrings.length;++b)if(null!=NDNProtocolDTagsStrings[b]&&NDNProtocolDTagsStrings[b]==a)return b;return NDNProtocolDTags.NDNPROTOCOL_DATA_UNIT==a?NDNProtocolDTags.NDNProtocolDataUnit:null};
 BinaryXMLEncoder.prototype.writeElement=function(a,b,c){this.writeStartElement(a,c);"number"===typeof b?(4<LOG&&console.log("GOING TO WRITE THE NUMBER .charCodeAt(0) "+b.toString().charCodeAt(0)),4<LOG&&console.log("GOING TO WRITE THE NUMBER "+b.toString()),4<LOG&&console.log("type of number is "+typeof b.toString()),this.writeUString(b.toString())):"string"===typeof b?(4<LOG&&console.log("GOING TO WRITE THE STRING  "+b),4<LOG&&console.log("type of STRING is "+typeof b),this.writeUString(b)):(4<LOG&&
 console.log("GOING TO WRITE A BLOB  "+b),this.writeBlob(b));this.writeEndElement()};var TypeAndVal=function(a,b){this.type=a;this.val=b};
 BinaryXMLEncoder.prototype.encodeTypeAndVal=function(a,b){4<LOG&&console.log("Encoding type "+a+" and value "+b);4<LOG&&console.log("OFFSET IS "+this.offset);if(a>XML_UDATA||0>a||0>b)throw Error("Tag and value must be positive, and tag valid.");var c=this.numEncodingBytes(b);this.ostream.ensureLength(this.offset+c);this.ostream.array[this.offset+c-1]=BYTE_MASK&(XML_TT_MASK&a|(XML_TT_VAL_MASK&b)<<XML_TT_BITS)|XML_TT_NO_MORE;b>>>=XML_TT_VAL_BITS;for(var d=this.offset+c-2;0!=b&&d>=this.offset;)this.ostream.array[d]=
@@ -96,8 +96,8 @@
 BinaryXMLEncoder.prototype.writeDateTime=function(a,b){4<LOG&&console.log("ENCODING DATE with LONG VALUE");4<LOG&&console.log(b.msec);var c=Math.round(4096*(b.msec/1E3)).toString(16);1==c.length%2&&(c="0"+c);c=DataUtils.toNumbers(c+"0");4<LOG&&console.log("ENCODING DATE with BINARY VALUE");4<LOG&&console.log(c);4<LOG&&console.log("ENCODING DATE with BINARY VALUE(HEX)");4<LOG&&console.log(DataUtils.toHex(c));this.writeElement(a,c)};
 BinaryXMLEncoder.prototype.writeString=function(a){if("string"===typeof a){4<LOG&&console.log("GOING TO WRITE A STRING");4<LOG&&console.log(a);this.ostream.ensureLength(this.offset+a.length);for(var b=0;b<a.length;b++)4<LOG&&console.log("input.charCodeAt(i)="+a.charCodeAt(b)),this.ostream.array[this.offset+b]=a.charCodeAt(b)}else 4<LOG&&console.log("GOING TO WRITE A STRING IN BINARY FORM"),4<LOG&&console.log(a),this.writeBlobArray(a)};
 BinaryXMLEncoder.prototype.writeBlobArray=function(a){4<LOG&&console.log("GOING TO WRITE A BLOB");this.ostream.set(a,this.offset)};BinaryXMLEncoder.prototype.getReducedOstream=function(){return this.ostream.subarray(0,this.offset)};XML_EXT=0;XML_TAG=1;XML_DTAG=2;XML_ATTR=3;XML_DATTR=4;XML_BLOB=5;XML_UDATA=6;XML_CLOSE=0;XML_SUBTYPE_PROCESSING_INSTRUCTIONS=16;XML_TT_BITS=3;XML_TT_MASK=(1<<XML_TT_BITS)-1;XML_TT_VAL_BITS=XML_TT_BITS+1;XML_TT_VAL_MASK=(1<<XML_TT_VAL_BITS)-1;XML_REG_VAL_BITS=7;
-XML_REG_VAL_MASK=(1<<XML_REG_VAL_BITS)-1;XML_TT_NO_MORE=1<<XML_REG_VAL_BITS;BYTE_MASK=255;LONG_BYTES=8;LONG_BITS=64;bits_11=2047;bits_18=262143;bits_32=4294967295;tagToString=function(a){return 0<=a&&a<CCNProtocolDTagsStrings.length?CCNProtocolDTagsStrings[a]:a==CCNProtocolDTags.CCNProtocolDataUnit?CCNProtocolDTags.CCNPROTOCOL_DATA_UNIT:null};
-stringToTag=function(a){for(var b=0;b<CCNProtocolDTagsStrings.length;++b)if(null!=CCNProtocolDTagsStrings[b]&&CCNProtocolDTagsStrings[b]==a)return b;return CCNProtocolDTags.CCNPROTOCOL_DATA_UNIT==a?CCNProtocolDTags.CCNProtocolDataUnit:null};var BinaryXMLDecoder=function(a){this.input=a;this.offset=0};BinaryXMLDecoder.prototype.initializeDecoding=function(){};BinaryXMLDecoder.prototype.readStartDocument=function(){};BinaryXMLDecoder.prototype.readEndDocument=function(){};
+XML_REG_VAL_MASK=(1<<XML_REG_VAL_BITS)-1;XML_TT_NO_MORE=1<<XML_REG_VAL_BITS;BYTE_MASK=255;LONG_BYTES=8;LONG_BITS=64;bits_11=2047;bits_18=262143;bits_32=4294967295;tagToString=function(a){return 0<=a&&a<NDNProtocolDTagsStrings.length?NDNProtocolDTagsStrings[a]:a==NDNProtocolDTags.NDNProtocolDataUnit?NDNProtocolDTags.NDNPROTOCOL_DATA_UNIT:null};
+stringToTag=function(a){for(var b=0;b<NDNProtocolDTagsStrings.length;++b)if(null!=NDNProtocolDTagsStrings[b]&&NDNProtocolDTagsStrings[b]==a)return b;return NDNProtocolDTags.NDNPROTOCOL_DATA_UNIT==a?NDNProtocolDTags.NDNProtocolDataUnit:null};var BinaryXMLDecoder=function(a){this.input=a;this.offset=0};BinaryXMLDecoder.prototype.initializeDecoding=function(){};BinaryXMLDecoder.prototype.readStartDocument=function(){};BinaryXMLDecoder.prototype.readEndDocument=function(){};
 BinaryXMLDecoder.prototype.readStartElement=function(a,b){var c=this.decodeTypeAndVal();if(null==c)throw new ContentDecodingException(Error("Expected start element: "+a+" got something not a tag."));var d=null;c.type()==XML_TAG?(d="string"==typeof c.val()?parseInt(c.val())+1:c.val()+1,d=this.decodeUString(d)):c.type()==XML_DTAG&&(d=c.val());if(null==d||d!=a)throw console.log("expecting "+a+" but got "+d),new ContentDecodingException(Error("Expected start element: "+a+" got: "+d+"("+c.val()+")"));
 null!=b&&readAttributes(b)};
 BinaryXMLDecoder.prototype.readAttributes=function(a){if(null!=a)try{for(var b=this.peekTypeAndVal();null!=b&&(XML_ATTR==b.type()||XML_DATTR==b.type());){var c=this.decodeTypeAndVal(),d=null;if(XML_ATTR==c.type()){var e;e="string"==typeof c.val()?parseInt(c.val())+1:c.val()+1;d=this.decodeUString(e)}else if(XML_DATTR==c.type()&&(d=tagToString(c.val()),null==d))throw new ContentDecodingException(Error("Unknown DATTR value"+c.val()));var f=this.decodeUString();a.push([d,f]);b=this.peekTypeAndVal()}}catch(g){throw new ContentDecodingException(Error("readStartElement",
@@ -107,7 +107,7 @@
 Level.WARNING,g),Error("Cannot reset stream! "+g.getMessage(),g);}}return a};BinaryXMLDecoder.prototype.readBinaryElement=function(a,b,c){this.readStartElement(a,b);return this.readBlob(c)};
 BinaryXMLDecoder.prototype.readEndElement=function(){4<LOG&&console.log("this.offset is "+this.offset);var a=this.input[this.offset];this.offset++;4<LOG&&console.log("XML_CLOSE IS "+XML_CLOSE);4<LOG&&console.log("next is "+a);if(a!=XML_CLOSE)throw console.log("Expected end element, got: "+a),new ContentDecodingException(Error("Expected end element, got: "+a));};BinaryXMLDecoder.prototype.readUString=function(){var a=this.decodeUString();this.readEndElement();return a};
 BinaryXMLDecoder.prototype.readBlob=function(a){if(this.input[this.offset]==XML_CLOSE&&a)return this.readEndElement(),null;a=this.decodeBlob();this.readEndElement();return a};
-BinaryXMLDecoder.prototype.readDateTime=function(a){a=this.readBinaryElement(a);a=DataUtils.toHex(a);a=parseInt(a,16);var b=1E3*(a/4096);4<LOG&&console.log("DECODED DATE WITH VALUE");4<LOG&&console.log(b);b=new CCNTime(b);if(null==b)throw new ContentDecodingException(Error("Cannot parse timestamp: "+DataUtils.printHexBytes(a)));return b};
+BinaryXMLDecoder.prototype.readDateTime=function(a){a=this.readBinaryElement(a);a=DataUtils.toHex(a);a=parseInt(a,16);var b=1E3*(a/4096);4<LOG&&console.log("DECODED DATE WITH VALUE");4<LOG&&console.log(b);b=new NDNTime(b);if(null==b)throw new ContentDecodingException(Error("Cannot parse timestamp: "+DataUtils.printHexBytes(a)));return b};
 BinaryXMLDecoder.prototype.decodeTypeAndVal=function(){var a=-1,b=0,c=!0;do{var d=this.input[this.offset];if(0>d||0==d&&0==b)return null;(c=0==(d&XML_TT_NO_MORE))?(b<<=XML_REG_VAL_BITS,b|=d&XML_REG_VAL_MASK):(a=d&XML_TT_MASK,b<<=XML_TT_VAL_BITS,b|=d>>>XML_TT_BITS&XML_TT_VAL_MASK);this.offset++}while(c);4<LOG&&console.log("TYPE is "+a+" VAL is "+b);return new TypeAndVal(a,b)};
 BinaryXMLDecoder.prototype.peekTypeAndVal=function(){var a=null,b=this.offset;try{a=this.decodeTypeAndVal()}finally{this.offset=b}return a};BinaryXMLDecoder.prototype.decodeBlob=function(a){if(null==a)return a=this.decodeTypeAndVal(),a="string"==typeof a.val()?parseInt(a.val()):a.val(),this.decodeBlob(a);var b=this.input.subarray(this.offset,this.offset+a);this.offset+=a;return b};
 BinaryXMLDecoder.prototype.decodeUString=function(a){if(null==a){a=this.offset;var b=this.decodeTypeAndVal();4<LOG&&console.log("TV is "+b);4<LOG&&console.log(b);4<LOG&&console.log("Type of TV is "+typeof b);return null==b||XML_UDATA!=b.type()?(this.offset=a,""):this.decodeUString(b.val())}a=this.decodeBlob(a);return DataUtils.toString(a)};TypeAndVal=function(a,b){this.t=a;this.v=b};TypeAndVal.prototype.type=function(){return this.t};TypeAndVal.prototype.val=function(){return this.v};
@@ -116,25 +116,26 @@
 BinaryXMLStructureDecoder.prototype.findElementEnd=function(a){if(this.gotElementEnd)return!0;for(var b=new BinaryXMLDecoder(a);;){if(this.offset>=a.length)return!1;switch(this.state){case BinaryXMLStructureDecoder.READ_HEADER_OR_CLOSE:if(0==this.headerLength&&a[this.offset]==XML_CLOSE){++this.offset;--this.level;if(0==this.level)return this.gotElementEnd=!0;if(0>this.level)throw Error("BinaryXMLStructureDecoder: Unexpected close tag at offset "+(this.offset-1));this.startHeader();break}for(var c=
 this.headerLength;;){if(this.offset>=a.length){this.useHeaderBuffer=!0;var d=this.headerLength-c;this.headerBuffer.set(a.subarray(this.offset-d,d),c);return!1}d=a[this.offset++];++this.headerLength;if(d&XML_TT_NO_MORE)break}this.useHeaderBuffer?(d=this.headerLength-c,this.headerBuffer.set(a.subarray(this.offset-d,d),c),c=(new BinaryXMLDecoder(this.headerBuffer.array)).decodeTypeAndVal()):(b.seek(this.offset-this.headerLength),c=b.decodeTypeAndVal());if(null==c)throw Error("BinaryXMLStructureDecoder: Can't read header starting at offset "+
 (this.offset-this.headerLength));d=c.t;if(d==XML_DATTR)this.startHeader();else if(d==XML_DTAG||d==XML_EXT)++this.level,this.startHeader();else if(d==XML_TAG||d==XML_ATTR)d==XML_TAG&&++this.level,this.nBytesToRead=c.v+1,this.state=BinaryXMLStructureDecoder.READ_BYTES;else if(d==XML_BLOB||d==XML_UDATA)this.nBytesToRead=c.v,this.state=BinaryXMLStructureDecoder.READ_BYTES;else throw Error("BinaryXMLStructureDecoder: Unrecognized header type "+d);break;case BinaryXMLStructureDecoder.READ_BYTES:c=a.length-
-this.offset;if(c<this.nBytesToRead)return this.offset+=c,this.nBytesToRead-=c,!1;this.offset+=this.nBytesToRead;this.startHeader();break;default:throw Error("BinaryXMLStructureDecoder: Unrecognized state "+this.state);}}};BinaryXMLStructureDecoder.prototype.startHeader=function(){this.headerLength=0;this.useHeaderBuffer=!1;this.state=BinaryXMLStructureDecoder.READ_HEADER_OR_CLOSE};BinaryXMLStructureDecoder.prototype.seek=function(a){this.offset=a};var BinaryXmlWireFormat=function(){};
-BinaryXmlWireFormat.prototype.encodeInterest=function(a){var b=new BinaryXMLEncoder;BinaryXmlWireFormat.encodeInterest(a,b);return b.getReducedOstream()};BinaryXmlWireFormat.prototype.decodeInterest=function(a,b){var c=new BinaryXMLDecoder(b);BinaryXmlWireFormat.decodeInterest(a,c)};BinaryXmlWireFormat.prototype.encodeContentObject=function(a){var b=new BinaryXMLEncoder;BinaryXmlWireFormat.encodeContentObject(a,b);return b.getReducedOstream()};
-BinaryXmlWireFormat.prototype.decodeContentObject=function(a,b){var c=new BinaryXMLDecoder(b);BinaryXmlWireFormat.decodeContentObject(a,c)};BinaryXmlWireFormat.instance=new BinaryXmlWireFormat;
-BinaryXmlWireFormat.encodeInterest=function(a,b){b.writeStartElement(CCNProtocolDTags.Interest);a.name.to_ccnb(b);null!=a.minSuffixComponents&&b.writeElement(CCNProtocolDTags.MinSuffixComponents,a.minSuffixComponents);null!=a.maxSuffixComponents&&b.writeElement(CCNProtocolDTags.MaxSuffixComponents,a.maxSuffixComponents);null!=a.publisherPublicKeyDigest&&a.publisherPublicKeyDigest.to_ccnb(b);null!=a.exclude&&a.exclude.to_ccnb(b);null!=a.childSelector&&b.writeElement(CCNProtocolDTags.ChildSelector,
-a.childSelector);a.DEFAULT_ANSWER_ORIGIN_KIND!=a.answerOriginKind&&null!=a.answerOriginKind&&b.writeElement(CCNProtocolDTags.AnswerOriginKind,a.answerOriginKind);null!=a.scope&&b.writeElement(CCNProtocolDTags.Scope,a.scope);null!=a.interestLifetime&&b.writeElement(CCNProtocolDTags.InterestLifetime,DataUtils.nonNegativeIntToBigEndian(4096*(a.interestLifetime/1E3)));null!=a.nonce&&b.writeElement(CCNProtocolDTags.Nonce,a.nonce);b.writeEndElement()};
-BinaryXmlWireFormat.decodeInterest=function(a,b){b.readStartElement(CCNProtocolDTags.Interest);a.name=new Name;a.name.from_ccnb(b);a.minSuffixComponents=b.peekStartElement(CCNProtocolDTags.MinSuffixComponents)?b.readIntegerElement(CCNProtocolDTags.MinSuffixComponents):null;a.maxSuffixComponents=b.peekStartElement(CCNProtocolDTags.MaxSuffixComponents)?b.readIntegerElement(CCNProtocolDTags.MaxSuffixComponents):null;b.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)?(a.publisherPublicKeyDigest=
-new PublisherPublicKeyDigest,a.publisherPublicKeyDigest.from_ccnb(b)):a.publisherPublicKeyDigest=null;b.peekStartElement(CCNProtocolDTags.Exclude)?(a.exclude=new Exclude,a.exclude.from_ccnb(b)):a.exclude=null;a.childSelector=b.peekStartElement(CCNProtocolDTags.ChildSelector)?b.readIntegerElement(CCNProtocolDTags.ChildSelector):null;a.answerOriginKind=b.peekStartElement(CCNProtocolDTags.AnswerOriginKind)?b.readIntegerElement(CCNProtocolDTags.AnswerOriginKind):null;a.scope=b.peekStartElement(CCNProtocolDTags.Scope)?
-b.readIntegerElement(CCNProtocolDTags.Scope):null;a.interestLifetime=b.peekStartElement(CCNProtocolDTags.InterestLifetime)?1E3*DataUtils.bigEndianToUnsignedInt(b.readBinaryElement(CCNProtocolDTags.InterestLifetime))/4096:null;a.nonce=b.peekStartElement(CCNProtocolDTags.Nonce)?b.readBinaryElement(CCNProtocolDTags.Nonce):null;b.readEndElement()};
-BinaryXmlWireFormat.encodeContentObject=function(a,b){b.writeStartElement(a.getElementLabel());null!=a.signature&&a.signature.to_ccnb(b);a.startSIG=b.offset;null!=a.name&&a.name.to_ccnb(b);null!=a.signedInfo&&a.signedInfo.to_ccnb(b);b.writeElement(CCNProtocolDTags.Content,a.content);a.endSIG=b.offset;b.writeEndElement();a.saveRawData(b.ostream)};
-BinaryXmlWireFormat.decodeContentObject=function(a,b){b.readStartElement(a.getElementLabel());b.peekStartElement(CCNProtocolDTags.Signature)?(a.signature=new Signature,a.signature.from_ccnb(b)):a.signature=null;a.startSIG=b.offset;a.name=new Name;a.name.from_ccnb(b);b.peekStartElement(CCNProtocolDTags.SignedInfo)?(a.signedInfo=new SignedInfo,a.signedInfo.from_ccnb(b)):a.signedInfo=null;a.content=b.readBinaryElement(CCNProtocolDTags.Content,null,!0);a.endSIG=b.offset;b.readEndElement();a.saveRawData(b.input)};
+this.offset;if(c<this.nBytesToRead)return this.offset+=c,this.nBytesToRead-=c,!1;this.offset+=this.nBytesToRead;this.startHeader();break;default:throw Error("BinaryXMLStructureDecoder: Unrecognized state "+this.state);}}};BinaryXMLStructureDecoder.prototype.startHeader=function(){this.headerLength=0;this.useHeaderBuffer=!1;this.state=BinaryXMLStructureDecoder.READ_HEADER_OR_CLOSE};BinaryXMLStructureDecoder.prototype.seek=function(a){this.offset=a};var WireFormat=function(){};
+WireFormat.prototype.encodeInterest=function(){throw Error("encodeInterest is unimplemented in the base WireFormat class.  You should use a derived class.");};WireFormat.prototype.decodeInterest=function(){throw Error("decodeInterest is unimplemented in the base WireFormat class.  You should use a derived class.");};WireFormat.prototype.encodeContentObject=function(){throw Error("encodeContentObject is unimplemented in the base WireFormat class.  You should use a derived class.");};
+WireFormat.prototype.decodeContentObject=function(){throw Error("decodeContentObject is unimplemented in the base WireFormat class.  You should use a derived class.");};var BinaryXmlWireFormat=function(){WireFormat.call(this)};BinaryXmlWireFormat.prototype.encodeInterest=function(a){var b=new BinaryXMLEncoder;BinaryXmlWireFormat.encodeInterest(a,b);return b.getReducedOstream()};
+BinaryXmlWireFormat.prototype.decodeInterest=function(a,b){var c=new BinaryXMLDecoder(b);BinaryXmlWireFormat.decodeInterest(a,c)};BinaryXmlWireFormat.prototype.encodeContentObject=function(a){var b=new BinaryXMLEncoder;BinaryXmlWireFormat.encodeContentObject(a,b);return b.getReducedOstream()};BinaryXmlWireFormat.prototype.decodeContentObject=function(a,b){var c=new BinaryXMLDecoder(b);BinaryXmlWireFormat.decodeContentObject(a,c)};BinaryXmlWireFormat.instance=new BinaryXmlWireFormat;
+BinaryXmlWireFormat.encodeInterest=function(a,b){b.writeStartElement(NDNProtocolDTags.Interest);a.name.to_ndnb(b);null!=a.minSuffixComponents&&b.writeElement(NDNProtocolDTags.MinSuffixComponents,a.minSuffixComponents);null!=a.maxSuffixComponents&&b.writeElement(NDNProtocolDTags.MaxSuffixComponents,a.maxSuffixComponents);null!=a.publisherPublicKeyDigest&&a.publisherPublicKeyDigest.to_ndnb(b);null!=a.exclude&&a.exclude.to_ndnb(b);null!=a.childSelector&&b.writeElement(NDNProtocolDTags.ChildSelector,
+a.childSelector);a.DEFAULT_ANSWER_ORIGIN_KIND!=a.answerOriginKind&&null!=a.answerOriginKind&&b.writeElement(NDNProtocolDTags.AnswerOriginKind,a.answerOriginKind);null!=a.scope&&b.writeElement(NDNProtocolDTags.Scope,a.scope);null!=a.interestLifetime&&b.writeElement(NDNProtocolDTags.InterestLifetime,DataUtils.nonNegativeIntToBigEndian(4096*(a.interestLifetime/1E3)));null!=a.nonce&&b.writeElement(NDNProtocolDTags.Nonce,a.nonce);b.writeEndElement()};
+BinaryXmlWireFormat.decodeInterest=function(a,b){b.readStartElement(NDNProtocolDTags.Interest);a.name=new Name;a.name.from_ndnb(b);a.minSuffixComponents=b.peekStartElement(NDNProtocolDTags.MinSuffixComponents)?b.readIntegerElement(NDNProtocolDTags.MinSuffixComponents):null;a.maxSuffixComponents=b.peekStartElement(NDNProtocolDTags.MaxSuffixComponents)?b.readIntegerElement(NDNProtocolDTags.MaxSuffixComponents):null;b.peekStartElement(NDNProtocolDTags.PublisherPublicKeyDigest)?(a.publisherPublicKeyDigest=
+new PublisherPublicKeyDigest,a.publisherPublicKeyDigest.from_ndnb(b)):a.publisherPublicKeyDigest=null;b.peekStartElement(NDNProtocolDTags.Exclude)?(a.exclude=new Exclude,a.exclude.from_ndnb(b)):a.exclude=null;a.childSelector=b.peekStartElement(NDNProtocolDTags.ChildSelector)?b.readIntegerElement(NDNProtocolDTags.ChildSelector):null;a.answerOriginKind=b.peekStartElement(NDNProtocolDTags.AnswerOriginKind)?b.readIntegerElement(NDNProtocolDTags.AnswerOriginKind):null;a.scope=b.peekStartElement(NDNProtocolDTags.Scope)?
+b.readIntegerElement(NDNProtocolDTags.Scope):null;a.interestLifetime=b.peekStartElement(NDNProtocolDTags.InterestLifetime)?1E3*DataUtils.bigEndianToUnsignedInt(b.readBinaryElement(NDNProtocolDTags.InterestLifetime))/4096:null;a.nonce=b.peekStartElement(NDNProtocolDTags.Nonce)?b.readBinaryElement(NDNProtocolDTags.Nonce):null;b.readEndElement()};
+BinaryXmlWireFormat.encodeContentObject=function(a,b){b.writeStartElement(a.getElementLabel());null!=a.signature&&a.signature.to_ndnb(b);a.startSIG=b.offset;null!=a.name&&a.name.to_ndnb(b);null!=a.signedInfo&&a.signedInfo.to_ndnb(b);b.writeElement(NDNProtocolDTags.Content,a.content);a.endSIG=b.offset;b.writeEndElement();a.saveRawData(b.ostream)};
+BinaryXmlWireFormat.decodeContentObject=function(a,b){b.readStartElement(a.getElementLabel());b.peekStartElement(NDNProtocolDTags.Signature)?(a.signature=new Signature,a.signature.from_ndnb(b)):a.signature=null;a.startSIG=b.offset;a.name=new Name;a.name.from_ndnb(b);b.peekStartElement(NDNProtocolDTags.SignedInfo)?(a.signedInfo=new SignedInfo,a.signedInfo.from_ndnb(b)):a.signedInfo=null;a.content=b.readBinaryElement(NDNProtocolDTags.Content,null,!0);a.endSIG=b.offset;b.readEndElement();a.saveRawData(b.input)};
 var DataUtils=function(){};DataUtils.keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";DataUtils.stringtoBase64=function(a){var b="",c,d,e="",f,g,h="",j=0;do c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=a.charCodeAt(j++),f=c>>2,c=(c&3)<<4|d>>4,g=(d&15)<<2|e>>6,h=e&63,isNaN(d)?g=h=64:isNaN(e)&&(h=64),b=b+DataUtils.keyStr.charAt(f)+DataUtils.keyStr.charAt(c)+DataUtils.keyStr.charAt(g)+DataUtils.keyStr.charAt(h);while(j<a.length);return b};
 DataUtils.base64toString=function(a){var b="",c,d,e="",f,g="",h=0;/[^A-Za-z0-9\+\/\=]/g.exec(a)&&alert("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding.");a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");do c=DataUtils.keyStr.indexOf(a.charAt(h++)),d=DataUtils.keyStr.indexOf(a.charAt(h++)),f=DataUtils.keyStr.indexOf(a.charAt(h++)),g=DataUtils.keyStr.indexOf(a.charAt(h++)),c=c<<2|d>>4,d=(d&15)<<4|f>>2,e=(f&3)<<6|g,
-b+=String.fromCharCode(c),64!=f&&(b+=String.fromCharCode(d)),64!=g&&(b+=String.fromCharCode(e));while(h<a.length)};DataUtils.toHex=function(a){4<LOG&&console.log("ABOUT TO CONVERT "+a);for(var b="",c=0;c<a.length;c++)b+=(16>a[c]?"0":"")+a[c].toString(16);4<LOG&&console.log("Converted to: "+b);return b};DataUtils.stringToHex=function(a){for(var b="",c=0;c<a.length;++c)var d=a.charCodeAt(c),b=b+((16>d?"0":"")+d.toString(16));return b};
+b+=String.fromCharCode(c),64!=f&&(b+=String.fromCharCode(d)),64!=g&&(b+=String.fromCharCode(e));while(h<a.length);return b};DataUtils.toHex=function(a){4<LOG&&console.log("ABOUT TO CONVERT "+a);for(var b="",c=0;c<a.length;c++)b+=(16>a[c]?"0":"")+a[c].toString(16);4<LOG&&console.log("Converted to: "+b);return b};DataUtils.stringToHex=function(a){for(var b="",c=0;c<a.length;++c)var d=a.charCodeAt(c),b=b+((16>d?"0":"")+d.toString(16));return b};
 DataUtils.toString=function(a){for(var b="",c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return b};DataUtils.toNumbers=function(a){if("string"==typeof a){var b=new Uint8Array(Math.floor(a.length/2)),c=0;a.replace(/(..)/g,function(a){b[c++]=parseInt(a,16)});return b}};DataUtils.hexToRawString=function(a){if("string"==typeof a){var b="";a.replace(/(..)/g,function(a){b+=String.fromCharCode(parseInt(a,16))});return b}};
 DataUtils.toNumbersFromString=function(a){for(var b=new Uint8Array(a.length),c=0;c<a.length;c++)b[c]=a.charCodeAt(c);return b};DataUtils.stringToUtf8Array=function(a){return DataUtils.toNumbersFromString(str2rstr_utf8(a))};DataUtils.concatArrays=function(a){for(var b=0,c=0;c<a.length;++c)b+=a[c].length;for(var b=new Uint8Array(b),d=0,c=0;c<a.length;++c)b.set(a[c],d),d+=a[c].length;return b};
 DataUtils.decodeUtf8=function(a){for(var b="",c=0,d=0,e=0;c<a.length;)if(d=a.charCodeAt(c),128>d)b+=String.fromCharCode(d),c++;else if(191<d&&224>d)e=a.charCodeAt(c+1),b+=String.fromCharCode((d&31)<<6|e&63),c+=2;else var e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b=b+String.fromCharCode((d&15)<<12|(e&63)<<6|f&63),c=c+3;return b};DataUtils.arraysEqual=function(a,b){if(a.length!=b.length)return!1;for(var c=0;c<a.length;++c)if(a[c]!=b[c])return!1;return!0};
 DataUtils.bigEndianToUnsignedInt=function(a){for(var b=0,c=0;c<a.length;++c)b<<=8,b+=a[c];return b};DataUtils.nonNegativeIntToBigEndian=function(a){a=Math.round(a);if(0>=a)return new Uint8Array(0);for(var b=new Uint8Array(8),c=0;0!=a;)++c,b[8-c]=a&255,a>>=8;return b.subarray(8-c,8)};DataUtils.shuffle=function(a){for(var b=a.length-1;1<=b;--b){var c=Math.floor(Math.random()*(b+1)),d=a[b];a[b]=a[c];a[c]=d}};function encodeToHexInterest(a){return DataUtils.toHex(a.encode())}
-function encodeToBinaryInterest(a){return a.encode()}function encodeToHexContentObject(a){return DataUtils.toHex(a.encode())}function encodeToBinaryContentObject(a){a.encode()}function encodeForwardingEntry(a){var b=new BinaryXMLEncoder;a.to_ccnb(b);return b.getReducedOstream()}function decodeHexFaceInstance(a){var b=DataUtils.toNumbers(a);a=new BinaryXMLDecoder(b);3<LOG&&console.log("DECODING HEX FACE INSTANCE  \n"+b);b=new FaceInstance;b.from_ccnb(a);return b}
-function decodeHexInterest(a){var b=new Interest;b.decode(DataUtils.toNumbers(a));return b}function decodeHexContentObject(a){var b=new ContentObject;b.decode(DataUtils.toNumbers(a));return b}function decodeHexForwardingEntry(a){var b=DataUtils.toNumbers(a);a=new BinaryXMLDecoder(b);3<LOG&&console.log("DECODED HEX FORWARDING ENTRY \n"+b);b=new ForwardingEntry;b.from_ccnb(a);return b}
+function encodeToBinaryInterest(a){return a.encode()}function encodeToHexContentObject(a){return DataUtils.toHex(a.encode())}function encodeToBinaryContentObject(a){a.encode()}function encodeForwardingEntry(a){var b=new BinaryXMLEncoder;a.to_ndnb(b);return b.getReducedOstream()}function decodeHexFaceInstance(a){var b=DataUtils.toNumbers(a);a=new BinaryXMLDecoder(b);3<LOG&&console.log("DECODING HEX FACE INSTANCE  \n"+b);b=new FaceInstance;b.from_ndnb(a);return b}
+function decodeHexInterest(a){var b=new Interest;b.decode(DataUtils.toNumbers(a));return b}function decodeHexContentObject(a){var b=new ContentObject;b.decode(DataUtils.toNumbers(a));return b}function decodeHexForwardingEntry(a){var b=DataUtils.toNumbers(a);a=new BinaryXMLDecoder(b);3<LOG&&console.log("DECODED HEX FORWARDING ENTRY \n"+b);b=new ForwardingEntry;b.from_ndnb(a);return b}
 function decodeSubjectPublicKeyInfo(a){a=DataUtils.toHex(a).toLowerCase();a=_x509_getPublicKeyHexArrayFromCertHex(a,_x509_getSubjectPublicKeyPosFromCertHex(a,0));var b=new RSAKey;b.setPublic(a[0],a[1]);return b}
 function contentObjectToHtml(a){var b="";if(-1==a)b+="NO CONTENT FOUND";else if(-2==a)b+="CONTENT NAME IS EMPTY";else{null!=a.name&&null!=a.name.components&&(b+="NAME: "+a.name.to_uri(),b+="<br /><br />");null!=a.content&&(b+="CONTENT(ASCII): "+DataUtils.toString(a.content),b+="<br />",b+="<br />");null!=a.content&&(b+="CONTENT(hex): "+DataUtils.toHex(a.content),b+="<br />",b+="<br />");null!=a.signature&&null!=a.signature.digestAlgorithm&&(b+="DigestAlgorithm (hex): "+DataUtils.toHex(a.signature.digestAlgorithm),
 b+="<br />",b+="<br />");null!=a.signature&&null!=a.signature.witness&&(b+="Witness (hex): "+DataUtils.toHex(a.signature.witness),b+="<br />",b+="<br />");null!=a.signature&&null!=a.signature.signature&&(b+="Signature(hex): "+DataUtils.toHex(a.signature.signature),b+="<br />",b+="<br />");null!=a.signedInfo&&(null!=a.signedInfo.publisher&&null!=a.signedInfo.publisher.publisherPublicKeyDigest)&&(b+="Publisher Public Key Digest(hex): "+DataUtils.toHex(a.signedInfo.publisher.publisherPublicKeyDigest),
@@ -259,7 +260,7 @@
 BigInteger.prototype.andNot=bnAndNot;BigInteger.prototype.not=bnNot;BigInteger.prototype.shiftLeft=bnShiftLeft;BigInteger.prototype.shiftRight=bnShiftRight;BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit;BigInteger.prototype.bitCount=bnBitCount;BigInteger.prototype.testBit=bnTestBit;BigInteger.prototype.setBit=bnSetBit;BigInteger.prototype.clearBit=bnClearBit;BigInteger.prototype.flipBit=bnFlipBit;BigInteger.prototype.add=bnAdd;BigInteger.prototype.subtract=bnSubtract;
 BigInteger.prototype.multiply=bnMultiply;BigInteger.prototype.divide=bnDivide;BigInteger.prototype.remainder=bnRemainder;BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder;BigInteger.prototype.modPow=bnModPow;BigInteger.prototype.modInverse=bnModInverse;BigInteger.prototype.pow=bnPow;BigInteger.prototype.gcd=bnGCD;BigInteger.prototype.isProbablePrime=bnIsProbablePrime;
 var LOG=0,NDN=function NDN(b){if(!NDN.supported)throw Error("The necessary JavaScript support is not available on this platform.");b=b||{};this.transport=(b.getTransport||function(){return new WebSocketTransport})();this.getHostAndPort=b.getHostAndPort||this.transport.defaultGetHostAndPort;this.host=void 0!==b.host?b.host:null;this.port=b.port||9696;this.readyStatus=NDN.UNOPEN;this.verify=void 0!==b.verify?b.verify:!0;this.onopen=b.onopen||function(){3<LOG&&console.log("NDN connection established.")};
-this.onclose=b.onclose||function(){3<LOG&&console.log("NDN connection closed.")};this.ccndid=null};NDN.UNOPEN=0;NDN.OPENED=1;NDN.CLOSED=2;NDN.getSupported=function(){try{(new Uint8Array(1)).subarray(0,1)}catch(a){return console.log("NDN not available: Uint8Array not supported. "+a),!1}return!0};NDN.supported=NDN.getSupported();NDN.ccndIdFetcher=new Name("/%C1.M.S.localhost/%C1.M.SRV/ccnd/KEY");NDN.prototype.createRoute=function(a,b){this.host=a;this.port=b};NDN.KeyStore=[];
+this.onclose=b.onclose||function(){3<LOG&&console.log("NDN connection closed.")};this.ndndid=null};NDN.UNOPEN=0;NDN.OPENED=1;NDN.CLOSED=2;NDN.getSupported=function(){try{(new Uint8Array(1)).subarray(0,1)}catch(a){return console.log("NDN not available: Uint8Array not supported. "+a),!1}return!0};NDN.supported=NDN.getSupported();NDN.ndndIdFetcher=new Name("/%C1.M.S.localhost/%C1.M.SRV/ndnd/KEY");NDN.prototype.createRoute=function(a,b){this.host=a;this.port=b};NDN.KeyStore=[];
 var KeyStoreEntry=function(a,b,c){this.keyName=a;this.rsaKey=b;this.timeStamp=c};NDN.addKeyEntry=function(a){null==NDN.getKeyByName(a.keyName)&&NDN.KeyStore.push(a)};NDN.getKeyByName=function(a){for(var b=null,c=0;c<NDN.KeyStore.length;c++)if(NDN.KeyStore[c].keyName.contentName.match(a.contentName)&&(null==b||NDN.KeyStore[c].keyName.contentName.components.length>b.keyName.contentName.components.length))b=NDN.KeyStore[c];return b};NDN.PITTable=[];
 var PITEntry=function(a,b){this.interest=a;this.closure=b;this.timerID=-1};NDN.getEntryForExpressedInterest=function(a){for(var b=null,c=0;c<NDN.PITTable.length;c++)if(NDN.PITTable[c].interest.matches_name(a)&&(null==b||NDN.PITTable[c].interest.name.components.length>b.interest.name.components.length))b=NDN.PITTable[c];return b};NDN.CSTable=[];var CSEntry=function(a,b){this.name=a;this.closure=b};
 function getEntryForRegisteredPrefix(a){for(var b=0;b<NDN.CSTable.length;b++)if(NDN.CSTable[b].name.match(a))return NDN.CSTable[b];return null}NDN.makeShuffledGetHostAndPort=function(a,b){a=a.slice(0,a.length);DataUtils.shuffle(a);return function(){return 0==a.length?null:{host:a.splice(0,1)[0],port:b}}};
@@ -267,13 +268,13 @@
 this;this.connectAndExecute(function(){e.reconnectAndExpressInterest(d,b)})}else this.reconnectAndExpressInterest(d,b)};NDN.prototype.reconnectAndExpressInterest=function(a,b){if(this.transport.connectedHost!=this.host||this.transport.connectedPort!=this.port){var c=this;this.transport.connect(c,function(){c.expressInterestHelper(a,b)})}else this.expressInterestHelper(a,b)};
 NDN.prototype.expressInterestHelper=function(a,b){var c=encodeToBinaryInterest(a),d=this;if(null!=b){var e=new PITEntry(a,b);NDN.PITTable.push(e);b.pitEntry=e;var f=a.interestLifetime||4E3,g=function(){1<LOG&&console.log("Interest time out: "+a.name.to_uri());var h=NDN.PITTable.indexOf(e);0<=h&&NDN.PITTable.splice(h,1);b.upcall(Closure.UPCALL_INTEREST_TIMED_OUT,new UpcallInfo(d,a,0,null))==Closure.RESULT_REEXPRESS&&(1<LOG&&console.log("Re-express interest: "+a.name.to_uri()),e.timerID=setTimeout(g,
 f),NDN.PITTable.push(e),d.transport.send(c))};e.timerID=setTimeout(g,f)}this.transport.send(c)};
-NDN.prototype.registerPrefix=function(a,b,c){var d=this,e=function(){if(null==d.ccndid){var e=new Interest(NDN.ccndIdFetcher);e.interestLifetime=4E3;3<LOG&&console.log("Expressing interest for ccndid from ccnd.");d.reconnectAndExpressInterest(e,new NDN.FetchCcndidClosure(d,a,b,c))}else d.registerPrefixHelper(a,b,c)};null==this.host||null==this.port?null==this.getHostAndPort?console.log("ERROR: host OR port NOT SET"):this.connectAndExecute(e):e()};
-NDN.FetchCcndidClosure=function(a,b,c,d){Closure.call(this);this.ndn=a;this.name=b;this.callerClosure=c;this.flag=d};
-NDN.FetchCcndidClosure.prototype.upcall=function(a,b){if(a==Closure.UPCALL_INTEREST_TIMED_OUT)return console.log("Timeout while requesting the ccndid.  Cannot registerPrefix for "+this.name.to_uri()+" ."),Closure.RESULT_OK;if(!(a==Closure.UPCALL_CONTENT||a==Closure.UPCALL_CONTENT_UNVERIFIED))return Closure.RESULT_ERR;var c=b.contentObject;!c.signedInfo||!c.signedInfo.publisher||!c.signedInfo.publisher.publisherPublicKeyDigest?console.log("ContentObject doesn't have a publisherPublicKeyDigest. Cannot set ccndid and registerPrefix for "+
-this.name.to_uri()+" ."):(3<LOG&&console.log("Got ccndid from ccnd."),this.ndn.ccndid=c.signedInfo.publisher.publisherPublicKeyDigest,3<LOG&&console.log(this.ndn.ccndid),this.ndn.registerPrefixHelper(this.name,this.callerClosure,this.flag));return Closure.RESULT_OK};
-NDN.prototype.registerPrefixHelper=function(a,b){var c=new ForwardingEntry("selfreg",a,null,null,3,2147483647),c=encodeForwardingEntry(c),d=new SignedInfo;d.setFields();c=new ContentObject(new Name,d,c,new Signature);c.sign();c=encodeToBinaryContentObject(c);c=new Name(["ccnx",this.ccndid,"selfreg",c]);c=new Interest(c);c.scope=1;3<LOG&&console.log("Send Interest registration packet.");d=new CSEntry(a.getName(),b);NDN.CSTable.push(d);this.transport.send(encodeToBinaryInterest(c))};
-NDN.prototype.onReceivedElement=function(a){3<LOG&&console.log("Complete element received. Length "+a.length+". Start decoding.");var b=new BinaryXMLDecoder(a);if(b.peekStartElement(CCNProtocolDTags.Interest))3<LOG&&console.log("Interest packet received."),a=new Interest,a.from_ccnb(b),3<LOG&&console.log(a),b=escape(a.name.getName()),3<LOG&&console.log(b),b=getEntryForRegisteredPrefix(b),null!=b&&(a=new UpcallInfo(this,a,0,null),b.closure.upcall(Closure.UPCALL_INTEREST,a)==Closure.RESULT_INTEREST_CONSUMED&&
-null!=a.contentObject&&this.transport.send(encodeToBinaryContentObject(a.contentObject)));else if(b.peekStartElement(CCNProtocolDTags.ContentObject)){if(3<LOG&&console.log("ContentObject packet received."),a=new ContentObject,a.from_ccnb(b),b=NDN.getEntryForExpressedInterest(a.name),null!=b){clearTimeout(b.timerID);var c=NDN.PITTable.indexOf(b);0<=c&&NDN.PITTable.splice(c,1);c=b.closure;if(!1==this.verify)c.upcall(Closure.UPCALL_CONTENT_UNVERIFIED,new UpcallInfo(this,b.interest,0,a));else{var d=function(a,
+NDN.prototype.registerPrefix=function(a,b,c){var d=this,e=function(){if(null==d.ndndid){var e=new Interest(NDN.ndndIdFetcher);e.interestLifetime=4E3;3<LOG&&console.log("Expressing interest for ndndid from ndnd.");d.reconnectAndExpressInterest(e,new NDN.FetchNdndidClosure(d,a,b,c))}else d.registerPrefixHelper(a,b,c)};null==this.host||null==this.port?null==this.getHostAndPort?console.log("ERROR: host OR port NOT SET"):this.connectAndExecute(e):e()};
+NDN.FetchNdndidClosure=function(a,b,c,d){Closure.call(this);this.ndn=a;this.name=b;this.callerClosure=c;this.flag=d};
+NDN.FetchNdndidClosure.prototype.upcall=function(a,b){if(a==Closure.UPCALL_INTEREST_TIMED_OUT)return console.log("Timeout while requesting the ndndid.  Cannot registerPrefix for "+this.name.to_uri()+" ."),Closure.RESULT_OK;if(!(a==Closure.UPCALL_CONTENT||a==Closure.UPCALL_CONTENT_UNVERIFIED))return Closure.RESULT_ERR;var c=b.contentObject;!c.signedInfo||!c.signedInfo.publisher||!c.signedInfo.publisher.publisherPublicKeyDigest?console.log("ContentObject doesn't have a publisherPublicKeyDigest. Cannot set ndndid and registerPrefix for "+
+this.name.to_uri()+" ."):(3<LOG&&console.log("Got ndndid from ndnd."),this.ndn.ndndid=c.signedInfo.publisher.publisherPublicKeyDigest,3<LOG&&console.log(this.ndn.ndndid),this.ndn.registerPrefixHelper(this.name,this.callerClosure,this.flag));return Closure.RESULT_OK};
+NDN.prototype.registerPrefixHelper=function(a,b){var c=new ForwardingEntry("selfreg",a,null,null,3,2147483647),c=encodeForwardingEntry(c),d=new SignedInfo;d.setFields();c=new ContentObject(new Name,d,c);c.sign();c=encodeToBinaryContentObject(c);c=new Name(["ndnx",this.ndndid,"selfreg",c]);c=new Interest(c);c.scope=1;3<LOG&&console.log("Send Interest registration packet.");d=new CSEntry(a.getName(),b);NDN.CSTable.push(d);this.transport.send(encodeToBinaryInterest(c))};
+NDN.prototype.onReceivedElement=function(a){3<LOG&&console.log("Complete element received. Length "+a.length+". Start decoding.");var b=new BinaryXMLDecoder(a);if(b.peekStartElement(NDNProtocolDTags.Interest))3<LOG&&console.log("Interest packet received."),a=new Interest,a.from_ndnb(b),3<LOG&&console.log(a),b=escape(a.name.getName()),3<LOG&&console.log(b),b=getEntryForRegisteredPrefix(b),null!=b&&(a=new UpcallInfo(this,a,0,null),b.closure.upcall(Closure.UPCALL_INTEREST,a)==Closure.RESULT_INTEREST_CONSUMED&&
+null!=a.contentObject&&this.transport.send(encodeToBinaryContentObject(a.contentObject)));else if(b.peekStartElement(NDNProtocolDTags.ContentObject)){if(3<LOG&&console.log("ContentObject packet received."),a=new ContentObject,a.from_ndnb(b),b=NDN.getEntryForExpressedInterest(a.name),null!=b){clearTimeout(b.timerID);var c=NDN.PITTable.indexOf(b);0<=c&&NDN.PITTable.splice(c,1);c=b.closure;if(!1==this.verify)c.upcall(Closure.UPCALL_CONTENT_UNVERIFIED,new UpcallInfo(this,b.interest,0,a));else{var d=function(a,
 b,c,d,e){this.contentObject=a;this.closure=b;this.keyName=c;this.sigHex=d;this.witness=e;Closure.call(this)},e=this;d.prototype.upcall=function(a,b){if(a==Closure.UPCALL_INTEREST_TIMED_OUT)console.log("In KeyFetchClosure.upcall: interest time out."),console.log(this.keyName.contentName.getName());else if(a==Closure.UPCALL_CONTENT){var c=decodeSubjectPublicKeyInfo(b.contentObject.content),d=!0==c.verifyByteArray(this.contentObject.rawSignatureData,this.witness,this.sigHex)?Closure.UPCALL_CONTENT:Closure.UPCALL_CONTENT_BAD;
 this.closure.upcall(d,new UpcallInfo(e,null,0,this.contentObject));c=new KeyStoreEntry(h.keyName,c,(new Date).getTime());NDN.addKeyEntry(c)}else a==Closure.UPCALL_CONTENT_BAD&&console.log("In KeyFetchClosure.upcall: signature verification failed")};if(a.signedInfo&&a.signedInfo.locator&&a.signature){3<LOG&&console.log("Key verification...");var f=DataUtils.toHex(a.signature.signature).toLowerCase(),g=null;null!=a.signature.Witness&&(g=new Witness,g.decode(a.signature.Witness));var h=a.signedInfo.locator;
 if(h.type==KeyLocatorType.KEYNAME)if(3<LOG&&console.log("KeyLocator contains KEYNAME"),h.keyName.contentName.match(a.name))3<LOG&&console.log("Content is key itself"),d=decodeSubjectPublicKeyInfo(a.content),f=d.verifyByteArray(a.rawSignatureData,g,f),f=!0==f?Closure.UPCALL_CONTENT:Closure.UPCALL_CONTENT_BAD,c.upcall(f,new UpcallInfo(this,b.interest,0,a));else{var j=NDN.getKeyByName(h.keyName);j?(3<LOG&&console.log("Local key cache hit"),d=j.rsaKey,f=d.verifyByteArray(a.rawSignatureData,g,f),f=!0==