Changing ccn to ndn

Change-Id: Iba4ec8e48dd5345903cc3518aaf98d4d37d89ff1
diff --git a/js/encoding/BinaryXMLDecoder.js b/js/encoding/BinaryXMLDecoder.js
index 675a876..69206eb 100644
--- a/js/encoding/BinaryXMLDecoder.js
+++ b/js/encoding/BinaryXMLDecoder.js
@@ -1,5 +1,5 @@
 /**
- * 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.
@@ -43,10 +43,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;
 };
@@ -54,13 +54,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;
 };
@@ -399,7 +399,7 @@
 };
 
 
-//CCNTime
+//NDNTime
 BinaryXMLDecoder.prototype.readDateTime = function(
 	//long 
 	startTag)  {
@@ -422,8 +422,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) {
diff --git a/js/encoding/BinaryXMLEncoder.js b/js/encoding/BinaryXMLEncoder.js
index 517abca..f370371 100644
--- a/js/encoding/BinaryXMLEncoder.js
+++ b/js/encoding/BinaryXMLEncoder.js
@@ -1,5 +1,5 @@
 /**
- * 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.
@@ -122,10 +122,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;
 };
@@ -133,13 +133,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;
 };
@@ -321,7 +321,7 @@
 BinaryXMLEncoder.prototype.writeDateTime = function(
 		//String 
 		tag, 
-		//CCNTime 
+		//NDNTime 
 		dateTime) {
 	
 	if(LOG>4)console.log('ENCODING DATE with LONG VALUE');
diff --git a/js/encoding/BinaryXMLStructureDecoder.js b/js/encoding/BinaryXMLStructureDecoder.js
index 19f7ceb..8d77e58 100644
--- a/js/encoding/BinaryXMLStructureDecoder.js
+++ b/js/encoding/BinaryXMLStructureDecoder.js
@@ -1,5 +1,5 @@
 /**
- * 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
@@ -28,7 +28,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
@@ -107,7 +107,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.
@@ -121,7 +121,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;
diff --git a/js/encoding/BinaryXmlWireFormat.js b/js/encoding/BinaryXmlWireFormat.js
index f294fb0..5b10cc9 100644
--- a/js/encoding/BinaryXmlWireFormat.js
+++ b/js/encoding/BinaryXmlWireFormat.js
@@ -64,37 +64,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();
 };
@@ -105,58 +105,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;
 		
@@ -173,17 +173,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;
 	
@@ -201,9 +201,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;
@@ -211,16 +211,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;
 		
diff --git a/js/encoding/EncodingUtils.js b/js/encoding/EncodingUtils.js
index 0715f27..1bc2063 100644
--- a/js/encoding/EncodingUtils.js
+++ b/js/encoding/EncodingUtils.js
@@ -29,7 +29,7 @@
 function encodeForwardingEntry(co) {
 	var enc = new BinaryXMLEncoder();
  
-	co.to_ccnb(enc);
+	co.to_ndnb(enc);
 	
 	var bytes = enc.getReducedOstream();
 
@@ -51,7 +51,7 @@
 
 	var faceInstance = new FaceInstance();
 
-	faceInstance.from_ccnb(decoder);
+	faceInstance.from_ndnb(decoder);
 
 	return faceInstance;
 	
@@ -78,7 +78,7 @@
 	
 	var forwardingEntry = new ForwardingEntry();
 
-	forwardingEntry.from_ccnb(decoder);
+	forwardingEntry.from_ndnb(decoder);
 
 	return forwardingEntry;
 	
diff --git a/js/encoding/TextXMLCodec.js b/js/encoding/TextXMLCodec.js
index 97e5f15..7a7df79 100644
--- a/js/encoding/TextXMLCodec.js
+++ b/js/encoding/TextXMLCodec.js
@@ -3,7 +3,7 @@
  * @author: Meki Cheraoui
  * See COPYING for copyright and distribution information.
  * 
- * Encodes CCN object into xml tags
+ * Encodes NDN object into xml tags
  */
 var DataUtils = require('./DataUtils').DataUtils;
 	
@@ -14,10 +14,10 @@
 
 var TextXMLCodec =  function TextXMLCodec(){
 
-	this.CCN_NAMESPACE = "http://www.parc.com/ccn"; // String
-	this.CCN_PREFIX = "ccn";	// String
+	this.NDN_NAMESPACE = "http://www.parc.com/ndn"; // String
+	this.NDN_PREFIX = "ndn";	// String
 	this.CODEC_NAME = "Text";// String
-	this.BINARY_ATTRIBUTE = "ccnbencoding";// String
+	this.BINARY_ATTRIBUTE = "ndnbencoding";// String
 	this.BINARY_ATTRIBUTE_VALUE = "base64Binary";// String
 
 
diff --git a/js/encoding/TextXMLDecoder.js b/js/encoding/TextXMLDecoder.js
index 784f217..991a4af 100644
--- a/js/encoding/TextXMLDecoder.js
+++ b/js/encoding/TextXMLDecoder.js
@@ -4,7 +4,7 @@
  * @author: Meki Cheraoui
  * See COPYING for copyright and distribution information.
  * 
- * Decodes CCN object into xml
+ * Decodes NDN object into xml
  */
 
 var TextXMLDecoder = function TextXMLDecoder(){
diff --git a/js/encoding/TextXMLEncoder.js b/js/encoding/TextXMLEncoder.js
index 1b9f5a9..b0a24f2 100644
--- a/js/encoding/TextXMLEncoder.js
+++ b/js/encoding/TextXMLEncoder.js
@@ -3,7 +3,7 @@
  * @author: Meki Cheraoui
  * See COPYING for copyright and distribution information.
  * 
- * Encodes CCN object into xml
+ * Encodes NDN object into xml
  */
 
 var Stream = require('stream').Stream;