ndt-dev - [ndt-dev] [ndt] r1046 committed - First attempt to implement MSG_EXTENDED_LOGIN
Subject: NDT-DEV email list created
List archive
[ndt-dev] [ndt] r1046 committed - First attempt to implement MSG_EXTENDED_LOGIN
Chronological Thread
- From:
- To:
- Subject: [ndt-dev] [ndt] r1046 committed - First attempt to implement MSG_EXTENDED_LOGIN
- Date: Wed, 02 Apr 2014 23:01:55 +0000
Revision: 1046
Author:
Date: Wed Apr 2 23:01:31 2014 UTC
Log: First attempt to implement MSG_EXTENDED_LOGIN
http://code.google.com/p/ndt/source/detail?r=1046
Modified:
/branches/Issue143/flash-client/src/Handshake.as
/branches/Issue143/flash-client/src/MessageType.as
/branches/Issue143/src/protocol.h
/branches/Issue143/src/test_s2c_srv.c
/branches/Issue143/src/testoptions.c
/branches/Issue143/src/testoptions.h
=======================================
--- /branches/Issue143/flash-client/src/Handshake.as Fri Feb 21 07:41:20 2014 UTC
+++ /branches/Issue143/flash-client/src/Handshake.as Wed Apr 2 23:01:31 2014 UTC
@@ -52,8 +52,12 @@
public function run():void {
var msgBody:ByteArray = new ByteArray();
+ var clientVersion:String = NDTConstants.CLIENT_VERSION;
+
msgBody.writeByte(_testsRequestByClient);
- _msg = new Message(MessageType.MSG_LOGIN, msgBody);
+ msgBody.writeMultiByte(clientVersion, "us-ascii");
+
+ _msg = new Message(MessageType.MSG_EXTENDED_LOGIN, msgBody);
if (!_msg.sendMessage(_ctlSocket)) {
failHandshake();
}
=======================================
--- /branches/Issue143/flash-client/src/MessageType.as Sun Feb 2 19:14:17 2014 UTC
+++ /branches/Issue143/flash-client/src/MessageType.as Wed Apr 2 23:01:31 2014 UTC
@@ -31,6 +31,7 @@
public static const MSG_RESULTS:int = 8;
public static const MSG_LOGOUT:int = 9;
public static const MSG_WAITING:int = 10;
+ public static const MSG_EXTENDED_LOGIN:int = 11;
}
}
=======================================
--- /branches/Issue143/src/protocol.h Fri Feb 21 16:32:03 2014 UTC
+++ /branches/Issue143/src/protocol.h Wed Apr 2 23:01:31 2014 UTC
@@ -23,6 +23,7 @@
#define MSG_RESULTS 8
#define MSG_LOGOUT 9
#define MSG_WAITING 10
+#define MSG_EXTENDED_LOGIN 11
#define SRV_QUEUE_TEST_STARTS_NOW 0
#define SRV_QUEUE_TEST_STARTS_NOW_STR "0"
=======================================
--- /branches/Issue143/src/test_s2c_srv.c Mon Oct 14 13:20:21 2013 UTC
+++ /branches/Issue143/src/test_s2c_srv.c Wed Apr 2 23:01:31 2014 UTC
@@ -135,6 +135,8 @@
snapArgs.delay = options->snapDelay;
wait_sig = 0;
+ log_println(0, "test client version: %s", testOptions->client_version);
+
// Determine port to be used. Compute based on options set earlier
// by reading from config file, or use default port2 (3003)
if (testOptions->s2copt) {
=======================================
--- /branches/Issue143/src/testoptions.c Fri Feb 21 16:32:03 2014 UTC
+++ /branches/Issue143/src/testoptions.c Wed Apr 2 23:01:31 2014 UTC
@@ -206,9 +206,10 @@
int initialize_tests(int ctlsockfd, TestOptions* options, char * buff,
size_t buff_strlen) {
+ unsigned char msgValue[33] = {'\0', };
unsigned char useropt = 0;
int msgType;
- int msgLen = 1;
+ int msgLen = 33;
int first = 1;
char *invalid_test_suite = "Invalid test suite request.";
char *client_timeout = "Client timeout.";
@@ -220,8 +221,10 @@
assert(ctlsockfd != -1);
assert(options);
+ memset(options->client_version, 0, 33);
+
// read the test suite request
- if (recv_msg(ctlsockfd, &msgType, &useropt, &msgLen)) {
+ if (recv_msg(ctlsockfd, &msgType, msgValue, &msgLen)) {
send_msg(ctlsockfd, MSG_ERROR, invalid_test_suite,
strlen(invalid_test_suite));
return (-1);
@@ -230,11 +233,33 @@
snprintf(buff, buff_strlen, "Client timeout");
return (-4);
}
- // Expecting a MSG_LOGIN with payload byte indicating tests to be run
- if ((msgType != MSG_LOGIN) || (msgLen != 1)) {
+
+ /*
+ * Expecting a MSG_LOGIN or MSG_EXTENDED_LOGIN with
+ * payload byte indicating tests to be run and potentially
+ * a US-ASCII string indicating the version number.
+ * Three cases:
+ * 1: MSG_LOGIN
+ * 2: MSG_EXTENDED_LOGIN:
+ * 3: Neither
+ */
+ if (msgType == MSG_LOGIN || msgType == MSG_EXTENDED_LOGIN) {
+ if (msgLen < 1) {
+ send_msg(ctlsockfd, MSG_ERROR, invalid_test, strlen(invalid_test));
+ return (-2);
+ }
+ useropt = msgValue[0];
+ if (msgLen > 1) {
+ log_println(0, "msgLen: %d-\n", msgLen);
+ log_println(0, "msgValue: %s-\n", msgValue + 1);
+ memcpy(options->client_version, msgValue + 1, msgLen-1);
+ log_println(0, "Client version: %s-\n", options->client_version);
+ }
+ } else {
send_msg(ctlsockfd, MSG_ERROR, invalid_test, strlen(invalid_test));
return (-2);
}
+
// client connect received correctly. Logging activity
// log that client connected, and create log file
log_println(0,
=======================================
--- /branches/Issue143/src/testoptions.h Mon Oct 14 13:20:21 2013 UTC
+++ /branches/Issue143/src/testoptions.h Wed Apr 2 23:01:31 2014 UTC
@@ -21,6 +21,8 @@
int multiple; // multiples tests enabled
int mainport; // main port used for test
+ char client_version[33]; // client version number.
+
int midopt; // middlebox test to be perfomed?
int midsockfd; // socket file desc for middlebox test
int midsockport; // port used for middlebox test
- [ndt-dev] [ndt] r1046 committed - First attempt to implement MSG_EXTENDED_LOGIN, ndt, 04/02/2014
Archive powered by MHonArc 2.6.16.