Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 1 | <?xml version = "1.0" encoding="utf-8" ?>
|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
| 3 | "DTD/xhtml1-strict.dtd">
|
| 4 | <html xmlns = "http://www.w3.org/1999/xhtml">
|
| 5 |
|
| 6 | <head>
|
| 7 | <title>NDN Send Hex</title>
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 8 | <script type="text/javascript" src="../java_socket_bridge.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 9 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 10 | <script type="text/javascript" src="../CCNProtocolDTags.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 11 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 12 | <script type="text/javascript" src="../CCNTime.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 13 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 14 | <script type="text/javascript" src="../ContentName.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 15 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 16 | <script type="text/javascript" src="../ContentObject.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 17 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 18 | <script type="text/javascript" src="../DateFormat.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 19 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 20 | <script type="text/javascript" src="../Exclude.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 21 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 22 | <script type="text/javascript" src="../ExcludeAny.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 23 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 24 | <script type="text/javascript" src="../ExcludeComponent.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 25 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 26 | <script type="text/javascript" src="../Interest.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 27 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 28 | <script type="text/javascript" src="../KeyLocator.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 29 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 30 | <script type="text/javascript" src="../KeyName.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 31 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 32 | <script type="text/javascript" src="../PublisherID.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 33 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 34 | <script type="text/javascript" src="../Signature.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 35 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 36 | <script type="text/javascript" src="../SignedInfo.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 37 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 38 | <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 39 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 40 | <script type="text/javascript" src="../FaceInstance.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 41 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 42 | <script type="text/javascript" src="../ForwardingEntry.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 43 |
|
| 44 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 45 | <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 46 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 47 | <script type="text/javascript" src="../encoding/BinaryXMLCodec.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 48 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 49 | <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 50 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 51 | <script type="text/javascript" src="../encoding/DataUtils.js"></script>
|
jeff | 9a9fff2 | 2012-09-23 15:45:22 -0700 | [diff] [blame] | 52 |
|
| 53 | <script type="text/javascript" src="../encoding/EncodingUtils.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 54 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 55 | <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 56 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 57 | <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script>
|
| 58 | <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script>
|
| 59 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script>
|
| 60 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 61 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 62 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script>
|
| 63 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script>
|
| 64 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script>
|
| 65 | <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script>
|
| 66 | <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script>
|
| 67 | <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 68 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 69 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsapem-1.1.js"></script>
|
| 70 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script>
|
| 71 | <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script>
|
| 72 | <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 73 |
|
| 74 | <script type="text/javascript">
|
| 75 | function run(){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 76 | //var n = a.replace("%","");
|
| 77 |
|
| 78 | //console.log(n);
|
| 79 |
|
| 80 | var hex = document.getElementById('contentname').value;
|
| 81 |
|
| 82 | ///////////////////////////////////////
|
| 83 | //createRoute(, 9695);
|
| 84 |
|
| 85 |
|
| 86 | /// /ndn/ucla.edu/apps/hydra/mainvideo
|
| 87 | //createRoute('131.179.141.15', 9695);
|
| 88 | //createRoute('borges.metwi.ucla.edu', 9695);
|
| 89 |
|
| 90 | //content object
|
| 91 | //var co = queryPrefix( ContentName );
|
| 92 | console.log('HEX IS');
|
| 93 | console.log(hex);
|
| 94 |
|
jeff | 9a9fff2 | 2012-09-23 15:45:22 -0700 | [diff] [blame] | 95 | var result = get('127.0.0.1', 9695, hex);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 96 |
|
| 97 | console.log('BINARY RESPONSE IS ' +result);
|
| 98 |
|
| 99 | var output ="";
|
| 100 | output += "HEX ANSWER IS: "+ result;
|
| 101 |
|
| 102 | output+= "<br />";
|
| 103 | output+= "<br />";
|
| 104 |
|
| 105 | //result[0] and result[1] should be 0 and 4 if there is a content object found
|
| 106 | if(result==null || result==undefined || result =="" ){
|
| 107 |
|
| 108 |
|
| 109 | if(LOG>2)console.log('INVALID ANSWER');
|
| 110 | output += "NO CONTENT FOUND";
|
| 111 |
|
| 112 | output+= "<br />";
|
| 113 | output+= "<br />";
|
| 114 | }
|
| 115 |
|
| 116 | else if(result[0] != '0'||result[1]!='4') {
|
| 117 | if(LOG>2)console.log('INVALID ANSWER');
|
| 118 | output += "INVALID ANSWER";
|
| 119 |
|
| 120 | output+= "<br />";
|
| 121 | output+= "<br />";
|
| 122 | }
|
| 123 | else{
|
| 124 |
|
| 125 | var numbers = DataUtils.toNumbers(result);
|
| 126 |
|
| 127 | console.log('HEX RESPONSE IS \n'+numbers);
|
| 128 | decoder = new BinaryXMLDecoder(numbers);
|
| 129 |
|
| 130 |
|
| 131 | co = new ContentObject();
|
| 132 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 133 | co.from_ccnb(decoder);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 134 |
|
| 135 | if(LOG>2) console.log(co);
|
| 136 |
|
jeff | 9a9fff2 | 2012-09-23 15:45:22 -0700 | [diff] [blame] | 137 | output += contentObjectToHtml(co);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 138 | }
|
| 139 | document.getElementById('result').innerHTML = output;
|
| 140 | }
|
| 141 |
|
| 142 | </script>
|
| 143 |
|
| 144 | </head>
|
| 145 | <body >
|
| 146 | <form>
|
jeff | 9a9fff2 | 2012-09-23 15:45:22 -0700 | [diff] [blame] | 147 | Please Enter a Hex Encoded Interest:<br /><input id="contentname" type="text" name="CONTENTNAME" value="01d2f20002d28e310000" /> <br />
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 148 | </form>
|
| 149 | <button onclick="run()">Request Data!</button>
|
| 150 | <div >
|
Jeff Thompson | 6743969 | 2012-08-26 12:15:08 -0700 | [diff] [blame] | 151 | <applet id="JavaSocketBridge" archive="../JavaSocketBridge.jar" code="JavaSocketBridge.class" width="0" height="0">
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 152 | </applet>
|
| 153 | </div>
|
| 154 |
|
| 155 | <p id="result"></p>
|
| 156 |
|
| 157 | </body>
|
jeff | 9a9fff2 | 2012-09-23 15:45:22 -0700 | [diff] [blame] | 158 | </html>
|