Changing ccn to ndn
Change-Id: Iba4ec8e48dd5345903cc3518aaf98d4d37d89ff1
diff --git a/js/Closure.js b/js/Closure.js
index 24fdedb..b60500b 100644
--- a/js/Closure.js
+++ b/js/Closure.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>
*/
diff --git a/js/ContentObject.js b/js/ContentObject.js
index 255550e..5ba6b00 100644
--- a/js/ContentObject.js
+++ b/js/ContentObject.js
@@ -89,7 +89,7 @@
ContentObject.prototype.encodeObject = function encodeObject(obj){
var enc = new BinaryXMLEncoder();
- obj.to_ccnb(enc);
+ obj.to_ndnb(enc);
var num = enc.getReducedOstream();
@@ -101,7 +101,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();
@@ -120,14 +120,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);
};
@@ -151,7 +151,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.
@@ -163,31 +163,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.");
@@ -195,21 +195,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() {
@@ -227,7 +227,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
@@ -271,7 +271,7 @@
var time = d.getTime();
- this.timestamp = new CCNTime( time );
+ this.timestamp = new NDNTime( time );
if(LOG>4)console.log('TIME msec is');
@@ -291,23 +291,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
@@ -328,26 +328,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.");
}
@@ -356,28 +356,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();
@@ -393,7 +393,7 @@
};
SignedInfo.prototype.getElementLabel = function() {
- return CCNProtocolDTags.SignedInfo;
+ return NDNProtocolDTags.SignedInfo;
};
SignedInfo.prototype.validate = function() {
diff --git a/js/FaceInstance.js b/js/FaceInstance.js
index 621e5ec..21256d8 100644
--- a/js/FaceInstance.js
+++ b/js/FaceInstance.js
@@ -25,31 +25,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;
@@ -64,31 +64,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();
}
@@ -96,7 +96,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()) {
@@ -106,38 +106,38 @@
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;
};
diff --git a/js/ForwardingEntry.js b/js/ForwardingEntry.js
index 185f784..53862e1 100644
--- a/js/ForwardingEntry.js
+++ b/js/ForwardingEntry.js
@@ -9,50 +9,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)
{
@@ -63,23 +63,23 @@
//}
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; }
diff --git a/js/Interest.js b/js/Interest.js
index dba23b2..76f6347 100644
--- a/js/Interest.js
+++ b/js/Interest.js
@@ -52,14 +52,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);
};
@@ -132,20 +132,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
@@ -155,20 +155,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();
diff --git a/js/Key.js b/js/Key.js
index 20b3e41..90a46b2 100644
--- a/js/Key.js
+++ b/js/Key.js
@@ -8,7 +8,7 @@
* @constructor
*/
var Key = function Key(){
- /* TODO: Port from PyCCN:
+ /* TODO: Port from PyNDN:
generateRSA()
privateToDER()
publicToDER()
@@ -48,13 +48,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
@@ -75,9 +75,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
@@ -102,13 +102,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
@@ -122,26 +122,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() {
@@ -158,39 +158,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?
diff --git a/js/NDN.js b/js/NDN.js
index f88f178..28c510f 100644
--- a/js/NDN.js
+++ b/js/NDN.js
@@ -40,12 +40,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.
@@ -63,7 +63,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;
@@ -267,13 +267,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);
@@ -290,10 +290,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);
@@ -303,9 +303,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;
}
@@ -318,12 +318,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);
}
@@ -332,7 +332,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);
@@ -346,8 +346,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;
@@ -367,11 +367,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);
@@ -384,11 +384,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) {
@@ -602,7 +602,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/js/Name.js b/js/Name.js
index f1937ef..d9a9976 100644
--- a/js/Name.js
+++ b/js/Name.js
@@ -86,20 +86,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");
@@ -107,13 +107,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;
};
/**
@@ -292,7 +292,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) {
@@ -326,7 +326,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) {
diff --git a/js/PublisherID.js b/js/PublisherID.js
index fb83879..a757d91 100644
--- a/js/PublisherID.js
+++ b/js/PublisherID.js
@@ -8,19 +8,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;
@@ -46,7 +46,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();
@@ -66,7 +66,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.");
}
diff --git a/js/PublisherPublicKeyDigest.js b/js/PublisherPublicKeyDigest.js
index 5f83ea8..e55fa56 100644
--- a/js/PublisherPublicKeyDigest.js
+++ b/js/PublisherPublicKeyDigest.js
@@ -19,7 +19,7 @@
};
-PublisherPublicKeyDigest.prototype.from_ccnb = function( decoder) {
+PublisherPublicKeyDigest.prototype.from_ndnb = function( decoder) {
this.publisherPublicKeyDigest = decoder.readBinaryElement(this.getElementLabel());
@@ -39,7 +39,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.");
@@ -48,7 +48,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);
diff --git a/js/WebSocketTransport.js b/js/WebSocketTransport.js
index 6365bcb..da3792b 100644
--- a/js/WebSocketTransport.js
+++ b/js/WebSocketTransport.js
@@ -64,7 +64,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();
}
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;
diff --git a/js/util/CCNProtocolDTags.js b/js/util/NDNProtocolDTags.js
similarity index 95%
rename from js/util/CCNProtocolDTags.js
rename to js/util/NDNProtocolDTags.js
index 84cd440..a2205d1 100644
--- a/js/util/CCNProtocolDTags.js
+++ b/js/util/NDNProtocolDTags.js
@@ -1,11 +1,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.
@@ -122,11 +122,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",
@@ -152,5 +152,5 @@
//TESTING
-//console.log(exports.CCNProtocolDTagsStrings[17]);
+//console.log(exports.NDNProtocolDTagsStrings[17]);
diff --git a/js/util/CCNTime.js b/js/util/NDNTime.js
similarity index 79%
rename from js/util/CCNTime.js
rename to js/util/NDNTime.js
index bb1222e..fd4720d 100644
--- a/js/util/CCNTime.js
+++ b/js/util/NDNTime.js
@@ -1,13 +1,13 @@
/**
* @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')
@@ -18,23 +18,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) {
@@ -56,7 +56,7 @@
};
//byte[]
-CCNTime.prototype.toBinaryTime = function() {
+NDNTime.prototype.toBinaryTime = function() {
return this.msec; //unsignedLongToByteArray(this.date.getTime());