blob: 2f59febebff318c3809439d1ffc24341dfb789d9 [file] [log] [blame]
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -07001<?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>
Jeff Thompsond9784e02012-10-18 23:39:39 -07007 <title>NDN Encode/Decode Interest</title>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -07008
Jeff Thompson7ed5ef52012-08-26 11:28:48 -07009 <script type="text/javascript" src="../java_socket_bridge.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070010
Jeff Thompsonc3164722012-09-30 18:35:02 -070011 <script type="text/javascript" src="../util/CCNProtocolDTags.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070012
Jeff Thompsonc3164722012-09-30 18:35:02 -070013 <script type="text/javascript" src="../util/CCNTime.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070014
Jeff Thompsonf3bd3592012-09-29 23:25:30 -070015 <script type="text/javascript" src="../Name.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070016
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070017 <script type="text/javascript" src="../ContentObject.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070018
Jeff Thompsonc3164722012-09-30 18:35:02 -070019 <script type="text/javascript" src="../encoding/DateFormat.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070020
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070021 <script type="text/javascript" src="../Interest.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070022
Jeff Thompsonc3164722012-09-30 18:35:02 -070023 <script type="text/javascript" src="../Key.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070024
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070025 <script type="text/javascript" src="../PublisherID.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070026
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070027 <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070028
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070029 <script type="text/javascript" src="../FaceInstance.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070030
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070031 <script type="text/javascript" src="../ForwardingEntry.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070032
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070033 <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070034
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070035 <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070036
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070037 <script type="text/javascript" src="../encoding/DataUtils.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070038
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070039 <script type="text/javascript" src="../encoding/EncodingUtils.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070040
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070041 <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070042
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070043 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script>
44 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script>
45 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script>
46 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070047
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070048 <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script>
49 <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script>
50 <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script>
51 <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script>
52 <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script>
53 <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070054
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070055 <script language="JavaScript" type="text/javascript" src="../securityLib/rsapem-1.1.js"></script>
56 <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script>
57 <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script>
58 <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script>
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070059
60 <script type="text/javascript">
61
62 function encode(){
Jeff Thompsonf3bd3592012-09-29 23:25:30 -070063 var interest = new Interest( new Name(document.getElementById('interest').value ) );
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070064
Jeff Thompson86aea882012-09-29 17:32:48 -070065 interest.scope = 1;
Meki Cherkaoui8f173612012-06-06 01:05:40 -070066
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070067 var output = encodeToHexInterest(interest);
68
69 document.getElementById('result').innerHTML = output;
70
71 }
72
73 function decode(){
74
75
76
77 var input = document.getElementById('result').innerHTML;
78
79
80 var interest = decodeHexInterest(input);
81
82 if(LOG>3)console.log('INTEREST DECODED');
83 if(LOG>3)console.log(interest);
84
85 ///////////////////////////////////////
86
87 var output ="";
88
Jeff Thompsone85ff1d2012-09-29 21:21:57 -070089 if(interest.name!=null && interest.name.components!=null){
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070090 output+= "NAME: ";
91
Meki Cherkaoui8f173612012-06-06 01:05:40 -070092
Jeff Thompson86aea882012-09-29 17:32:48 -070093 output+= interest.name.getName();
Meki Cherkaoui8f173612012-06-06 01:05:40 -070094
Jeff Thompsone85ff1d2012-09-29 21:21:57 -070095 /*for(var i=0;i<interest.name.components.length;i++){
Jeff Thompson86aea882012-09-29 17:32:48 -070096 output+= "/"+ DataUtils.toString(interest.name.Components[i]);
Meki Cherkaoui8f173612012-06-06 01:05:40 -070097 }*/
98
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -070099 output+= "<br />";
100 output+= "<br />";
101 }
102
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700103
Jeff Thompson86aea882012-09-29 17:32:48 -0700104 if(interest.scope!=null ){
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700105 output+= "SCOPE: ";
106
Jeff Thompson86aea882012-09-29 17:32:48 -0700107 output+= interest.scope;
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700108
109 output+= "<br />";
110 output+= "<br />";
111 }
112
Jeff Thompson86aea882012-09-29 17:32:48 -0700113 if(interest.publisherID!=null ){
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700114 output+= "PUBLISHER ID: ";
115
Jeff Thompsone85ff1d2012-09-29 21:21:57 -0700116 output+= interest.publisherID.publisherID;
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700117
118 output+= "PUBLISHER ID TYPE: ";
Jeff Thompsone85ff1d2012-09-29 21:21:57 -0700119 output+= interest.publisherID.publisherType;
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700120 output+= "<br />";
121 output+= "<br />";
122 }
123
Jeff Thompson86aea882012-09-29 17:32:48 -0700124 if(interest.maxSuffixComponents!=null ){
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700125 output+= "MaxSuffixComponents : ";
126
Jeff Thompson86aea882012-09-29 17:32:48 -0700127 output+= interest.maxSuffixComponents;
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700128
129 output+= "<br />";
130 output+= "<br />";
131 }
132
Jeff Thompson86aea882012-09-29 17:32:48 -0700133 if(interest.minSuffixComponents!=null ){
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700134 output+= "MinSuffixComponents : ";
135
Jeff Thompson86aea882012-09-29 17:32:48 -0700136 output+= interest.minSuffixComponents;
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700137
138 output+= "<br />";
139 output+= "<br />";
140 }
141
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700142 document.getElementById('result').innerHTML = output;
143
144 }
145
146 </script>
147
148</head>
149<body >
150 <form>
151
Jeff Thompson7ed5ef52012-08-26 11:28:48 -0700152 Please Enter an Interest:<br />
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700153
jeff9797d3d2012-09-03 15:07:13 -0700154 <input id="interest" type="text" name="INTEREST" value="/PARC/abc" />
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700155
156 </form>
157 <button onclick="encode()">Encode</button>
158 <button onclick="decode()">Decode</button>
159
Jeff Thompson7ed5ef52012-08-26 11:28:48 -0700160 <p id="result"></p>
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700161
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700162
163
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700164 <!-- p id="result">01d2f2fafdc12e4d2e532e6c6f63616c686f737400fabdc12e4d2e53525600faa563636e6400fa9d4b4559000002d28e310000</p-->
Meki Cherkaoui88d59cd2012-05-14 07:34:58 -0700165
166</body>
jeff9797d3d2012-09-03 15:07:13 -0700167</html>