Changing ccn to ndn
Change-Id: Iba4ec8e48dd5345903cc3518aaf98d4d37d89ff1
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();
});