blob: 666d3f5a673f31b86b4da16a51f859b6e301f493 [file] [log] [blame]
Meki Cherkaoui8f173612012-06-06 01:05:40 -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>
7 <title>NDN Send Hex</title>
Jeff Thompson7ed5ef52012-08-26 11:28:48 -07008 <script type="text/javascript" src="../java_socket_bridge.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -07009
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070010 <script type="text/javascript" src="../CCNProtocolDTags.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070011
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070012 <script type="text/javascript" src="../CCNTime.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070013
Jeff Thompsonf3bd3592012-09-29 23:25:30 -070014 <script type="text/javascript" src="../Name.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070015
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070016 <script type="text/javascript" src="../ContentObject.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070017
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070018 <script type="text/javascript" src="../DateFormat.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070019
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070020 <script type="text/javascript" src="../Exclude.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070021
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070022 <script type="text/javascript" src="../ExcludeAny.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070023
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070024 <script type="text/javascript" src="../ExcludeComponent.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070025
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070026 <script type="text/javascript" src="../Interest.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070027
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070028 <script type="text/javascript" src="../KeyLocator.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070029
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070030 <script type="text/javascript" src="../PublisherID.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070031
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070032 <script type="text/javascript" src="../Signature.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070033
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070034 <script type="text/javascript" src="../SignedInfo.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070035
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070036 <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070037
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070038 <script type="text/javascript" src="../FaceInstance.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070039
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070040 <script type="text/javascript" src="../ForwardingEntry.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070041
42
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070043 <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070044
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070045 <script type="text/javascript" src="../encoding/BinaryXMLCodec.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070046
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070047 <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070048
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070049 <script type="text/javascript" src="../encoding/DataUtils.js"></script>
jeff9a9fff22012-09-23 15:45:22 -070050
51 <script type="text/javascript" src="../encoding/EncodingUtils.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070052
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070053 <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070054
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070055 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script>
56 <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script>
57 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script>
58 <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070059
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070060 <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script>
61 <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script>
62 <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script>
63 <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script>
64 <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script>
65 <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070066
Jeff Thompson7ed5ef52012-08-26 11:28:48 -070067 <script language="JavaScript" type="text/javascript" src="../securityLib/rsapem-1.1.js"></script>
68 <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script>
69 <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script>
70 <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script>
Meki Cherkaoui8f173612012-06-06 01:05:40 -070071
72 <script type="text/javascript">
73 function run(){
Meki Cherkaoui8f173612012-06-06 01:05:40 -070074 //var n = a.replace("%","");
75
76 //console.log(n);
77
78 var hex = document.getElementById('contentname').value;
79
80 ///////////////////////////////////////
81 //createRoute(, 9695);
82
83
84 /// /ndn/ucla.edu/apps/hydra/mainvideo
85 //createRoute('131.179.141.15', 9695);
86 //createRoute('borges.metwi.ucla.edu', 9695);
87
88 //content object
Jeff Thompsonf3bd3592012-09-29 23:25:30 -070089 //var co = queryPrefix( Name );
Meki Cherkaoui8f173612012-06-06 01:05:40 -070090 console.log('HEX IS');
91 console.log(hex);
92
jeff9a9fff22012-09-23 15:45:22 -070093 var result = get('127.0.0.1', 9695, hex);
Meki Cherkaoui8f173612012-06-06 01:05:40 -070094
95 console.log('BINARY RESPONSE IS ' +result);
96
97 var output ="";
98 output += "HEX ANSWER IS: "+ result;
99
100 output+= "<br />";
101 output+= "<br />";
102
103 //result[0] and result[1] should be 0 and 4 if there is a content object found
104 if(result==null || result==undefined || result =="" ){
105
106
107 if(LOG>2)console.log('INVALID ANSWER');
108 output += "NO CONTENT FOUND";
109
110 output+= "<br />";
111 output+= "<br />";
112 }
113
114 else if(result[0] != '0'||result[1]!='4') {
115 if(LOG>2)console.log('INVALID ANSWER');
116 output += "INVALID ANSWER";
117
118 output+= "<br />";
119 output+= "<br />";
120 }
121 else{
122
123 var numbers = DataUtils.toNumbers(result);
124
125 console.log('HEX RESPONSE IS \n'+numbers);
126 decoder = new BinaryXMLDecoder(numbers);
127
128
129 co = new ContentObject();
130
Jeff Thompson86aea882012-09-29 17:32:48 -0700131 co.from_ccnb(decoder);
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700132
133 if(LOG>2) console.log(co);
134
jeff9a9fff22012-09-23 15:45:22 -0700135 output += contentObjectToHtml(co);
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700136 }
137 document.getElementById('result').innerHTML = output;
138 }
139
140 </script>
141
142</head>
143<body >
144 <form>
jeff9a9fff22012-09-23 15:45:22 -0700145 Please Enter a Hex Encoded Interest:<br /><input id="contentname" type="text" name="CONTENTNAME" value="01d2f20002d28e310000" /> <br />
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700146 </form>
147 <button onclick="run()">Request Data!</button>
148 <div >
Jeff Thompson67439692012-08-26 12:15:08 -0700149 <applet id="JavaSocketBridge" archive="../JavaSocketBridge.jar" code="JavaSocketBridge.class" width="0" height="0">
Meki Cherkaoui8f173612012-06-06 01:05:40 -0700150 </applet>
151 </div>
152
153 <p id="result"></p>
154
155</body>
jeff9a9fff22012-09-23 15:45:22 -0700156</html>