Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r1055 committed - Changed remaining messages to use JSON format

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r1055 committed - Changed remaining messages to use JSON format


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r1055 committed - Changed remaining messages to use JSON format
  • Date: Fri, 16 May 2014 08:02:26 +0000

Revision: 1055
Author:

Date: Fri May 16 08:01:58 2014 UTC
Log: Changed remaining messages to use JSON format

http://code.google.com/p/ndt/source/detail?r=1055

Modified:
/branches/Issue145/src/test_s2c_clt.c
/branches/Issue145/src/test_s2c_srv.c
/branches/Issue145/src/testoptions.c
/branches/Issue145/src/web100-util.c
/branches/Issue145/src/web100clt.c
/branches/Issue145/src/web100srv.c
/branches/Issue145/src/web100srv.h

=======================================
--- /branches/Issue145/src/test_s2c_clt.c Tue May 13 13:52:22 2014 UTC
+++ /branches/Issue145/src/test_s2c_clt.c Fri May 16 08:01:58 2014 UTC
@@ -284,8 +284,16 @@
return 2;
}

- // hardcoded size of array from main tests
- strlcat(result_srv, buff, 2 * BUFFSIZE);
+ if (jsonSupport) {
+ jsonMsgValue = json_read_map_value(buff, DEFAULT_KEY);
+ strlcat(result_srv, jsonMsgValue, 2 * BUFFSIZE);
+ free(jsonMsgValue);
+ }
+ else {
+ // hardcoded size of array from main tests
+ strlcat(result_srv, buff, 2 * BUFFSIZE);
+ }
+
}
log_println(6, "result_srv = '%s', of len %d", result_srv, msgLen);
log_println(1, " <------------------------->");
=======================================
--- /branches/Issue145/src/test_s2c_srv.c Tue May 13 13:52:22 2014 UTC
+++ /branches/Issue145/src/test_s2c_srv.c Fri May 16 08:01:58 2014 UTC
@@ -600,7 +600,7 @@
ret = tcp_stat_get_data(rsnap, xmitsfd, ctlsockfd, agent, count_vars);
web100_snapshot_free(rsnap);
#elif USE_WEB10G
- ret = tcp_stat_get_data(snap, xmitsfd, ctlsockfd, agent, count_vars);
+ ret = tcp_stat_get_data(snap, xmitsfd, ctlsockfd, agent, count_vars, testOptions->json_support);
estats_val_data_free(&snap);
#endif

