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/ContentObject.js b/js/ContentObject.js
index 5ac4d28..eb5db79 100644
--- a/js/ContentObject.js
+++ b/js/ContentObject.js
@@ -12,9 +12,9 @@
//TODO Check the class of _name
this.name = _name;
}
- this.SignedInfo = _signedInfo;
+ this.signedInfo = _signedInfo;
this.content=_content;
- this.Signature = _signature;
+ this.signature = _signature;
this.startSIG = null;
@@ -29,7 +29,7 @@
ContentObject.prototype.sign = function(){
var n1 = this.encodeObject(this.name);
- var n2 = this.encodeObject(this.SignedInfo);
+ var n2 = this.encodeObject(this.signedInfo);
var n3 = this.encodeContent();
var n = n1.concat(n2,n3);
@@ -58,7 +58,7 @@
if(LOG>2)console.log( DataUtils.toNumbers(hSig.trim()));
- this.Signature.Signature = DataUtils.toNumbers(hSig.trim());
+ this.signature.signature = DataUtils.toNumbers(hSig.trim());
};
@@ -66,7 +66,7 @@
ContentObject.prototype.encodeObject = function encodeObject(obj){
var enc = new BinaryXMLEncoder();
- obj.encode(enc);
+ obj.to_ccnb(enc);
var num = enc.getReducedOstream();
@@ -102,8 +102,8 @@
if( decoder.peekStartElement(CCNProtocolDTags.Signature) ){
- this.Signature = new Signature();
- this.Signature.decode(decoder);
+ this.signature = new Signature();
+ this.signature.from_ccnb(decoder);
}
//this.endSIG = decoder.offset;
@@ -111,14 +111,14 @@
this.startSIG = decoder.offset;
this.name = new ContentName();
- this.name.decode(decoder);
+ this.name.from_ccnb(decoder);
//this.startSignedInfo = decoder.offset;
if( decoder.peekStartElement(CCNProtocolDTags.SignedInfo) ){
- this.SignedInfo = new SignedInfo();
- this.SignedInfo.decode(decoder);
+ this.signedInfo = new SignedInfo();
+ this.signedInfo.from_ccnb(decoder);
}
this.content = decoder.readBinaryElement(CCNProtocolDTags.Content);
@@ -143,19 +143,19 @@
- if(null!=this.Signature) this.Signature.encode(encoder);
+ if(null!=this.signature) this.signature.to_ccnb(encoder);
this.startSIG = encoder.offset;
- if(null!=this.name) this.name.encode(encoder);
+ if(null!=this.name) this.name.to_ccnb(encoder);
//this.endSIG = encoder.offset;
//this.startSignedInfo = encoder.offset;
- if(null!=this.SignedInfo) this.SignedInfo.encode(encoder);
+ if(null!=this.signedInfo) this.signedInfo.to_ccnb(encoder);
encoder.writeElement(CCNProtocolDTags.Content, this.content);