Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -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>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 7 | <title>NDN Encocde/Decode Interest</title>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 8 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 9 | <script type="text/javascript" src="../java_socket_bridge.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 10 |
|
Jeff Thompson | c316472 | 2012-09-30 18:35:02 -0700 | [diff] [blame^] | 11 | <script type="text/javascript" src="../util/CCNProtocolDTags.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 12 |
|
Jeff Thompson | c316472 | 2012-09-30 18:35:02 -0700 | [diff] [blame^] | 13 | <script type="text/javascript" src="../util/CCNTime.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 14 |
|
Jeff Thompson | f3bd359 | 2012-09-29 23:25:30 -0700 | [diff] [blame] | 15 | <script type="text/javascript" src="../Name.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 16 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 17 | <script type="text/javascript" src="../ContentObject.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 18 |
|
Jeff Thompson | c316472 | 2012-09-30 18:35:02 -0700 | [diff] [blame^] | 19 | <script type="text/javascript" src="../encoding/DateFormat.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 20 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 21 | <script type="text/javascript" src="../Interest.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 22 |
|
Jeff Thompson | c316472 | 2012-09-30 18:35:02 -0700 | [diff] [blame^] | 23 | <script type="text/javascript" src="../Key.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 24 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 25 | <script type="text/javascript" src="../PublisherID.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 26 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 27 | <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 28 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 29 | <script type="text/javascript" src="../FaceInstance.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 30 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 31 | <script type="text/javascript" src="../ForwardingEntry.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 32 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 33 | <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 34 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 35 | <script type="text/javascript" src="../encoding/BinaryXMLCodec.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 36 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 37 | <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 38 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 39 | <script type="text/javascript" src="../encoding/DataUtils.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 40 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 41 | <script type="text/javascript" src="../encoding/EncodingUtils.js"></script>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 42 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 43 | <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 44 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 45 | <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script>
|
| 46 | <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script>
|
| 47 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script>
|
| 48 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 49 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 50 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script>
|
| 51 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script>
|
| 52 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script>
|
| 53 | <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script>
|
| 54 | <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script>
|
| 55 | <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -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/rsapem-1.1.js"></script>
|
| 58 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script>
|
| 59 | <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script>
|
| 60 | <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script>
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 61 |
|
| 62 | <script type="text/javascript">
|
| 63 |
|
| 64 | function encode(){
|
Jeff Thompson | f3bd359 | 2012-09-29 23:25:30 -0700 | [diff] [blame] | 65 | var interest = new Interest( new Name(document.getElementById('interest').value ) );
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 66 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 67 | interest.scope = 1;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 68 |
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 69 | var output = encodeToHexInterest(interest);
|
| 70 |
|
| 71 | document.getElementById('result').innerHTML = output;
|
| 72 |
|
| 73 | }
|
| 74 |
|
| 75 | function decode(){
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 | var input = document.getElementById('result').innerHTML;
|
| 80 |
|
| 81 |
|
| 82 | var interest = decodeHexInterest(input);
|
| 83 |
|
| 84 | if(LOG>3)console.log('INTEREST DECODED');
|
| 85 | if(LOG>3)console.log(interest);
|
| 86 |
|
| 87 | ///////////////////////////////////////
|
| 88 |
|
| 89 | var output ="";
|
| 90 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 91 | if(interest.name!=null && interest.name.components!=null){
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 92 | output+= "NAME: ";
|
| 93 |
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 94 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 95 | output+= interest.name.getName();
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 96 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 97 | /*for(var i=0;i<interest.name.components.length;i++){
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 98 | output+= "/"+ DataUtils.toString(interest.name.Components[i]);
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 99 | }*/
|
| 100 |
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 101 | output+= "<br />";
|
| 102 | output+= "<br />";
|
| 103 | }
|
| 104 |
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 105 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 106 | if(interest.scope!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 107 | output+= "SCOPE: ";
|
| 108 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 109 | output+= interest.scope;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 110 |
|
| 111 | output+= "<br />";
|
| 112 | output+= "<br />";
|
| 113 | }
|
| 114 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 115 | if(interest.publisherID!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 116 | output+= "PUBLISHER ID: ";
|
| 117 |
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 118 | output+= interest.publisherID.publisherID;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 119 |
|
| 120 | output+= "PUBLISHER ID TYPE: ";
|
Jeff Thompson | e85ff1d | 2012-09-29 21:21:57 -0700 | [diff] [blame] | 121 | output+= interest.publisherID.publisherType;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 122 | output+= "<br />";
|
| 123 | output+= "<br />";
|
| 124 | }
|
| 125 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 126 | if(interest.maxSuffixComponents!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 127 | output+= "MaxSuffixComponents : ";
|
| 128 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 129 | output+= interest.maxSuffixComponents;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 130 |
|
| 131 | output+= "<br />";
|
| 132 | output+= "<br />";
|
| 133 | }
|
| 134 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 135 | if(interest.minSuffixComponents!=null ){
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 136 | output+= "MinSuffixComponents : ";
|
| 137 |
|
Jeff Thompson | 86aea88 | 2012-09-29 17:32:48 -0700 | [diff] [blame] | 138 | output+= interest.minSuffixComponents;
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 139 |
|
| 140 | output+= "<br />";
|
| 141 | output+= "<br />";
|
| 142 | }
|
| 143 |
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 144 | document.getElementById('result').innerHTML = output;
|
| 145 |
|
| 146 | }
|
| 147 |
|
| 148 | </script>
|
| 149 |
|
| 150 | </head>
|
| 151 | <body >
|
| 152 | <form>
|
| 153 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 154 | Please Enter an Interest:<br />
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 155 |
|
jeff | 9797d3d | 2012-09-03 15:07:13 -0700 | [diff] [blame] | 156 | <input id="interest" type="text" name="INTEREST" value="/PARC/abc" />
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 157 |
|
| 158 | </form>
|
| 159 | <button onclick="encode()">Encode</button>
|
| 160 | <button onclick="decode()">Decode</button>
|
| 161 |
|
Jeff Thompson | 7ed5ef5 | 2012-08-26 11:28:48 -0700 | [diff] [blame] | 162 | <p id="result"></p>
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 163 |
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 164 |
|
| 165 |
|
Meki Cherkaoui | 8f17361 | 2012-06-06 01:05:40 -0700 | [diff] [blame] | 166 | <!-- p id="result">01d2f2fafdc12e4d2e532e6c6f63616c686f737400fabdc12e4d2e53525600faa563636e6400fa9d4b4559000002d28e310000</p-->
|
Meki Cherkaoui | 88d59cd | 2012-05-14 07:34:58 -0700 | [diff] [blame] | 167 |
|
| 168 | </body>
|
jeff | 9797d3d | 2012-09-03 15:07:13 -0700 | [diff] [blame] | 169 | </html>
|