=======================================
--- /branches/Issue145/src/testoptions.c Wed May 14 06:39:08 2014 UTC
+++ /branches/Issue145/src/testoptions.c Fri May 16 08:01:58 2014 UTC
@@ -260,6 +260,10 @@
}
} else if (msgType == MSG_EXTENDED_LOGIN) { /* Case 2 */
options->json_support = 1;
+ jsonMsgValue = json_read_map_value(msgValue, DEFAULT_KEY);
+ strlcpy(msgValue, jsonMsgValue, sizeof(msgValue));
+ msgLen = strlen(jsonMsgValue);
+ free(jsonMsgValue);
if (msgLen >= 1 && msgLen <= (CS_VERSION_LENGTH_MAX + 1)) {
memcpy(options->client_version, msgValue + 1, msgLen - 1);
log_println(0, "Client version: %s-\n", options->client_version);
=======================================
--- /branches/Issue145/src/web100-util.c Tue May 13 13:52:22 2014 UTC
+++ /branches/Issue145/src/web100-util.c Fri May 16 08:01:58 2014 UTC
@@ -16,6 +16,7 @@
#include "strlutils.h"
#include "utils.h"
#include "web100srv.h"
+#include "jsonutils.h"

struct tcp_name {
char* web100_name;
@@ -522,6 +523,7 @@
* @param line A char* to write the line to
* @param line_size Size of line in bytes
* @param ctlsock The socket to write to
+ * @param jsonSupport Indicates if messages should be sent using JSON format
*
* If this fails nothing is sent on the cltsocket and the error will
* be logged.
@@ -529,7 +531,7 @@
*/
static void print_10gvar_renamed(const char * old_name,
const char * new_name, const tcp_stat_snap* snap, char * line,
- int line_size, int ctlsock) {
+ int line_size, int ctlsock, int jsonSupport) {
int type;
struct estats_val val;
estats_error* err;
@@ -547,7 +549,7 @@
estats_error_free(&err);
} else {
snprintf(line, line_size, "%s: %s\n", new_name, str);
- send_msg(ctlsock, TEST_MSG, line, strlen(line));
+ send_json_message(ctlsock, TEST_MSG, line, strlen(line), jsonSupport, JSON_SINGLE_VALUE);
free(str);
str = NULL;
}
@@ -566,10 +568,11 @@
* @param ctlsock integer socket file descriptor indicating data recipient
* @param agent pointer to a tcp_stat_agent
* @param count_vars integer number of tcp_stat_variables to get value of
+ * @param jsonSupport indicates if messages should be sent usin JSON format
*
*/
int tcp_stat_get_data(tcp_stat_snap* snap, int testsock, int ctlsock,
- tcp_stat_agent* agent, int count_vars) {
+ tcp_stat_agent* agent, int count_vars, int jsonSupport) {
char line[256];
#if USE_WEB100
int i;
@@ -613,7 +616,7 @@
/* Why do we atoi after getting as text anyway ?? */
snprintf(line, sizeof(line), "%s: %d\n", web_vars[i].name,
atoi(web_vars[i].value));
- send_msg(ctlsock, TEST_MSG, line, strlen(line));
+ send_json_message(ctlsock, TEST_MSG, line, strlen(line), jsonSupport, JSON_SINGLE_VALUE);
log_print(9, "%s", line);
}
log_println(6, "S2C test - Send web100 data to client pid=%d", getpid());
@@ -656,7 +659,7 @@
}
snprintf(line, sizeof(line), "%s: %s\n",
estats_var_array[j].name, str);
- send_msg(ctlsock, TEST_MSG, (const void *) line, strlen(line));
+ send_json_message(ctlsock, TEST_MSG, line, strlen(line), jsonSupport, JSON_SINGLE_VALUE);
log_print(9, "%s", line);
free(str);
str = NULL;
@@ -685,8 +688,7 @@
static const char* frame_web100 = "-~~~Web100_old_var_names~~~-: 1\n";
int type;
char *str = NULL;
- send_msg(ctlsock, TEST_MSG, (const void *)frame_web100,
- strlen(frame_web100));
+ send_json_message(ctlsock, TEST_MSG, frame_web100, strlen(frame_web100), jsonSupport, JSON_SINGLE_VALUE);

/* ECNEnabled -> ECN */
type = web10g_find_val(snap, "ECN", &val);
@@ -695,7 +697,7 @@
" failed to find ECN bad type=%d", type);
} else {
snprintf(line, sizeof(line), "ECNEnabled: %"PRId32"\n", (val.sv32 == 1) ? 1 : 0);
- send_msg(ctlsock, TEST_MSG, line, strlen(line));
+ send_json_message(ctlsock, TEST_MSG, line, strlen(line), jsonSupport, JSON_SINGLE_VALUE);
}

/* NagleEnabled -> Nagle */
@@ -705,7 +707,7 @@
" failed to find Nagle bad type=%d", type);
} else {
snprintf(line, sizeof(line), "NagleEnabled: %"PRId32"\n", (val.sv32 == 2) ? 1 : 0);
- send_msg(ctlsock, TEST_MSG, line, strlen(line));
+ send_json_message(ctlsock, TEST_MSG, line, strlen(line), jsonSupport, JSON_SINGLE_VALUE);
}

/* SACKEnabled -> WillUseSACK & WillSendSACK */
@@ -716,7 +718,7 @@
} else {
/* Yes this comes through as 3 from web100 */
snprintf(line, sizeof(line), "SACKEnabled: %d\n", (val.sv32 == 1) ? 3 : 0);
- send_msg(ctlsock, TEST_MSG, line, strlen(line));
+ send_json_message(ctlsock, TEST_MSG, line, strlen(line), jsonSupport, JSON_SINGLE_VALUE);
}

/* TimestampsEnabled -> TimeStamps */
@@ -726,40 +728,40 @@
" failed to find TimeStamps bad type=%d", type);
} else {
snprintf(line, sizeof(line), "TimestampsEnabled: %"PRId32"\n", (val.sv32 == 1) ? 1 : 0);
- send_msg(ctlsock, TEST_MSG, line, strlen(line));
+ send_json_message(ctlsock, TEST_MSG, line, strlen(line), jsonSupport, JSON_SINGLE_VALUE);
}

