Adding FaceInstance

FaceInstance object added ( used to register faces)

Publish-data.html
Request-data.html

(replacing indes.html)
diff --git a/.DS_Store b/.DS_Store
index e384a76..d2205a4 100644
--- a/.DS_Store
+++ b/.DS_Store
Binary files differ
diff --git a/js/FaceInstance.js b/js/FaceInstance.js
new file mode 100644
index 0000000..6a709fe
--- /dev/null
+++ b/js/FaceInstance.js
@@ -0,0 +1,152 @@
+
+
+
+var FaceInstance  = function FaceInstance(
+	    _Action,
+		_PublisherPublicKeyDigest,
+		_FaceID,
+		_IPProto,
+		_Host,
+		_Port,
+		_MulticastInterface,
+		_MulticastTTL,
+		_FreshnessSeconds,){
+		
+	
+	this.Action = _Action,
+	this.PublisherPublicKeyDigest = _PublisherPublicKeyDigest,
+	this.FaceID = _FaceID,
+	this.IPProto = _IPProto,
+	this.Host = _Host,
+	this.Port = _Port,
+	this.MulticastInterface =_MulticastInterface,
+	this.MulticastTTL =_MulticastTTL,
+	this.FreshnessSeconds = _FreshnessSeconds,
+	
+	
+	//Action           ::= ("newface" | "destroyface" | "queryface")
+	//PublisherPublicKeyDigest ::= SHA-256 digest
+	//FaceID           ::= nonNegativeInteger
+	//IPProto          ::= nonNegativeInteger [IANA protocol number, 6=TCP, 17=UDP]
+	//Host             ::= textual representation of numeric IPv4 or IPv6 address
+	//Port             ::= nonNegativeInteger [1..65535]
+	//MulticastInterface ::= textual representation of numeric IPv4 or IPv6 address
+	//MulticastTTL     ::= nonNegativeInteger [1..255]
+	//FreshnessSeconds ::= nonNegativeInteger
+
+};
+
+/**
+ * Used by NetworkObject to decode the object from a network stream.
+ * @see org.ccnx.ccn.impl.encoding.XMLEncodable
+ */
+FaceInstance.prototype.decode(//XMLDecoder 
+	decoder) {
+
+	decoder.readStartElement(this.getElementLabel());
+	
+	if (decoder.peekStartElement(CCNProtocolDTags.Action)) {
+		
+		this.Action = decoder.readUTF8Element(CCNProtocolDTags.Action);
+		
+	}
+	if (decoder.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)) {
+		
+		this.PublisherPublicKeyDigest = new PublisherPublicKeyDigest();
+		this.PublisherPublicKeyDigest.decode(decoder);
+		
+	}
+	if (decoder.peekStartElement(CCNProtocolDTags.FaceID)) {
+		
+		this.FaceID = decoder.readIntegerElement(CCNProtocolDTags.FaceID);
+		
+	}
+	if (decoder.peekStartElement(CCNProtocolDTags.IPProto)) {
+		
+		//int
+		var pI = decoder.readIntegerElement(CCNProtocolDTags.IPProto);
+		
+		this.IPProto = null;
+		
+		if (NetworkProtocol.TCP.value().intValue() == pI) {
+			
+			this.IPProto = NetworkProtocol.TCP;
+			
+		} else if (NetworkProtocol.UDP.value().intValue() == pI) {
+			
+			this.IPProto = NetworkProtocol.UDP;
+			
+		} else {
+			
+			throw new Exception("FaceInstance.decoder.  Invalid " + 
+					CCNProtocolDTags.tagToString(CCNProtocolDTags.IPProto) + " field: " + pI);
+			
+		}
+	}
+	
+	if (decoder.peekStartElement(CCNProtocolDTags.Host)) {
+		
+		this.Host = decoder.readUTF8Element(CCNProtocolDTags.Host);
+		
+	}
+	
+	if (decoder.peekStartElement(CCNProtocolDTags.Port)) {
+		this.Port = decoder.readIntegerElement(CCNProtocolDTags.Port); 
+	}
+	
+	if (decoder.peekStartElement(CCNProtocolDTags.MulticastInterface)) {
+		this.MulticastInterface = decoder.readUTF8Element(CCNProtocolDTags.MulticastInterface); 
+	}
+	
+	if (decoder.peekStartElement(CCNProtocolDTags.MulticastTTL)) {
+		this.MulticastTTL = decoder.readIntegerElement(CCNProtocolDTags.MulticastTTL); 
+	}
+	
+	if (decoder.peekStartElement(CCNProtocolDTags.FreshnessSeconds)) {
+		this.FreshnessSeconds = decoder.readIntegerElement(CCNProtocolDTags.FreshnessSeconds); 
+	}
+	
+	decoder.readEndElement();
+}
+
+/**
+ * Used by NetworkObject to encode the object to a network stream.
+ * @see org.ccnx.ccn.impl.encoding.XMLEncodable
+ */
+public void encode(XMLEncoder encoder) throws ContentEncodingException {
+	if (!validate()) {
+		throw new ContentEncodingException("Cannot encode " + this.getClass().getName() + ": field values missing.");
+	}
+	encoder.writeStartElement(getElementLabel());
+	if (null != _action && _action.length() != 0)
+		encoder.writeElement(CCNProtocolDTags.Action, _action);	
+	if (null != _ccndID) {
+		_ccndID.encode(encoder);
+	}
+	if (null != _faceID) {
+		encoder.writeElement(CCNProtocolDTags.FaceID, _faceID);
+	}
+	if (null != _ipProto) {
+		encoder.writeElement(CCNProtocolDTags.IPProto, _ipProto.value());
+	}
+	if (null != _host && _host.length() != 0) {
+		encoder.writeElement(CCNProtocolDTags.Host, _host);	
+	}
+	if (null != _port) {
+		encoder.writeElement(CCNProtocolDTags.Port, _port);
+	}
+	if (null != _multicastInterface && _multicastInterface.length() != 0) {
+		encoder.writeElement(CCNProtocolDTags.MulticastInterface, _multicastInterface);
+	}
+	if (null != _multicastTTL) {
+		encoder.writeElement(CCNProtocolDTags.MulticastTTL, _multicastTTL);
+	}
+	if (null != _lifetime) {
+		encoder.writeElement(CCNProtocolDTags.FreshnessSeconds, _lifetime);
+	}
+	encoder.writeEndElement();   			
+}
+
+
+FaceInstance.prototype.getElementLabel= function(){return CCNProtocolDTags.FaceInstance;};
+
diff --git a/js/index.html b/js/publish-data.html
similarity index 81%
copy from js/index.html
copy to js/publish-data.html
index 04e402e..84fb9ac 100644
--- a/js/index.html
+++ b/js/publish-data.html
@@ -51,18 +51,24 @@
 

 			var ContentName = document.getElementById('contentname').value;

 		

