Major update: refactored the API of all classes to make attributes start with a lower case letter and rename encode=>to_ccnb() and decode()=>from_ccnb.
(according to the API notes: http://sea.remap.ucla.edu:8080/attachments/download/23/lwndn_api-notes_21020830.txt )
diff --git a/js/KeyName.js b/js/KeyName.js
index c156af1..e958c3f 100644
--- a/js/KeyName.js
+++ b/js/KeyName.js
@@ -6,40 +6,40 @@
var KeyName = function KeyName() {
- this.ContentName = this.ContentName;//ContentName
- this.PublisherID =this.PublisherID;//PublisherID
+ this.contentName = this.contentName;//contentName
+ this.publisherID =this.publisherID;//publisherID
};
-KeyName.prototype.decode=function( decoder){
+KeyName.prototype.from_ccnb=function( decoder){
decoder.readStartElement(this.getElementLabel());
- this.ContentName = new ContentName();
- this.ContentName.decode(decoder);
+ this.contentName = new ContentName();
+ this.contentName.from_ccnb(decoder);
if(LOG>4) console.log('KEY NAME FOUND: ');
if ( PublisherID.peek(decoder) ) {
- this.PublisherID = new PublisherID();
- this.PublisherID.decode(decoder);
+ this.publisherID = new PublisherID();
+ this.publisherID.from_ccnb(decoder);
}
decoder.readEndElement();
};
-KeyName.prototype.encode = function( encoder) {
+KeyName.prototype.to_ccnb = function( encoder) {
if (!this.validate()) {
throw new Exception("Cannot encode : field values missing.");
}
encoder.writeStartElement(this.getElementLabel());
- this.ContentName.encode(encoder);
- if (null != this.PublisherID)
- this.PublisherID.encode(encoder);
+ this.contentName.to_ccnb(encoder);
+ if (null != this.publisherID)
+ this.publisherID.to_ccnb(encoder);
encoder.writeEndElement();
};
@@ -49,5 +49,5 @@
KeyName.prototype.validate = function() {
// DKS -- do we do recursive validation?
// null signedInfo ok
- return (null != this.ContentName);
+ return (null != this.contentName);
};