/* PktsRetrans -> SegsRetrans */
print_10gvar_renamed("SegsRetrans", "PktsRetrans", snap, line,
- sizeof(line), ctlsock);
+ sizeof(line), ctlsock, jsonSupport);

/* DataPktsOut -> DataSegsOut */
print_10gvar_renamed("DataSegsOut", "DataPktsOut", snap, line,
- sizeof(line), ctlsock);
+ sizeof(line), ctlsock, jsonSupport);

/* MaxCwnd -> MAX(MaxSsCwnd, MaxCaCwnd) */
print_10gvar_renamed("MaxCwnd", "MaxCwnd", snap, line,
- sizeof(line), ctlsock);
+ sizeof(line), ctlsock, jsonSupport);

/* SndLimTimeSender -> SndLimTimeSnd */
print_10gvar_renamed("SndLimTimeSnd", "SndLimTimeSender", snap, line,
- sizeof(line), ctlsock);
+ sizeof(line), ctlsock, jsonSupport);

/* DataBytesOut -> DataOctetsOut */
print_10gvar_renamed("HCDataOctetsOut", "DataBytesOut", snap, line,
- sizeof(line), ctlsock);
+ sizeof(line), ctlsock, jsonSupport);

/* SndLimTransSender -> SndLimTransSnd */
print_10gvar_renamed("SndLimTransSnd", "SndLimTransSender", snap, line,
- sizeof(line), ctlsock);
+ sizeof(line), ctlsock, jsonSupport);

/* PktsOut -> SegsOut */
print_10gvar_renamed("SegsOut", "PktsOut", snap, line,
- sizeof(line), ctlsock);
+ sizeof(line), ctlsock, jsonSupport);

/* CongestionSignals -> CongSignals */
print_10gvar_renamed("CongSignals", "CongestionSignals", snap, line,
- sizeof(line), ctlsock);
+ sizeof(line), ctlsock, jsonSupport);

/* RcvWinScale -> Same as WinScaleSent if WinScaleSent != -1 */
type = web10g_find_val(snap, "WinScaleSent", &val);
@@ -771,17 +773,16 @@
snprintf(line, sizeof(line), "RcvWinScale: %u\n", 0);
else
snprintf(line, sizeof(line), "RcvWinScale: %d\n", val.sv32);
- send_msg(ctlsock, TEST_MSG, (const void *) line, strlen(line));
+ send_json_message(ctlsock, TEST_MSG, line, strlen(line), jsonSupport, JSON_SINGLE_VALUE);
}

/* X_Rcvbuf & X_Sndbuf */
snprintf(line, sizeof(line), "X_Rcvbuf: %d\n", X_RcvBuf);
- send_msg(ctlsock, TEST_MSG, (const void *) line, strlen(line));
+ send_json_message(ctlsock, TEST_MSG, line, strlen(line), jsonSupport, JSON_SINGLE_VALUE);
snprintf(line, sizeof(line), "X_Sndbuf: %d\n", X_SndBuf);
- send_msg(ctlsock, TEST_MSG, (const void *) line, strlen(line));
+ send_json_message(ctlsock, TEST_MSG, line, strlen(line), jsonSupport, JSON_SINGLE_VALUE);

- send_msg(ctlsock, TEST_MSG, (const void *)frame_web100,
- strlen(frame_web100));
+ send_json_message(ctlsock, TEST_MSG, frame_web100, strlen(frame_web100), jsonSupport, JSON_SINGLE_VALUE);