+			var Content = document.getElementById('content').value;

+			

+			

+			

 			///////////////////////////////////////

 		    //createRoute('localhost', 9695);

 

-		    createRoute('131.179.141.15', 9695);

+		    //createRoute('131.179.141.15', 9695);

 		    //createRoute('borges.metwi.ucla.edu', 9695);

 		    

 			//content object

-			var co = queryPrefix( ContentName );

+			//var co = queryPrefix( ContentName );

+			

+			

 			

 			///////////////////////////////////////

 			

-			var output ="";

+			/*var output ="";

 			

 			if(co==-1)

 				output+= "NO CONTENT FOUND"

@@ -106,9 +112,11 @@
 					output+= "<br />";

 	

 				}

-			}

+			}*/

 			

-			document.getElementById('result').innerHTML = output;

+			//document.getElementById('result').innerHTML = output;

+			document.getElementById('result').innerHTML = 'Content \'' + Content + '\' was published with content name \'' + ContentName +'\'';

+

 		}

 	

 		</script>

@@ -116,9 +124,19 @@
 </head>

 <body >

 	<form>

-		Please Enter a Content Name:<br /><input id="contentname" type="text" name="CONTENTNAME" value="/PARC/abc" /> <br />

+

+		Please Enter a Content Name:<br />

+		

+		<input id="contentname" type="text" name="CONTENTNAME" value="/PARC/abc" /> 

+		

+		Please Enter the Content:<br />

+		

+		<textarea id="content" cols="40" rows="5" name="CONTENT" value="SUCCESS"  >SUCCESS!</textarea> 

+		

+		

+		<br />

 	</form>

-	<button onclick="run()">Run!</button>

+	<button onclick="run()">Publish</button>

 	<div >

 		<applet id="JavaSocketBridge" archive="JavaSocketBridge.jar" code="JavaSocketBridge.class" width="0" height="0">

 		</applet>

diff --git a/js/index.html b/js/request-data.html
similarity index 98%
rename from js/index.html
rename to js/request-data.html
index 04e402e..f00510a 100644
--- a/js/index.html
+++ b/js/request-data.html
@@ -118,7 +118,7 @@
 	<form>

 		Please Enter a Content Name:<br /><input id="contentname" type="text" name="CONTENTNAME" value="/PARC/abc" /> <br />

 	</form>

-	<button onclick="run()">Run!</button>

+	<button onclick="run()">Request Data!</button>

 	<div >

 		<applet id="JavaSocketBridge" archive="JavaSocketBridge.jar" code="JavaSocketBridge.class" width="0" height="0">

 		</applet>