summaryrefslogtreecommitdiff
path: root/test-server/test-client.c
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2011-02-09 08:49:14 +0000
committerAndy Green <andy@linaro.org>2011-02-09 08:49:14 +0000
commitbfb051f3a35a4b83e30c9e37d7ce8b92ab564d9e (patch)
treeb1cd3a3592d04cd6bcc3eba8a2af70f200ab079e /test-server/test-client.c
parentf3d3b403640b04c81008cac5f46089e42d8e19d2 (diff)
introduce-ietf-05-framing-and-commandline-options.patch
This adds 05 support, and -v switches on test-client and test-ping to allow setting their ietf protocol version to 4 or 5. It also optimizes the masking to us a function pointer, which takes some conditionals out of the fast path. Signed-off-by: Andy Green <andy@warmcat.com>
Diffstat (limited to 'test-server/test-client.c')
-rw-r--r--test-server/test-client.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/test-server/test-client.c b/test-server/test-client.c
index 59595e0..3508a52 100644
--- a/test-server/test-client.c
+++ b/test-server/test-client.c
@@ -158,6 +158,7 @@ static struct option options[] = {
{ "port", required_argument, NULL, 'p' },
{ "ssl", no_argument, NULL, 's' },
{ "killmask", no_argument, NULL, 'k' },
+ { "version", required_argument, NULL, 'v' },
{ NULL, 0, 0, 0 }
};
@@ -171,6 +172,7 @@ int main(int argc, char **argv)
const char *address;
struct libwebsocket *wsi_dumb;
struct libwebsocket *wsi_mirror;
+ int ietf_version = -1; /* latest */
fprintf(stderr, "libwebsockets test client\n"
"(C) Copyright 2010 Andy Green <andy@warmcat.com> "
@@ -179,10 +181,8 @@ int main(int argc, char **argv)
if (argc < 2)
goto usage;
- optind++;
-
while (n >= 0) {
- n = getopt_long(argc, argv, "khsp:", options, NULL);
+ n = getopt_long(argc, argv, "v:khsp:", options, NULL);
if (n < 0)
continue;
switch (n) {
@@ -195,6 +195,9 @@ int main(int argc, char **argv)
case 'k':
opts = LWS_WRITE_CLIENT_IGNORE_XOR_MASK;
break;
+ case 'v':
+ ietf_version = atoi(optarg);
+ break;
case 'h':
goto usage;
}
@@ -225,7 +228,7 @@ int main(int argc, char **argv)
wsi_dumb = libwebsocket_client_connect(context, address, port, use_ssl,
"/", argv[optind], argv[optind],
- protocols[PROTOCOL_DUMB_INCREMENT].name);
+ protocols[PROTOCOL_DUMB_INCREMENT].name, ietf_version);
if (wsi_dumb == NULL) {
fprintf(stderr, "libwebsocket dumb connect failed\n");
@@ -236,7 +239,7 @@ int main(int argc, char **argv)
wsi_mirror = libwebsocket_client_connect(context, address, port,
use_ssl, "/", argv[optind], argv[optind],
- protocols[PROTOCOL_LWS_MIRROR].name);
+ protocols[PROTOCOL_LWS_MIRROR].name, ietf_version);
if (wsi_mirror == NULL) {
fprintf(stderr, "libwebsocket dumb connect failed\n");