log_println(6, "S2C test - Send web100 data to client pid=%d", getpid());
return 0;
=======================================
--- /branches/Issue145/src/web100clt.c Wed May 14 06:39:08 2014 UTC
+++ /branches/Issue145/src/web100clt.c Fri May 16 08:01:58 2014 UTC
@@ -536,7 +536,7 @@
char *invalid_login_msg = "Invalid login message.";
// addresses..
I2Addr server_addr = NULL;
- char* ptr;
+ char* ptr, *jsonMsgValue;
#ifdef AF_INET6
#define GETOPT_LONG_INET6(x) "46"x
#else
@@ -683,7 +683,7 @@
buff[0] = tests;
strlcpy(buff + 1, VERSION, sizeof(buff) - 1);
/* write our test suite request by sending a login message */
- send_msg(ctlSocket, MSG_EXTENDED_LOGIN, buff, strlen(buff));
+ send_json_message(ctlSocket, MSG_EXTENDED_LOGIN, buff, strlen(buff), jsonSupport, JSON_SINGLE_VALUE);
/* read the specially crafted data that kicks off the old clients */
if (readn(ctlSocket, buff, 13) != 13) {
printf("Information: The server '%s' does not support this command line "
@@ -707,7 +707,7 @@
msgLen)) {
// Any other type of message at this stage is incorrect
// If received invalid login message error then try to connect using basic MSG_LOGIN msg
- if (!retry && strcmp(buff, invalid_login_msg) == 0) {
+ if (!retry) {
printf("Information: The server '%s' does not support MSG_EXTENDED_LOGIN message. "
"Trying to connect using MSG_LOGIN\n", host);
retry = 1; // to prevent infinite retrying to connect
@@ -744,11 +744,17 @@

exit(2);
}
+ buff[msgLen] = 0;
+ if (jsonSupport) {
+ jsonMsgValue = json_read_map_value(buff, DEFAULT_KEY);
+ strlcpy(buff, jsonMsgValue, sizeof(buff));
+ msgLen = strlen(buff);
+ free(jsonMsgValue);
+ }
if (msgLen <= 0) {
log_println(0, "Improper message");
exit(3);
}
- buff[msgLen] = 0;
if (check_int(buff, &xwait)) {
log_println(0, "Invalid queue indicator");
exit(4);
@@ -784,7 +790,7 @@
}
// Signal from the server to see if the client is still alive
if (xwait == SRV_QUEUE_HEARTBEAT) {
- send_msg(ctlSocket, MSG_WAITING, &tests, 1);
+ send_json_message(ctlSocket, MSG_WAITING, &tests, 1, jsonSupport, JSON_SINGLE_VALUE);
continue;
}

@@ -820,6 +826,13 @@
msgLen)) {
exit(2);
}
+ buff[msgLen] = 0;
+ if (jsonSupport) {
+ jsonMsgValue = json_read_map_value(buff, DEFAULT_KEY);
+ strlcpy(buff, jsonMsgValue, sizeof(buff));
+ msgLen = strlen(buff);
+ free(jsonMsgValue);
+ }
if (msgLen <= 0) {
log_println(0, "Improper message");
exit(3);
@@ -827,7 +840,6 @@

// Version compatibility between server-client must be verified

- buff[msgLen] = 0;
if (buff[0] != 'v') { // payload doesn't start with a version indicator
log_println(0, "Incompatible version number");
exit(4);
@@ -862,13 +874,19 @@
msgLen)) {
exit(2);
}
+ buff[msgLen] = 0;
+ if (jsonSupport) {
+ jsonMsgValue = json_read_map_value(buff, DEFAULT_KEY);
+ strlcpy(buff, jsonMsgValue, sizeof(buff));
+ msgLen = strlen(buff);
+ free(jsonMsgValue);
+ }
if (msgLen <= 0) {
log_println(0, "Improper message");
exit(3);
}

// get ids of tests to be run now
- buff[msgLen] = 0;
log_println(5, "Received tests sequence: '%s'", buff);
if ((strtokbuf = malloc(1024)) == NULL) {
log_println(0, "Malloc failed!");
@@ -949,7 +967,14 @@
exit(2);
}

- strlcat(resultstr, buff, sizeof(resultstr));
+ if (jsonSupport) {
+ jsonMsgValue = json_read_map_value(buff, DEFAULT_KEY);
+ strlcat(resultstr, jsonMsgValue, sizeof(resultstr));
+ free(jsonMsgValue);
+ }
+ else {
+ strlcat(resultstr, buff, sizeof(resultstr));
+ }
log_println(6, "resultstr = '%s'", resultstr);
}

=======================================
--- /branches/Issue145/src/web100srv.c Tue Apr 15 22:51:33 2014 UTC
+++ /branches/Issue145/src/web100srv.c Fri May 16 08:01:58 2014 UTC
@@ -86,6 +86,7 @@
#include "strlutils.h"
#include "heuristics.h"
#include "tests_srv.h"
+#include "jsonutils.h"

