Changing ccn to ndn
Change-Id: Iba4ec8e48dd5345903cc3518aaf98d4d37d89ff1
diff --git a/wsproxy/README.md b/wsproxy/README.md
index 3b8dc26..117f749 100644
--- a/wsproxy/README.md
+++ b/wsproxy/README.md
@@ -1,9 +1,9 @@
wsproxy
=======
-WebSocket proxy server between NDN javascript stack and ccnd.
+WebSocket proxy server between NDN javascript stack and ndnd.
-This proxy runs on top of 'node.js'. 'ws' and 'node-getopt' packages are required. It listens for WebSocket connection request on port number 9696. Once it receives a incoming connection, it issues a TCP connection to the specified 'ccnd' router (port number 9695). It then translates packet frames from WebSocket to pure TCP byte streams and vice versa.
+This proxy runs on top of 'node.js'. 'ws' and 'node-getopt' packages are required. It listens for WebSocket connection request on port number 9696. Once it receives a incoming connection, it issues a TCP connection to the specified 'ndnd' router (port number 9695). It then translates packet frames from WebSocket to pure TCP byte streams and vice versa.
Installation guide:
@@ -16,7 +16,7 @@
To run the proxy, simply use the command 'node wsproxy-tcp.js' or 'node wsproxy-udp.js'.
-To specify remote ccnd router's hostname or ip address, use option '-c x.x.x.x'. Default is 'localhost'.
+To specify remote ndnd router's hostname or ip address, use option '-c x.x.x.x'. Default is 'localhost'.
To specify the port number on which the proxy will listen, use option '-p xxxx'. Default is 9696.
@@ -24,7 +24,7 @@
To specify the level of log info display, use option '-L x'. x=0 means no output; x=1 will log connection startup and close; x=2 will log contents of all messages that flow across the proxy. Default is 1.
-Example: to setup UDP connection to ccnd router 192.168.1.51 with max client number 50 and log level 2, use the command:
+Example: to setup UDP connection to ndnd router 192.168.1.51 with max client number 50 and log level 2, use the command:
node wsproxy-udp.js -c 192.168.1.51 -m 50 -L 2
diff --git a/wsproxy/wsproxy-tcp.js b/wsproxy/wsproxy-tcp.js
index 8ff84a2..6d34d94 100644
--- a/wsproxy/wsproxy-tcp.js
+++ b/wsproxy/wsproxy-tcp.js
@@ -1,14 +1,14 @@
/*
* @author: Wentao Shang
* See COPYING for copyright and distribution information.
- * Implement WebSocket proxy between ccnd and javascript stack.
+ * Implement WebSocket proxy between ndnd and javascript stack.
*/
var WebSocketServer = require('ws').Server;
var net = require('net');
var opt = require('node-getopt').create([
- ['c' , 'ccnd=ARG', 'host name or ip of ccnd router'],
+ ['c' , 'ndnd=ARG', 'host name or ip of ndnd router'],
['p' , 'port=ARG', 'port number on which the proxy will listen'],
['m' , 'maxclient=ARG', 'maximum number of concurrent client'],
['L' , 'LOG=ARG', 'level of log message display'],
@@ -19,14 +19,14 @@
//console.log(opt);
-var ccndhost = opt.options.ccnd || 'localhost';
-//console.log(ccndhost);
+var ndndhost = opt.options.ndnd || 'localhost';
+//console.log(ndndhost);
var wsport = opt.options.port || 9696;
//console.log(wsport);
var wss = new WebSocketServer({port:wsport, host:'0.0.0.0'}); // Set host to '0.0.0.0' so that we can accept connections from anywhere
- // This host has nothing to do with ccndhost.
+ // This host has nothing to do with ndndhost.
var MaxNumOfClients = opt.options.maxclient || 40;
//console.log(MaxNumOfClients);
@@ -49,7 +49,7 @@
var sock_ready = false;
var ws_ready = true;
var send_queue = [];
- var sock = net.connect({port: 9695, host: ccndhost});
+ var sock = net.connect({port: 9695, host: ndndhost});
ws.on('message', function(message) {
if (typeof message == 'string') {
@@ -85,7 +85,7 @@
sock.write(message);
}
sock_ready = true;
- if (LOG > 0) console.log('ccnd socket connection ready.');
+ if (LOG > 0) console.log('ndnd socket connection ready.');
});
sock.on('data', function(data) {
@@ -107,12 +107,12 @@
});
sock.on('end', function() {
- if (LOG > 0) console.log('TCP connection terminated by ccnd. Shut down WS connection to client.');
+ if (LOG > 0) console.log('TCP connection terminated by ndnd. Shut down WS connection to client.');
ws.terminate();
});
sock.on('error', function() {
- if (LOG > 0) console.log('Error on TCP connection to ccnd. Shut down WS connection to client.');
+ if (LOG > 0) console.log('Error on TCP connection to ndnd. Shut down WS connection to client.');
ws.terminate();
});
});
diff --git a/wsproxy/wsproxy-udp.js b/wsproxy/wsproxy-udp.js
index 0a65862..7efb1a2 100755
--- a/wsproxy/wsproxy-udp.js
+++ b/wsproxy/wsproxy-udp.js
@@ -3,14 +3,14 @@
/*
* @author: Wentao Shang
* See COPYING for copyright and distribution information.
- * Implement WebSocket proxy between ccnd and javascript stack.
+ * Implement WebSocket proxy between ndnd and javascript stack.
*/
var WebSocketServer = require('ws').Server;
var dgram = require('dgram');
var opt = require('node-getopt').create([
- ['c' , 'ccnd=ARG', 'host name or ip of ccnd router'],
+ ['c' , 'ndnd=ARG', 'host name or ip of ndnd router'],
['p' , 'port=ARG', 'port number on which the proxy will listen'],
['m' , 'maxclient=ARG', 'maximum number of concurrent client'],
['L' , 'LOG=ARG', 'level of log message display'],
@@ -19,11 +19,11 @@
.bindHelp() // bind option 'help' to default action
.parseSystem(); // parse command line
-var ccndhost = opt.options.ccnd || 'localhost';
+var ndndhost = opt.options.ndnd || 'localhost';
var wsport = opt.options.port || 9696;
var wss = new WebSocketServer({port:wsport, host:'0.0.0.0'}); // Set host to '0.0.0.0' so that we can accept connections from anywhere
- // This host has nothing to do with ccndhost.
+ // This host has nothing to do with ndndhost.
var MaxNumOfClients = opt.options.maxclient || 40;
@@ -45,19 +45,19 @@
/*
* According to the email discussion with Michael, when we use
- * UDP to connect to ccnd, we MUST first send a 'heartbeat'
+ * UDP to connect to ndnd, we MUST first send a 'heartbeat'
* UDP packet with 1-byte payload (content of this byte can
- * be random). The purpose of this packet is to let ccnd
- * mark the incoming FACE as 'friendly' (with CCN_FACE_GG
+ * be random). The purpose of this packet is to let ndnd
+ * mark the incoming FACE as 'friendly' (with NDN_FACE_GG
* flag set). We also need to periodically send this 'heartbeat'
- * packet every few seconds to keep ccnd from recycling the UDP
+ * packet every few seconds to keep ndnd from recycling the UDP
* face. Michael recomended 8 seconds interval.
* --Wentao
*/
// Send 'heartbeat' packet now
var heartbeat = new Buffer(1);
heartbeat[0] = 0x21;
- udp.send(heartbeat, 0, 1, 9695, ccndhost, null);
+ udp.send(heartbeat, 0, 1, 9695, ndndhost, null);
// Schedule a timer to send 'heartbeat' periodically
var timerID = setInterval(function() {
@@ -66,8 +66,8 @@
var hb = new Buffer(1);
hb[0] = 0x21;
- udp.send(hb, 0, 1, 9695, ccndhost, null);
- if (LOG > 1) console.log('UDP heartbeat fired at ccnd.');
+ udp.send(hb, 0, 1, 9695, ndndhost, null);
+ if (LOG > 1) console.log('UDP heartbeat fired at ndnd.');
},
8000 // 8000 ms delay
);
@@ -87,12 +87,12 @@
console.log(logMsg);
}
- udp.send(buffer, 0, buffer.length, 9695, ccndhost, null);
+ udp.send(buffer, 0, buffer.length, 9695, ndndhost, null);
}
});
ws.on('close', function() {
- if (LOG > 0) console.log('ws.onclose: WebSocket connection closed. Close UDP connection to ccnd and stop "heartbeat" timer.');
+ if (LOG > 0) console.log('ws.onclose: WebSocket connection closed. Close UDP connection to ndnd and stop "heartbeat" timer.');
clearInterval(timerID);
udp.close();
udp = null;
@@ -113,7 +113,7 @@
}
});
- // Actually the socket close by ccnd will not cause the 'close' event to raise.
+ // Actually the socket close by ndnd will not cause the 'close' event to raise.
// So this event handle is only called when the client browser shuts down the WS
// connection, causing ws 'close' event to raise. In that event handle, we explicitly
// call udp.close(). So in this function we can do nothing. Anyway, here we clear the
@@ -121,13 +121,13 @@
// will check the 'readyState' before closing, therefore avoids 'close' event loop.
// --Wentao
udp.on('close', function() {
- if (LOG > 0) console.log('udp.onclose: UDP connection to ccnd terminated. Shut down WS connection to client and stop "heartbeat" timer.');
+ if (LOG > 0) console.log('udp.onclose: UDP connection to ndnd terminated. Shut down WS connection to client and stop "heartbeat" timer.');
clearInterval(timerID);
ws.terminate();
});
udp.on('error', function() {
- if (LOG > 0) console.log('udp.onerror: Error on UDP connection to ccnd. Shut down WS connection to client and stop "heartbeat" timer.');
+ if (LOG > 0) console.log('udp.onerror: Error on UDP connection to ndnd. Shut down WS connection to client and stop "heartbeat" timer.');
clearInterval(timerID);
ws.terminate();
});