/*
 * @author: ucla-cs
 * See COPYING for copyright and distribution information.
 * This file provides access to the JavaSocketBridge applet.
 */


//var ccnxnodename = unescape('%E0%A0%1E%099h%F9t%0C%E7%F46%1B%AB%F5%BB%05%A4%E5Z%AC%A5%E5%8Fs%ED%DE%B8%E0%13%AA%8F');


var LOG = 0;


var java_socket_bridge_ready_flag = false;

var ndnport =null;
var ndnurl=null;

var registeredPrefixes ={};

/**
 * Add a trim funnction for Strings
 */
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g, "");
};


// Applet reports it is ready to use
function java_socket_bridge_ready(){
	console.log('APPLET LOADED');
	java_socket_bridge_ready_flag = true;
	
}

// Send Test Interest
function get(host,port,data){
	if(java_socket_bridge_ready_flag){
		return get_java_socket_bridge().get(host,port,data,1000);
	}
	else{
		on_socket_error("Java Socket Bridge send Interest until the applet has loaded");
	}
}


// Send Test Interest
function put(host,port,data,name,toReturn){
	
	if(java_socket_bridge_ready_flag){ 
		return get_java_socket_bridge().put(host,port,data,name,toReturn);
	}
	else{
		on_socket_error("Java Socket Bridge send Interest until the applet has loaded");
	}
}

function on_socket_received_interest(hex,name){
	
	if(LOG>3)console.log('received interest from host'+ host +':'+port+' with name '+name);
	
	if(LOG>3)console.log('DATA ');
	
	if(LOG>3)console.log(hex);
	
	interest = decodeHexInterest(hex);
	
	console.log('SUCCESSFULLY PARSED INTEREST');
	
	console.log('CREATING ANSWER');
	var si = new SignedInfo();
	si.setFields();
	
	var answer = toNumbersFromString('WORLD');

	var co = new ContentObject(new Name(name),si,answer,new Signature()); 
	co.sign();
	
	
	var outputHex = encodeToHexContentObject(co);
	
	console.log('SENDING ANSWER');

	return get_java_socket_bridge().putAnswer(outputHex,name);
}

// Get something from the socket
function on_socket_get(message){}

// Report an error
function on_socket_error(message){
	alert('Received error message \n' +message);
}

// Get the applet object
function get_java_socket_bridge(){
	return document.getElementById('JavaSocketBridge');
}