static char lgfn[FILENAME_SIZE]; // log file name
static char wvfn[FILENAME_SIZE]; // file name of web100-variables list
@@ -778,9 +779,10 @@
tmp_ptr->pid);

// send "keep-alive" SRV_QUEUE message to client and expect a response
- retcode = send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE,
+ retcode = send_json_message(tmp_ptr->ctlsockfd, SRV_QUEUE,
SRV_QUEUE_HEARTBEAT_STR,
- strlen(SRV_QUEUE_HEARTBEAT_STR));
+ strlen(SRV_QUEUE_HEARTBEAT_STR),
+ testopt.json_support, JSON_SINGLE_VALUE);
log_println(6,
"send_msg() returned %d during zombie check on client %d",
retcode, tmp_ptr->pid);
@@ -970,12 +972,13 @@

// client needs to be version compatible. Send current version
snprintf(buff, sizeof(buff), "v%s", VERSION "-" TCP_STAT_NAME);
- send_msg(ctlsockfd, MSG_LOGIN, buff, strlen(buff));
+ send_json_message(ctlsockfd, MSG_LOGIN, buff, strlen(buff), testopt->json_support, JSON_SINGLE_VALUE);

// initiate test with MSG_LOGIN message.
log_println(3, "run_test() routine, asking for test_suite = %s",
test_suite);
- send_msg(ctlsockfd, MSG_LOGIN, test_suite, strlen(test_suite));
+ send_json_message(ctlsockfd, MSG_LOGIN, test_suite, strlen(test_suite),
+ testopt->json_support, JSON_SINGLE_VALUE);
/* if ((n = initialize_tests(ctlsockfd, &testopt, conn_options))) {
log_println(0, "ERROR: Tests initialization failed (%d)", n);
return;
@@ -1220,38 +1223,38 @@
snprintf(buff, sizeof(buff), "c2sData: %d\nc2sAck: %d\ns2cData: %d\n"
"s2cAck: %d\n", c2s_linkspeed_data, c2s_linkspeed_ack,
s2c_linkspeed_data, s2c_linkspeed_ack);
- send_msg(ctlsockfd, MSG_RESULTS, buff, strlen(buff));
+ send_json_message(ctlsockfd, MSG_RESULTS, buff, strlen(buff), testopt->json_support, JSON_SINGLE_VALUE);

snprintf(buff, sizeof(buff),
"half_duplex: %d\nlink: %d\ncongestion: %d\nbad_cable: %d\n"
"mismatch: %d\nspd: %0.2f\n", half_duplex, link, congestion,
bad_cable, mismatch, realthruput);
- send_msg(ctlsockfd, MSG_RESULTS, buff, strlen(buff));
+ send_json_message(ctlsockfd, MSG_RESULTS, buff, strlen(buff), testopt->json_support, JSON_SINGLE_VALUE);

snprintf(buff, sizeof(buff),
"bw: %0.2f\nloss: %0.9f\navgrtt: %0.2f\nwaitsec: %0.2f\n"
"timesec: %0.2f\norder: %0.4f\n", bw_theortcl, packetloss_s2c,
avgrtt, waitsec, timesec, oo_order);
- send_msg(ctlsockfd, MSG_RESULTS, buff, strlen(buff));
+ send_json_message(ctlsockfd, MSG_RESULTS, buff, strlen(buff), testopt->json_support, JSON_SINGLE_VALUE);

snprintf(buff, sizeof(buff),
"rwintime: %0.4f\nsendtime: %0.4f\ncwndtime: %0.4f\n"
"rwin: %0.4f\nswin: %0.4f\n", rwintime, sendtime, cwndtime, rwin,
swin);
- send_msg(ctlsockfd, MSG_RESULTS, buff, strlen(buff));
+ send_json_message(ctlsockfd, MSG_RESULTS, buff, strlen(buff), testopt->json_support, JSON_SINGLE_VALUE);

snprintf(buff, sizeof(buff),
"cwin: %0.4f\nrttsec: %0.6f\nSndbuf: %"VARtype"\naspd: %0.5f\n"
"CWND-Limited: %0.2f\n", cwin, rttsec, vars.Sndbuf, aspd, s2c2spd);
- send_msg(ctlsockfd, MSG_RESULTS, buff, strlen(buff));
+ send_json_message(ctlsockfd, MSG_RESULTS, buff, strlen(buff), testopt->json_support, JSON_SINGLE_VALUE);

snprintf(buff, sizeof(buff),
"minCWNDpeak: %d\nmaxCWNDpeak: %d\nCWNDpeaks: %d\n",
peaks.min, peaks.max, peaks.amount);
- send_msg(ctlsockfd, MSG_RESULTS, buff, strlen(buff));
+ send_json_message(ctlsockfd, MSG_RESULTS, buff, strlen(buff), testopt->json_support, JSON_SINGLE_VALUE);

// Signal end of test results to client
- send_msg(ctlsockfd, MSG_LOGOUT, "", 0);
+ send_json_message(ctlsockfd, MSG_LOGOUT, "", 0, testopt->json_support, JSON_SINGLE_VALUE);

// Copy collected values into the meta data structures. This section
// seems most readable, easy to debug here.
@@ -1988,7 +1991,8 @@
if (tmp_ptr == NULL)
break;
if (i == (2 * max_clients)) {
- rac = send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE, "1", 1);
+ rac = send_json_message(tmp_ptr->ctlsockfd, SRV_QUEUE, "1", 1,
+ testopt.json_support, JSON_SINGLE_VALUE);
log_println(
6,
"sent 45 sec update message to client %d on fd=%d, "
@@ -1996,7 +2000,8 @@
tmp_ptr->pid, tmp_ptr->ctlsockfd, rac);
}
if (i == (3 * max_clients)) {
- rac = send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE, "2", 1);
+ rac = send_json_message(tmp_ptr->ctlsockfd, SRV_QUEUE, "2", 1,
+ testopt.json_support, JSON_SINGLE_VALUE);
log_println(
6,
"sent 90 sec update message to client %d on fd=%d, "
@@ -2018,9 +2023,10 @@
while (head_ptr != NULL) {
/* send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9933", 4); */
// indicate server waiting in queue
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
+ send_json_message(head_ptr->ctlsockfd, SRV_QUEUE,
SRV_QUEUE_SERVER_BUSY_STR,
- strlen(SRV_QUEUE_SERVER_BUSY_STR));
+ strlen(SRV_QUEUE_SERVER_BUSY_STR),
+ testopt.json_support, JSON_SINGLE_VALUE);
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2039,9 +2045,10 @@
"clients", head_ptr->pid);
while (head_ptr != NULL) {
/* send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9977", 4); */
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
+ send_json_message(head_ptr->ctlsockfd, SRV_QUEUE,
SRV_QUEUE_SERVER_BUSY_STR,
- strlen(SRV_QUEUE_SERVER_BUSY_STR));
+ strlen(SRV_QUEUE_SERVER_BUSY_STR),
+ testopt.json_support, JSON_SINGLE_VALUE);
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2075,9 +2082,10 @@
head_ptr->pipe, head_ptr->running, head_ptr->ctlsockfd,
head_ptr->oldclient, head_ptr->tests);
// boot the client
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
+ send_json_message(head_ptr->ctlsockfd, SRV_QUEUE,
SRV_QUEUE_SERVER_BUSY_STR,
- strlen(SRV_QUEUE_SERVER_BUSY_STR));
+ strlen(SRV_QUEUE_SERVER_BUSY_STR),
+ testopt.json_support, JSON_SINGLE_VALUE);
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2282,9 +2290,10 @@
0,
"Too many clients/mclients (%d) waiting to be served, "
"Please try again later.", chld_pid);
- send_msg(ctlsockfd, SRV_QUEUE,
+ send_json_message(ctlsockfd, SRV_QUEUE,
SRV_QUEUE_SERVER_BUSY_STR,
- strlen(SRV_QUEUE_SERVER_BUSY_STR));
+ strlen(SRV_QUEUE_SERVER_BUSY_STR),
+ testopt.json_support, JSON_SINGLE_VALUE);
close(chld_pipe[0]);
close(chld_pipe[1]);
shutdown(ctlsockfd, SHUT_WR);
@@ -2347,9 +2356,10 @@
3,
"queuing disabled and testing in progress, tell client no");
/* send_msg(new_child->ctlsockfd, SRV_QUEUE, "9944", 4); */
- send_msg(new_child->ctlsockfd, SRV_QUEUE,
+ send_json_message(new_child->ctlsockfd, SRV_QUEUE,
SRV_QUEUE_SERVER_BUSY_STR,
- strlen(SRV_QUEUE_SERVER_BUSY_STR));
+ strlen(SRV_QUEUE_SERVER_BUSY_STR),
+ testopt.json_support, JSON_SINGLE_VALUE);
close(chld_pipe[1]);
shutdown(new_child->ctlsockfd, SHUT_WR);
close(new_child->ctlsockfd);
@@ -2407,7 +2417,8 @@
"begin within %d minutes", (waiting - 1), tmp_ptr->pid,
(waiting-1));
snprintf(tmpstr, sizeof(tmpstr), "%d", (waiting-1));
- send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE, tmpstr, strlen(tmpstr));
+ send_json_message(tmp_ptr->ctlsockfd, SRV_QUEUE, tmpstr, strlen(tmpstr),
+ testopt.json_support, JSON_SINGLE_VALUE);
continue;
}

