change context creation params to struct

*** This patch changes an API all apps use ***

Context creation parameters are getting a bit out of control, this
patch creates a struct to contain them.

All the test apps are updated accordingly.

Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/test-server/test-client.c b/test-server/test-client.c
index 5d55928..ab6f2f7 100644
--- a/test-server/test-client.c
+++ b/test-server/test-client.c
@@ -201,6 +201,9 @@
 	int ietf_version = -1; /* latest */
 	int mirror_lifetime = 0;
 	int longlived = 0;
+	struct lws_context_creation_info info;
+
+	memset(&info, 0, sizeof info);
 
 	fprintf(stderr, "libwebsockets test client\n"
 			"(C) Copyright 2010-2013 Andy Green <andy@warmcat.com> "
@@ -253,14 +256,15 @@
 	 * For this client-only demo, we tell it to not listen on any port.
 	 */
 
-	context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,
-				protocols,
+	info.port = CONTEXT_PORT_NO_LISTEN;
+	info.protocols = protocols;
 #ifndef LWS_NO_EXTENSIONS
-				libwebsocket_internal_extensions,
-#else
-				NULL,
+	info.extensions = libwebsocket_internal_extensions;
 #endif
-				NULL, NULL, NULL, -1, -1, 0, NULL);
+	info.gid = -1;
+	info.uid = -1;
+
+	context = libwebsocket_create_context(&info);
 	if (context == NULL) {
 		fprintf(stderr, "Creating libwebsocket context failed\n");
 		return 1;
diff --git a/test-server/test-echo.c b/test-server/test-echo.c
index 6f96f33..ec83de3 100644
--- a/test-server/test-echo.c
+++ b/test-server/test-echo.c
@@ -147,10 +147,6 @@
 int main(int argc, char **argv)
 {
 	int n = 0;
-	const char *cert_path =
-			    LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
-	const char *key_path =
-			LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem";
 	int port = 7681;
 	int use_ssl = 0;
 	struct libwebsocket_context *context;
@@ -160,6 +156,7 @@
 	int syslog_options = LOG_PID | LOG_PERROR;
 	int client = 0;
 	int listen_port;
+	struct lws_context_creation_info info;
 #ifndef LWS_NO_CLIENT
 	char address[256];
 	int rate_us = 250000;
@@ -172,6 +169,8 @@
 	int daemonize = 0;
 #endif
 
+	memset(&info, 0, sizeof info);
+
 #ifndef LWS_NO_CLIENT
 	lwsl_notice("Built to support client operations\n");
 #endif
@@ -254,9 +253,6 @@
 	lwsl_notice("libwebsockets echo test - "
 			"(C) Copyright 2010-2013 Andy Green <andy@warmcat.com> - "
 						    "licensed under LGPL2.1\n");
-	if (!use_ssl || client)
-		cert_path = key_path = NULL;
-
 #ifndef LWS_NO_CLIENT
 	if (client) {
 		lwsl_notice("Running in client mode\n");
@@ -272,13 +268,22 @@
 #ifndef LWS_NO_CLIENT
 	}
 #endif
-	context = libwebsocket_create_context(listen_port, interface, protocols,
+
+	info.port = listen_port;
+	info.interface = interface;
+	info.protocols = protocols;
 #ifndef LWS_NO_EXTENSIONS
-				libwebsocket_internal_extensions,
-#else
-				NULL,
+	info.extensions = libwebsocket_internal_extensions;
 #endif
-				cert_path, key_path, NULL, -1, -1, opts, NULL);
+	if (use_ssl && !client) {
+		info.ssl_cert_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
+		info.ssl_private_key_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem";
+	}
+	info.gid = -1;
+	info.uid = -1;
+	info.options = opts;
+
+	context = libwebsocket_create_context(&info);
 
 	if (context == NULL) {
 		lwsl_err("libwebsocket init failed\n");
diff --git a/test-server/test-fraggle.c b/test-server/test-fraggle.c
index f2c8d7c..cfd0f7a 100644
--- a/test-server/test-fraggle.c
+++ b/test-server/test-fraggle.c
@@ -239,10 +239,6 @@
 int main(int argc, char **argv)
 {
 	int n = 0;
-	const char *cert_path =
-			    LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
-	const char *key_path =
-			LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem";
 	int port = 7681;
 	int use_ssl = 0;
 	struct libwebsocket_context *context;
@@ -252,6 +248,9 @@
 	struct libwebsocket *wsi;
 	const char *address;
 	int server_port = port;
+	struct lws_context_creation_info info;
+
+	memset(&info, 0, sizeof info);
 
 	fprintf(stderr, "libwebsockets test fraggle\n"
 			"(C) Copyright 2010-2013 Andy Green <andy@warmcat.com> "
@@ -298,16 +297,21 @@
 		}
 	}
 
-	if (!use_ssl)
-		cert_path = key_path = NULL;
-
-	context = libwebsocket_create_context(server_port, interface, protocols,
+	info.port = server_port;
+	info.interface = interface;
+	info.protocols = protocols;
 #ifndef LWS_NO_EXTENSIONS
-				libwebsocket_internal_extensions,
-#else
-				NULL,
+	info.extensions = libwebsocket_internal_extensions;
 #endif
-				cert_path, key_path, NULL, -1, -1, opts, NULL);
+	if (use_ssl) {
+		info.ssl_cert_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
+		info.ssl_private_key_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem";
+	}
+	info.gid = -1;
+	info.uid = -1;
+	info.options = opts;
+
+	context = libwebsocket_create_context(&info);
 	if (context == NULL) {
 		fprintf(stderr, "libwebsocket init failed\n");
 		return -1;
diff --git a/test-server/test-ping.c b/test-server/test-ping.c
index ee390ce..b195280 100644
--- a/test-server/test-ping.c
+++ b/test-server/test-ping.c
@@ -333,6 +333,9 @@
 	unsigned long oldus = 0;
 	unsigned long l;
 	int ietf_version = -1;
+	struct lws_context_creation_info info;
+
+	memset(&info, 0, sizeof info);
 
 	if (argc < 2)
 		goto usage;
@@ -412,14 +415,15 @@
 				screen_width = w.ws_col;
 #endif
 
-	context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,
-					      protocols,
+	info.port = CONTEXT_PORT_NO_LISTEN;
+	info.protocols = protocols;
 #ifndef LWS_NO_EXTENSIONS
-				libwebsocket_internal_extensions,
-#else
-				NULL,
+	info.extensions = libwebsocket_internal_extensions;
 #endif
-					      NULL, NULL, NULL, -1, -1, 0, NULL);
+	info.gid = -1;
+	info.uid = -1;
+
+	context = libwebsocket_create_context(&info);
 	if (context == NULL) {
 		fprintf(stderr, "Creating libwebsocket context failed\n");
 		return 1;
diff --git a/test-server/test-server.c b/test-server/test-server.c
index 8969670..be01966 100644
--- a/test-server/test-server.c
+++ b/test-server/test-server.c
@@ -492,11 +492,6 @@
 int main(int argc, char **argv)
 {
 	int n = 0;
-	const char *cert_path =
-			    LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
-	const char *key_path =
-			LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem";
-	int port = 7681;
 	int use_ssl = 0;
 	struct libwebsocket_context *context;
 	int opts = 0;
@@ -506,12 +501,16 @@
 	int syslog_options = LOG_PID | LOG_PERROR;
 #endif
 	unsigned int oldus = 0;
+	struct lws_context_creation_info info;
 
 	int debug_level = 7;
 #ifndef LWS_NO_DAEMONIZE
 	int daemonize = 0;
 #endif
 
+	memset(&info, 0, sizeof info);
+	info.port = 7681;
+
 	while (n >= 0) {
 		n = getopt_long(argc, argv, "ci:hsp:d:D", options, NULL);
 		if (n < 0)
@@ -532,7 +531,7 @@
 			use_ssl = 1;
 			break;
 		case 'p':
-			port = atoi(optarg);
+			info.port = atoi(optarg);
 			break;
 		case 'i':
 			strncpy(interface_name, optarg, sizeof interface_name);
@@ -579,8 +578,6 @@
 	lwsl_notice("libwebsockets test server - "
 			"(C) Copyright 2010-2013 Andy Green <andy@warmcat.com> - "
 						    "licensed under LGPL2.1\n");
-	if (!use_ssl)
-		cert_path = key_path = NULL;
 #ifdef EXTERNAL_POLL
 	max_poll_elements = getdtablesize();
 	pollfds = malloc(max_poll_elements * sizeof (struct pollfd));
@@ -591,13 +588,23 @@
 	}
 #endif
 
-	context = libwebsocket_create_context(port, interface, protocols,
+	info.interface = interface;
+	info.protocols = protocols;
 #ifndef LWS_NO_EXTENSIONS
-				libwebsocket_internal_extensions,
-#else
-				NULL,
+	info.extensions = libwebsocket_internal_extensions;
 #endif
-				cert_path, key_path, NULL, -1, -1, opts, NULL);
+	if (!use_ssl) {
+		info.ssl_cert_filepath = NULL;
+		info.ssl_private_key_filepath = NULL;
+	} else {
+		info.ssl_cert_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
+		info.ssl_private_key_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem";
+	}
+	info.gid = -1;
+	info.uid = -1;
+	info.options = opts;
+
+	context = libwebsocket_create_context(&info);
 	if (context == NULL) {
 		lwsl_err("libwebsocket init failed\n");
 		return -1;