Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 1 | /*
|
| 2 | * @author: ucla-cs
|
| 3 | * This class represents Interest Objects
|
| 4 | */
|
| 5 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 6 | //var ccndAddr = 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);
|
| 7 | var ccndAddrHex = '%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';
|
| 8 |
|
| 9 | var LOG = 5;
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 10 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 11 | // Global variables
|
| 12 | var java_socket_bridge_ready_flag = false;
|
| 13 |
|
| 14 | var ndnport =null;
|
| 15 | var ndnurl=null;
|
| 16 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 17 | var registeredPrefixes ={};
|
| 18 |
|
| 19 | String.prototype.trim = function() {
|
| 20 | return this.replace(/^\s+|\s+$/g, "");
|
| 21 | };
|
| 22 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 23 | // Applet reports it is ready to use
|
| 24 | function java_socket_bridge_ready(){
|
| 25 | java_socket_bridge_ready_flag = true;
|
| 26 | }
|
| 27 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 28 |
|
| 29 |
|
| 30 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 31 | //Sets the route to ccnx router
|
Axel Colin de Verdiere | e2991cd | 2012-05-18 16:49:27 -0700 | [diff] [blame] | 32 | /**
|
| 33 | * Setup the router to use
|
| 34 | * @url the url of the remote NDN router
|
| 35 | * @port the port of the remote NDN router
|
| 36 | */
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 37 | function createRoute(url, port){
|
| 38 | ndnport = port;
|
| 39 | ndnurl=url;
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 40 |
|
| 41 | console.log(new BinaryXMLDecoder());
|
| 42 |
|
| 43 | //SEND INTERST TO CCNX NODE
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 44 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 45 |
|
| 46 | //Now Start the receiving thread
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 47 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 48 | }
|
| 49 |
|
| 50 | // Connect to a given url and port
|
| 51 | //Error -1 No countent found
|
| 52 | //Error -2 Empty query
|
| 53 | function queryPrefix(message){
|
| 54 | if(ndnport!=null && ndnurl!=null){
|
| 55 | var newMessage ='';
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 56 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 57 |
|
| 58 | message = message.trim();
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 | if(message==null || message =="" || message=="/"){
|
| 63 | return -2;
|
| 64 | }
|
| 65 |
|
| 66 | //message = decodeURIComponent(message);
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 67 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 68 | var array = createNameArray(message);
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 69 |
|
| 70 | //console.log('ARRAY IS '+ array);
|
| 71 |
|
| 72 | enc = new BinaryXMLEncoder();
|
| 73 |
|
| 74 | int = new Interest(new ContentName(array));
|
| 75 |
|
| 76 | int.encode(enc);
|
| 77 |
|
| 78 | var hex = toHex(enc.getReducedOstream());
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 | //console.log('Connecting and start '+ ndnurl +':'+ndnport+'-'+message);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 83 |
|
| 84 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 85 | var result = get_java_socket_bridge().connectAndStart(ndnurl,ndnport,hex);
|
| 86 |
|
| 87 | console.log('BINARY RESPONSE IS ' +result);
|
| 88 |
|
| 89 |
|
| 90 | //result[0] and result[1] should be 0 and 4 if there is a content object found
|
| 91 | if(result==null || result==undefined || result =="" || result[0] != '0'||result[1]!='4'){
|
| 92 | return -1;
|
| 93 | }
|
| 94 |
|
| 95 | else{
|
| 96 |
|
| 97 | var numbers = toNumbers(result);
|
| 98 |
|
| 99 | console.log('HEX RESPONSE IS \n'+numbers);
|
| 100 | decoder = new BinaryXMLDecoder(numbers);
|
| 101 |
|
| 102 |
|
| 103 | co = new ContentObject();
|
| 104 |
|
| 105 | co.decode(decoder);
|
| 106 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 107 | if(LOG>2) console.log(co);
|
| 108 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 109 | return co;
|
| 110 |
|
| 111 |
|
| 112 | }
|
| 113 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 114 |
|
| 115 | }
|
| 116 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 117 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 118 | else{
|
| 119 |
|
| 120 | alert('ERROR URL OR PORT NOT SET');
|
| 121 |
|
| 122 | return -3;
|
| 123 |
|
| 124 | }
|
| 125 |
|
| 126 | }
|
| 127 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 128 | var registerStarted = false;
|
| 129 | function registerPrefix(name, content){
|
| 130 |
|
| 131 | registeredPrefixes[name] = content ;
|
| 132 |
|
| 133 | if(registerStarted == false){
|
| 134 | var result = get_java_socket_bridge().connectAndStartAndPublish();
|
| 135 |
|
| 136 | startRegisterPrefix();
|
| 137 |
|
| 138 | registerStarted = true;
|
| 139 | }
|
| 140 | sendForwardingEntry(10);
|
| 141 | }
|
| 142 |
|
| 143 |
|
| 144 | function unRegisterPrefix(name){
|
| 145 |
|
| 146 | delete registeredPrefixes[name];
|
| 147 |
|
| 148 | }
|
| 149 |
|
| 150 |
|
| 151 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 152 |
|
| 153 | function on_socket_received_interest(IP, port, interestBinary){
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 154 | console.log('WOOOO RECEIVED STUFF' );
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 155 | var interest = decodeHexInterest(interestBinary);
|
| 156 |
|
| 157 | console.log('WOOO received interest' + interest.Name.Components);
|
| 158 |
|
| 159 | var stringName = "";
|
| 160 |
|
| 161 | for(var i=0;i<interest.Name.Components.length;i++){
|
| 162 | stringName += "/"+ interest.Name.Components[i];
|
| 163 | }
|
| 164 |
|
| 165 | if(registeredPrefix[stringName]!=null){
|
| 166 | if(LOG>1)console.log("CANNOT FIND THE OBJECT OF NAME " + stringName );
|
| 167 | }
|
| 168 | else{
|
| 169 | var co = new ContentObject(interest.Name, null,registeredPrefix[stringName],null );
|
| 170 |
|
| 171 | var hex = encodeToHexContentObject(co);
|
| 172 |
|
| 173 | get_java_socket_bridge().sendContentObject(IP,port,hex);
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 174 |
|
| 175 |
|
| 176 | }
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 177 | }
|
| 178 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 179 |
|
| 180 |
|
| 181 |
|
| 182 | // Connect to a given url and port
|
| 183 | //Error -1 No countent found
|
| 184 | //Error -2 Empty query
|
| 185 | function startRegisterPrefix(){
|
| 186 | if(LOG>2) console.log('START REGISTER PREFIX');
|
| 187 |
|
| 188 | if(ndnport!=null && ndnurl!=null){
|
| 189 | var newMessage ='';
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 | name = name.trim();
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 | ///////////////////////
|
| 198 | var face = new FaceInstance('newface',null,null, 17, '127.0.0.1',9876,null,null,null);
|
| 199 |
|
| 200 | var encoder1 = new BinaryXMLEncoder();
|
| 201 |
|
| 202 | face.encode(encoder1);
|
| 203 |
|
| 204 | var faceInstanceBinary = encoder1.getReducedOstream();
|
| 205 |
|
| 206 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 207 | var si = new SignedInfo();
|
| 208 | si.setFields();
|
| 209 |
|
| 210 | var co = new ContentObject(new ContentName(),si,faceInstanceBinary,new Signature());
|
| 211 | co.sign();
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 212 |
|
| 213 | var encoder2 = new BinaryXMLEncoder();
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 214 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 215 | co.encode(encoder2);
|
| 216 |
|
| 217 | var coBinary = encoder2.getReducedOstream();
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 218 |
|
| 219 | //if(LOG>3)console.log('ADDESS OF CCND IS'+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'));
|
| 220 |
|
| 221 | //var interestName = new ContentName(['ccnx',co.SignedInfo.Publisher.PublisherPublicKeyDigest,'newface',coBinary]);
|
| 222 | var interestName = new ContentName(['ccnx',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'),'newface',coBinary]);
|
| 223 | //var interestName = new ContentName(['ccnx','%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','newface',coBinary]);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 224 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 225 | //var interestName = new ContentName(['ccnx','1234','newface',coBinary]);
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 226 | //var interestName = new ContentName(['ccnx',co.SignedInfo.Publisher.PublisherPublicKeyDigest,'newface',coBinary]);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 227 | int = new Interest(interestName,face);
|
| 228 |
|
| 229 | var hex = encodeToHexInterest(int);
|
| 230 | /////////////////
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 231 |
|
| 232 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 233 |
|
| 234 | if(LOG>4)console.log('Interst name of Conntection Message is '+ interestName);
|
| 235 |
|
| 236 |
|
| 237 | if(LOG>4) console.log('Connecting and start '+ ndnurl +':'+ndnport+'-'+hex);
|
| 238 | //console.log('Connecting and start '+ ndnurl +':'+ndnport+'-'+message);
|
| 239 |
|
| 240 | var result = get_java_socket_bridge().connectAndStart(ndnurl,ndnport,hex);
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 241 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 242 |
|
| 243 | //TODO MOVE THIS
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 244 |
|
| 245 | //result[0] and result[1] should be 0 and 4 if there is a content object found
|
| 246 | if(result==null || result==undefined || result =="" || result[0] != '0'||result[1]!='4'){
|
| 247 | return -1;
|
| 248 | }
|
| 249 |
|
| 250 | if(LOG>4) console.log('RECEIVED THE FOLLOWING DATA: ' +co.Content);
|
| 251 |
|
| 252 | else{
|
| 253 |
|
| 254 | co = decodeHexContentObject(result);
|
| 255 |
|
| 256 | if(LOG>4) console.log('RECEIVED THE FOLLOWING DATA: ' +co.Content);
|
| 257 |
|
| 258 | return co;
|
| 259 | }
|
| 260 | }
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 261 | else{
|
| 262 |
|
| 263 | alert('ERROR URL OR PORT NOT SET');
|
| 264 |
|
| 265 | return -3;
|
| 266 |
|
| 267 | }
|
| 268 |
|
| 269 | }
|
| 270 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 271 |
|
| 272 | // Connect to a given url and port
|
| 273 | //Error -1 No countent found
|
| 274 | //Error -2 Empty query
|
| 275 | function sendForwardingEntry(faceID){
|
| 276 | if(LOG>2) console.log('START REGISTER PREFIX');
|
| 277 |
|
| 278 | if(ndnport!=null && ndnurl!=null){
|
| 279 | var newMessage ='';
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 | name = name.trim();
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 | ///////////////////////
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 288 | var face = new ForwardingEntry('prefixreg',new ContentName(['helloworld']),null, faceID, 1,null);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 289 |
|
| 290 | var encoder1 = new BinaryXMLEncoder();
|
| 291 |
|
| 292 | face.encode(encoder1);
|
| 293 |
|
| 294 | var faceInstanceBinary = encoder1.getReducedOstream();
|
| 295 |
|
| 296 |
|
| 297 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 298 | var si = new SignedInfo();
|
| 299 | si.setFields();
|
| 300 |
|
| 301 | var co = new ContentObject(new ContentName(),si,faceInstanceBinary,new Signature());
|
| 302 | co.sign();
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 303 |
|
| 304 | var encoder2 = new BinaryXMLEncoder();
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 305 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 306 | co.encode(encoder2);
|
| 307 |
|
| 308 | var coBinary = encoder2.getReducedOstream();
|
| 309 |
|
| 310 |
|
| 311 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 312 | var interestName = new ContentName(['ccnx',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'),'prefixreg',coBinary]);
|
| 313 | //var interestName = new ContentName(['ccnx',co.SignedInfo.Publisher.PublisherPublicKeyDigest,'newface',coBinary]);
|
| 314 | //var interestName = new ContentName(['ccnx','%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','newface',coBinary]);
|
| 315 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 316 | //var interestName = new ContentName(['ccnx','1234','newface',coBinary]);
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 317 | //var interestName = new ContentName(['ccnx',co.SignedInfo.Publisher.PublisherPublicKeyDigest,'prefixreg',coBinary]);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 318 |
|
| 319 | int = new Interest(interestName,face);
|
| 320 |
|
| 321 | var hex = encodeToHexInterest(int);
|
| 322 | /////////////////
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 | if(LOG>4)console.log('Interst name of Conntection Message is '+ interestName);
|
| 327 |
|
| 328 |
|
| 329 | if(LOG>4) console.log('Connecting and start '+ ndnurl +':'+ndnport+'-'+hex);
|
| 330 | //console.log('Connecting and start '+ ndnurl +':'+ndnport+'-'+message);
|
| 331 |
|
| 332 | var result = get_java_socket_bridge().connectAndStart(ndnurl,ndnport,hex);
|
| 333 |
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 334 | if(LOG>3)console.log('BINARY RESPONSE IS ' +result);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 335 |
|
| 336 |
|
| 337 | //result[0] and result[1] should be 0 and 4 if there is a content object found
|
| 338 | if(result==null || result==undefined || result =="" || result[0] != '0'||result[1]!='4'){
|
| 339 | return -1;
|
| 340 | }
|
| 341 |
|
| 342 | if(LOG>4) console.log('RECEIVED THE FOLLOWING DATA: ' +co.Content);
|
| 343 |
|
| 344 | else{
|
| 345 |
|
| 346 | co = decodeHexContentObject(result);
|
| 347 |
|
| 348 | if(LOG>4) console.log('RECEIVED THE FOLLOWING DATA: ' +co.Content);
|
| 349 |
|
| 350 | return co;
|
| 351 | }
|
| 352 | }
|
| 353 | else{
|
| 354 |
|
| 355 | alert('ERROR URL OR PORT NOT SET');
|
| 356 |
|
| 357 | return -3;
|
| 358 |
|
| 359 | }
|
| 360 |
|
| 361 | }
|
| 362 |
|
| 363 |
|
| 364 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 365 |
|
| 366 | function encodeToHexInterest(int){
|
| 367 |
|
| 368 | var enc = new BinaryXMLEncoder();
|
| 369 |
|
| 370 | int.encode(enc);
|
| 371 |
|
| 372 | var hex = toHex(enc.getReducedOstream());
|
| 373 |
|
| 374 | return hex;
|
| 375 |
|
| 376 |
|
| 377 | }
|
| 378 |
|
| 379 |
|
| 380 | function encodeToHexContentObject(co){
|
| 381 | var enc = new BinaryXMLEncoder();
|
| 382 |
|
| 383 | co.encode(enc);
|
| 384 |
|
| 385 | var hex = toHex(enc.getReducedOstream());
|
| 386 |
|
| 387 | return hex;
|
| 388 |
|
| 389 |
|
| 390 | }
|
| 391 |
|
| 392 | function decodeHexInterest(result){
|
| 393 | var numbers = toNumbers(result);
|
| 394 |
|
| 395 |
|
| 396 | decoder = new BinaryXMLDecoder(numbers);
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 397 | if(LOG>3)console.log('DECODED HEX INTERST \n'+numbers);
|
| 398 |
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 399 | i = new Interest();
|
| 400 |
|
| 401 | i.decode(decoder);
|
| 402 |
|
| 403 | return i;
|
| 404 |
|
| 405 | }
|
| 406 |
|
| 407 | function decodeHexContentObject(result){
|
| 408 | var numbers = toNumbers(result);
|
| 409 |
|
| 410 | decoder = new BinaryXMLDecoder(numbers);
|
Meki Cherkaoui | f3d8f69 | 2012-05-18 15:44:28 -0700 | [diff] [blame] | 411 | if(LOG>3)console.log('DECODED HEX CONTENT OBJECT \n'+numbers);
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 412 |
|
| 413 | co = new ContentObject();
|
| 414 |
|
| 415 | co.decode(decoder);
|
| 416 |
|
| 417 | return co;
|
| 418 |
|
| 419 | }
|
| 420 |
|
| 421 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 422 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 423 |
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 424 | // Get something from the socket
|
| 425 | function on_socket_get(message){}
|
| 426 |
|
| 427 | // Report an error
|
| 428 | function on_socket_error(message){
|
Meki Cherkaoui | abb973b | 2012-05-09 14:25:57 -0700 | [diff] [blame] | 429 | alert('Received error message \n' +message);
|
Meki Cherkaoui | f441d3a | 2012-04-22 15:17:52 -0700 | [diff] [blame] | 430 | }
|
| 431 |
|
| 432 | // Get the applet object
|
| 433 | function get_java_socket_bridge(){
|
| 434 | return document.getElementById('JavaSocketBridge');
|
| 435 | } |