@@ -2417,7 +2428,8 @@
"will begin within %d minutes",
(waiting-max_clients), mchild->pid, xx);
snprintf(tmpstr, sizeof(tmpstr), "%d", xx);
- send_msg(mchild->ctlsockfd, SRV_QUEUE, tmpstr, strlen(tmpstr));
+ send_json_message(mchild->ctlsockfd, SRV_QUEUE, tmpstr, strlen(tmpstr),
+ testopt.json_support, JSON_SINGLE_VALUE);
continue;
}

@@ -2456,8 +2468,8 @@
(waiting-1), tmp_ptr->pid, (waiting-j));

snprintf(tmpstr, sizeof(tmpstr), "%d", (waiting-j));
- send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE, tmpstr,
- strlen(tmpstr));
+ send_json_message(tmp_ptr->ctlsockfd, SRV_QUEUE, tmpstr,
+ strlen(tmpstr), testopt.json_support, JSON_SINGLE_VALUE);
tmp_ptr = tmp_ptr->next;
j--;
}
@@ -2522,7 +2534,8 @@
log_println(5, "sending 'GO' signal to client msg='%s'",
tmpstr);
// test session starts now
- send_msg(mchild->ctlsockfd, SRV_QUEUE, "0", 1);
+ send_json_message(mchild->ctlsockfd, SRV_QUEUE, "0", 1,
+ testopt.json_support, JSON_SINGLE_VALUE);
for (i = 0; i < 5; i++) {
retcode = write(mchild->pipe, tmpstr, strlen(tmpstr));
log_println(6, "write(%d) returned %d, errno=%d",
@@ -2553,7 +2566,8 @@
head_ptr->tests);
log_println(5, "sending 'GO' signal to client msg='%s'",
tmpstr);
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "0", 1);
+ send_json_message(head_ptr->ctlsockfd, SRV_QUEUE, "0", 1,
+ testopt.json_support, JSON_SINGLE_VALUE);
for (i = 0; i < 5; i++) {
retcode = write(head_ptr->pipe, tmpstr, strlen(tmpstr));
if ((retcode == -1) && (errno == EINTR))
=======================================
--- /branches/Issue145/src/web100srv.h Tue May 13 13:52:22 2014 UTC
+++ /branches/Issue145/src/web100srv.h Fri May 16 08:01:58 2014 UTC
@@ -316,7 +316,7 @@
void tcp_stat_get_data_recv(int sock, tcp_stat_agent* agent,
tcp_stat_connection cn, int count_vars);
int tcp_stat_get_data(tcp_stat_snap* snap, int testsock, int ctlsock,
- tcp_stat_agent* agent, int count_vars);
+ tcp_stat_agent* agent, int count_vars, int jsonSupport);

int CwndDecrease(char* logname,
u_int32_t *dec_cnt, u_int32_t *same_cnt, u_int32_t *inc_cnt);


  • [ndt-dev] [ndt] r1055 committed - Changed remaining messages to use JSON format, ndt, 05/16/2014

Archive powered by MHonArc 2.6.16.

Top of Page