api rationalization: eliminate all libwebsocket[s]_ prefixes

This nukes all the oldstyle prefixes except in the compatibility code.

struct libwebsockets becomes struct lws too.

The api docs are updated accordingly as are the READMEs that mention
those apis.

Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/lib/client-handshake.c b/lib/client-handshake.c
index 7c642eb..11dcc29 100644
--- a/lib/client-handshake.c
+++ b/lib/client-handshake.c
@@ -1,10 +1,10 @@
 #include "private-libwebsockets.h"
 
-struct libwebsocket *lws_client_connect_2(
-	struct libwebsocket_context *context,
-	struct libwebsocket *wsi
+struct lws *lws_client_connect_2(
+	struct lws_context *context,
+	struct lws *wsi
 ) {
-	struct libwebsocket_pollfd pfd;
+	struct lws_pollfd pfd;
 #ifdef LWS_USE_IPV6
 	struct sockaddr_in6 server_addr6;
 	struct sockaddr_in6 client_addr6;
@@ -333,8 +333,8 @@
  *	This function creates a connection to a remote server
  */
 
-LWS_VISIBLE struct libwebsocket *
-lws_client_connect(struct libwebsocket_context *context,
+LWS_VISIBLE struct lws *
+lws_client_connect(struct lws_context *context,
 			      const char *address,
 			      int port,
 			      int ssl_connection,
@@ -344,9 +344,9 @@
 			      const char *protocol,
 			      int ietf_version_or_minus_one)
 {
-	struct libwebsocket *wsi;
+	struct lws *wsi;
 
-	wsi = lws_zalloc(sizeof(struct libwebsocket));
+	wsi = lws_zalloc(sizeof(struct lws));
 	if (wsi == NULL)
 		goto bail;
 
@@ -458,8 +458,8 @@
  *	This function creates a connection to a remote server
  */
 
-LWS_VISIBLE struct libwebsocket *
-lws_client_connect_extended(struct libwebsocket_context *context,
+LWS_VISIBLE struct lws *
+lws_client_connect_extended(struct lws_context *context,
 			      const char *address,
 			      int port,
 			      int ssl_connection,
@@ -470,7 +470,7 @@
 			      int ietf_version_or_minus_one,
 			      void *userdata)
 {
-	struct libwebsocket *ws =
+	struct lws *ws =
 		lws_client_connect(context, address, port,
 			ssl_connection, path, host, origin, protocol,
 						     ietf_version_or_minus_one);
diff --git a/lib/client-parser.c b/lib/client-parser.c
index 0795926..7eaf220 100644
--- a/lib/client-parser.c
+++ b/lib/client-parser.c
@@ -21,7 +21,7 @@
 
 #include "private-libwebsockets.h"
 
-int lws_client_rx_sm(struct libwebsocket *wsi, unsigned char c)
+int lws_client_rx_sm(struct lws *wsi, unsigned char c)
 {
 	int callback_action = LWS_CALLBACK_CLIENT_RECEIVE;
 	int handled;
@@ -407,7 +407,7 @@
 		m = wsi->protocol->callback(
 			wsi->protocol->owning_server,
 			wsi,
-			(enum libwebsocket_callback_reasons)callback_action,
+			(enum lws_callback_reasons)callback_action,
 			wsi->user_space,
 			eff_buf.token,
 			eff_buf.token_len);
diff --git a/lib/client.c b/lib/client.c
index 293df31..895a523 100644
--- a/lib/client.c
+++ b/lib/client.c
@@ -21,7 +21,7 @@
 
 #include "private-libwebsockets.h"
 
-int lws_handshake_client(struct libwebsocket *wsi, unsigned char **buf, size_t len)
+int lws_handshake_client(struct lws *wsi, unsigned char **buf, size_t len)
 {
 	int n;
 
@@ -43,8 +43,8 @@
 	return 0;
 }
 
-int lws_client_socket_service(struct libwebsocket_context *context,
-		struct libwebsocket *wsi, struct libwebsocket_pollfd *pollfd)
+int lws_client_socket_service(struct lws_context *context,
+		struct lws *wsi, struct lws_pollfd *pollfd)
 {
 	int n;
 	char *p = (char *)&context->service_buffer[0];
@@ -492,8 +492,8 @@
 }
 
 int
-lws_client_interpret_server_handshake(struct libwebsocket_context *context,
-		struct libwebsocket *wsi)
+lws_client_interpret_server_handshake(struct lws_context *context,
+		struct lws *wsi)
 {
 	const char *pc;
 	int okay = 0;
@@ -502,7 +502,7 @@
 	int isErrorCodeReceived = 0;
 #ifndef LWS_NO_EXTENSIONS
 	char ext_name[128];
-	struct libwebsocket_extension *ext;
+	struct lws_extension *ext;
 	void *v;
 	int more = 1;
 	const char *c;
@@ -832,8 +832,8 @@
 
 
 char *
-lws_generate_client_handshake(struct libwebsocket_context *context,
-		struct libwebsocket *wsi, char *pkt)
+lws_generate_client_handshake(struct lws_context *context,
+		struct lws *wsi, char *pkt)
 {
 	char buf[128];
 	char hash[20];
@@ -841,7 +841,7 @@
 	char *p = pkt;
 	int n;
 #ifndef LWS_NO_EXTENSIONS
-	struct libwebsocket_extension *ext;
+	struct lws_extension *ext;
 	int ext_count = 0;
 #endif
 
diff --git a/lib/context.c b/lib/context.c
index 5ef85a2..8651d44 100644
--- a/lib/context.c
+++ b/lib/context.c
@@ -48,7 +48,7 @@
  *	This function creates the listening socket (if serving) and takes care
  *	of all initialization in one step.
  *
- *	After initialization, it returns a struct libwebsocket_context * that
+ *	After initialization, it returns a struct lws_context * that
  *	represents this server.  After calling, user code needs to take care
  *	of calling lws_service() with the context pointer to get the
  *	server's sockets serviced.  This must be done in the same process
@@ -71,10 +71,10 @@
  *	one place; they're all handled in the user callback.
  */
 
-LWS_VISIBLE struct libwebsocket_context *
+LWS_VISIBLE struct lws_context *
 lws_create_context(struct lws_context_creation_info *info)
 {
-	struct libwebsocket_context *context = NULL;
+	struct lws_context *context = NULL;
 	char *p;
 #if LWS_POSIX
 	int pid_daemon = get_daemonize_pid();
@@ -106,7 +106,7 @@
 	if (lws_plat_context_early_init())
 		return NULL;
 
-	context = lws_zalloc(sizeof(struct libwebsocket_context));
+	context = lws_zalloc(sizeof(struct lws_context));
 	if (!context) {
 		lwsl_err("No memory for websocket context\n");
 		return NULL;
@@ -149,16 +149,16 @@
 	/* to reduce this allocation, */
 	context->max_fds = getdtablesize();
 	lwsl_notice(" static allocation: %u + (%u x %u fds) = %u bytes\n",
-		sizeof(struct libwebsocket_context),
-		sizeof(struct libwebsocket_pollfd) +
-					sizeof(struct libwebsocket *),
+		sizeof(struct lws_context),
+		sizeof(struct lws_pollfd) +
+					sizeof(struct lws *),
 		context->max_fds,
-		sizeof(struct libwebsocket_context) +
-		((sizeof(struct libwebsocket_pollfd) +
-					sizeof(struct libwebsocket *)) *
+		sizeof(struct lws_context) +
+		((sizeof(struct lws_pollfd) +
+					sizeof(struct lws *)) *
 							     context->max_fds));
 
-	context->fds = lws_zalloc(sizeof(struct libwebsocket_pollfd) *
+	context->fds = lws_zalloc(sizeof(struct lws_pollfd) *
 				  context->max_fds);
 	if (context->fds == NULL) {
 		lwsl_err("Unable to allocate fds array for %d connections\n",
@@ -197,7 +197,7 @@
 
 	lwsl_notice(
 		" per-conn mem: %u + %u headers + protocol rx buf\n",
-				sizeof(struct libwebsocket),
+				sizeof(struct lws),
 					      sizeof(struct allocated_headers));
 
 	if (lws_context_init_server_ssl(info, context))
@@ -270,12 +270,12 @@
  *	undefined.
  */
 LWS_VISIBLE void
-lws_context_destroy(struct libwebsocket_context *context)
+lws_context_destroy(struct lws_context *context)
 {
 	/* Note that this is used for freeing partially allocated structs as well
 	 * so make sure you don't try to free something uninitialized */
 	int n;
-	struct libwebsocket_protocols *protocol = NULL;
+	struct lws_protocols *protocol = NULL;
 
 	lwsl_notice("%s\n", __func__);
 
@@ -288,7 +288,7 @@
 #endif
 
 	for (n = 0; n < context->fds_count; n++) {
-		struct libwebsocket *wsi =
+		struct lws *wsi =
 					wsi_from_fd(context, context->fds[n].fd);
 		if (!wsi)
 			continue;
diff --git a/lib/extension-deflate-frame.c b/lib/extension-deflate-frame.c
index 96285a9..87eac8b 100644
--- a/lib/extension-deflate-frame.c
+++ b/lib/extension-deflate-frame.c
@@ -8,10 +8,10 @@
 #define LWS_ZLIB_MEMLEVEL 8
 
 int lws_extension_callback_deflate_frame(
-		struct libwebsocket_context *context,
-		struct libwebsocket_extension *ext,
-		struct libwebsocket *wsi,
-		enum libwebsocket_extension_callback_reasons reason,
+		struct lws_context *context,
+		struct lws_extension *ext,
+		struct lws *wsi,
+		enum lws_extension_callback_reasons reason,
 		void *user, void *in, size_t len)
 {
 	struct lws_ext_deflate_frame_conn *conn =
diff --git a/lib/extension-deflate-frame.h b/lib/extension-deflate-frame.h
index 00a4447..5e5b3f1 100644
--- a/lib/extension-deflate-frame.h
+++ b/lib/extension-deflate-frame.h
@@ -18,8 +18,8 @@
 };
 
 extern int lws_extension_callback_deflate_frame(
-		struct libwebsocket_context *context,
-		struct libwebsocket_extension *ext,
-		struct libwebsocket *wsi,
-		enum libwebsocket_extension_callback_reasons reason,
+		struct lws_context *context,
+		struct lws_extension *ext,
+		struct lws *wsi,
+		enum lws_extension_callback_reasons reason,
 		void *user, void *in, size_t len);
diff --git a/lib/extension-deflate-stream.c b/lib/extension-deflate-stream.c
index addaa2c..f69b12b 100644
--- a/lib/extension-deflate-stream.c
+++ b/lib/extension-deflate-stream.c
@@ -8,10 +8,10 @@
 #define LWS_ZLIB_MEMLEVEL 8
 
 int lws_extension_callback_deflate_stream(
-		struct libwebsocket_context *context,
-		struct libwebsocket_extension *ext,
-		struct libwebsocket *wsi,
-			enum libwebsocket_extension_callback_reasons reason,
+		struct lws_context *context,
+		struct lws_extension *ext,
+		struct lws *wsi,
+			enum lws_extension_callback_reasons reason,
 					       void *user, void *in, size_t len)
 {
 	struct lws_ext_deflate_stream_conn *conn =
diff --git a/lib/extension-deflate-stream.h b/lib/extension-deflate-stream.h
index fcadc07..b417790 100644
--- a/lib/extension-deflate-stream.h
+++ b/lib/extension-deflate-stream.h
@@ -13,8 +13,8 @@
 };
 
 extern int lws_extension_callback_deflate_stream(
-		struct libwebsocket_context *context,
-		struct libwebsocket_extension *ext,
-		struct libwebsocket *wsi,
-		enum libwebsocket_extension_callback_reasons reason,
+		struct lws_context *context,
+		struct lws_extension *ext,
+		struct lws *wsi,
+		enum lws_extension_callback_reasons reason,
 					      void *user, void *in, size_t len);
diff --git a/lib/extension.c b/lib/extension.c
index 7451ba2..ad6a37e 100644
--- a/lib/extension.c
+++ b/lib/extension.c
@@ -3,7 +3,7 @@
 #include "extension-deflate-frame.h"
 #include "extension-deflate-stream.h"
 
-struct libwebsocket_extension libwebsocket_internal_extensions[] = {
+struct lws_extension lws_internal_extensions[] = {
 #ifdef LWS_EXT_DEFLATE_STREAM
 	{
 		"deflate-stream",
@@ -29,21 +29,21 @@
 
 LWS_VISIBLE void
 lws_context_init_extensions(struct lws_context_creation_info *info,
-				    struct libwebsocket_context *context)
+				    struct lws_context *context)
 {
 	context->extensions = info->extensions;
 	lwsl_info(" LWS_MAX_EXTENSIONS_ACTIVE: %u\n", LWS_MAX_EXTENSIONS_ACTIVE);
 }
 
-LWS_VISIBLE struct libwebsocket_extension *lws_get_internal_extensions()
+LWS_VISIBLE struct lws_extension *lws_get_internal_extensions()
 {
-	return libwebsocket_internal_extensions;
+	return lws_internal_extensions;
 }
 
 
 /* 0 = nobody had nonzero return, 1 = somebody had positive return, -1 = fail */
 
-int lws_ext_callback_for_each_active(struct libwebsocket *wsi, int reason,
+int lws_ext_callback_for_each_active(struct lws *wsi, int reason,
 				void *arg, int len)
 {
 	int n, m, handled = 0;
@@ -69,11 +69,11 @@
 }
 
 int lws_ext_callback_for_each_extension_type(
-		struct libwebsocket_context *context, struct libwebsocket *wsi,
+		struct lws_context *context, struct lws *wsi,
 				int reason, void *arg, int len)
 {
 	int n = 0, m, handled = 0;
-	struct libwebsocket_extension *ext = context->extensions;
+	struct lws_extension *ext = context->extensions;
 
 	while (ext && ext->callback && !handled) {
 		m = ext->callback(context, ext, wsi, reason,
@@ -95,7 +95,7 @@
 }
 
 int
-lws_issue_raw_ext_access(struct libwebsocket *wsi,
+lws_issue_raw_ext_access(struct lws *wsi,
 						 unsigned char *buf, size_t len)
 {
 	int ret;
@@ -185,9 +185,9 @@
 }
 
 int
-lws_any_extension_handled(struct libwebsocket_context *context,
-			  struct libwebsocket *wsi,
-			  enum libwebsocket_extension_callback_reasons r,
+lws_any_extension_handled(struct lws_context *context,
+			  struct lws *wsi,
+			  enum lws_extension_callback_reasons r,
 						       void *v, size_t len)
 {
 	int n;
diff --git a/lib/handshake.c b/lib/handshake.c
index 229fb8c..1c783a6 100644
--- a/lib/handshake.c
+++ b/lib/handshake.c
@@ -57,8 +57,8 @@
  */
 
 LWS_VISIBLE int
-lws_read(struct libwebsocket_context *context,
-		     struct libwebsocket *wsi, unsigned char *buf, size_t len)
+lws_read(struct lws_context *context,
+		     struct lws *wsi, unsigned char *buf, size_t len)
 {
 	size_t n;
 	int body_chunk_len;
diff --git a/lib/header.c b/lib/header.c
index d974737..8e985db 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -29,8 +29,8 @@
 	return (unsigned char *)set[token];
 }
 
-int lws_add_http_header_by_name(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+int lws_add_http_header_by_name(struct lws_context *context,
+			    struct lws *wsi,
 			    const unsigned char *name,
 			    const unsigned char *value,
 			    int length,
@@ -61,8 +61,8 @@
 	return 0;
 }
 
-int lws_finalize_http_header(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+int lws_finalize_http_header(struct lws_context *context,
+			    struct lws *wsi,
 			    unsigned char **p,
 			    unsigned char *end)
 {
@@ -80,8 +80,8 @@
 	return 0;
 }
 
-int lws_add_http_header_by_token(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+int lws_add_http_header_by_token(struct lws_context *context,
+			    struct lws *wsi,
 			    enum lws_token_indexes token,
 			    const unsigned char *value,
 			    int length,
@@ -99,8 +99,8 @@
 	return lws_add_http_header_by_name(context, wsi, name, value, length, p, end);
 }
 
-int lws_add_http_header_content_length(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+int lws_add_http_header_content_length(struct lws_context *context,
+			    struct lws *wsi,
 			    unsigned long content_length,
 			    unsigned char **p,
 			    unsigned char *end)
@@ -147,8 +147,8 @@
 	"HTTP Version Not Supported"
 };
 
-int lws_add_http_header_status(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+int lws_add_http_header_status(struct lws_context *context,
+			    struct lws *wsi,
 			    unsigned int code,
 			    unsigned char **p,
 			    unsigned char *end)
@@ -182,7 +182,7 @@
  *	consistently
  */
 LWS_VISIBLE int lws_return_http_status(
-		struct libwebsocket_context *context, struct libwebsocket *wsi,
+		struct lws_context *context, struct lws *wsi,
 				       unsigned int code, const char *html_body)
 {
 	int n, m;
diff --git a/lib/hpack.c b/lib/hpack.c
index 63c7595..4cadd39 100644
--- a/lib/hpack.c
+++ b/lib/hpack.c
@@ -189,13 +189,13 @@
 	return pos + (lextable[q] << 1);
 }
 
-static int lws_hpack_update_table_size(struct libwebsocket *wsi, int idx)
+static int lws_hpack_update_table_size(struct lws *wsi, int idx)
 {
 	lwsl_info("hpack set table size %d\n", idx);
 	return 0;
 }
 
-static int lws_frag_start(struct libwebsocket *wsi, int hdr_token_idx)
+static int lws_frag_start(struct lws *wsi, int hdr_token_idx)
 {
 	struct allocated_headers * ah = wsi->u.http2.http.ah;
 
@@ -214,7 +214,7 @@
 	return 0;
 }
 
-static int lws_frag_append(struct libwebsocket *wsi, unsigned char c)
+static int lws_frag_append(struct lws *wsi, unsigned char c)
 {
 	struct allocated_headers * ah = wsi->u.http2.http.ah;
 
@@ -224,7 +224,7 @@
 	return ah->pos >= sizeof(ah->data);
 }
 
-static int lws_frag_end(struct libwebsocket *wsi)
+static int lws_frag_end(struct lws *wsi)
 {
 	if (lws_frag_append(wsi, 0))
 		return 1;
@@ -233,7 +233,7 @@
 	return 0;
 }
 
-static void lws_dump_header(struct libwebsocket *wsi, int hdr)
+static void lws_dump_header(struct lws *wsi, int hdr)
 {
 	char s[200];
 	int len = lws_hdr_copy(wsi, s, sizeof(s) - 1, hdr);
@@ -241,7 +241,7 @@
 	lwsl_info("  hdr tok %d (%s) = '%s'\n", hdr, lws_token_to_string(hdr), s);
 }
 
-static int lws_token_from_index(struct libwebsocket *wsi, int index, char **arg, int *len)
+static int lws_token_from_index(struct lws *wsi, int index, char **arg, int *len)
 {
 	struct hpack_dynamic_table *dyn;
 	
@@ -269,7 +269,7 @@
 	return dyn->entries[index].token;
 }
 
-static int lws_hpack_add_dynamic_header(struct libwebsocket *wsi, int token, char *arg, int len)
+static int lws_hpack_add_dynamic_header(struct lws *wsi, int token, char *arg, int len)
 {
 	struct hpack_dynamic_table *dyn;
 	int ret = 1;
@@ -321,7 +321,7 @@
 	return ret;
 }
 
-static int lws_write_indexed_hdr(struct libwebsocket *wsi, int idx)
+static int lws_write_indexed_hdr(struct lws *wsi, int idx)
 {
 	const char *p;
 	int tok = lws_token_from_index(wsi, idx, NULL, 0);
@@ -345,8 +345,8 @@
 	return 0;
 }
 
-int lws_hpack_interpret(struct libwebsocket_context *context,
-			struct libwebsocket *wsi, unsigned char c)
+int lws_hpack_interpret(struct lws_context *context,
+			struct lws *wsi, unsigned char c)
 {
 	unsigned int prev;
 	unsigned char c1;
@@ -609,8 +609,8 @@
 	return 0;
 }
 
-int lws_add_http2_header_by_name(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+int lws_add_http2_header_by_name(struct lws_context *context,
+			    struct lws *wsi,
 			    const unsigned char *name,
 			    const unsigned char *value,
 			    int length,
@@ -647,8 +647,8 @@
 	return 0;
 }
 
-int lws_add_http2_header_by_token(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+int lws_add_http2_header_by_token(struct lws_context *context,
+			    struct lws *wsi,
 			    enum lws_token_indexes token,
 			    const unsigned char *value,
 			    int length,
@@ -664,8 +664,8 @@
 	return lws_add_http2_header_by_name(context, wsi, name, value, length, p, end);
 }
 
-int lws_add_http2_header_status(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+int lws_add_http2_header_status(struct lws_context *context,
+			    struct lws *wsi,
 			    unsigned int code,
 			    unsigned char **p,
 			    unsigned char *end)
diff --git a/lib/http2.c b/lib/http2.c
index b73d8bf..3b49c47 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -38,8 +38,8 @@
 	memcpy(settings, lws_http2_default_settings.setting, sizeof(*settings));
 }
 
-struct libwebsocket *
-lws_http2_wsi_from_id(struct libwebsocket *wsi, unsigned int sid)
+struct lws *
+lws_http2_wsi_from_id(struct lws *wsi, unsigned int sid)
 {
 	do {
 		if (wsi->u.http2.my_stream_id == sid)
@@ -51,10 +51,10 @@
 	return NULL;
 }
 
-struct libwebsocket *
-lws_create_server_child_wsi(struct libwebsocket_context *context, struct libwebsocket *parent_wsi, unsigned int sid)
+struct lws *
+lws_create_server_child_wsi(struct lws_context *context, struct lws *parent_wsi, unsigned int sid)
 {
-	struct libwebsocket *wsi = lws_create_new_server_wsi(context);
+	struct lws *wsi = lws_create_new_server_wsi(context);
 	
 	if (!wsi)
 		return NULL;
@@ -87,9 +87,9 @@
 	return wsi;
 }
 
-int lws_remove_server_child_wsi(struct libwebsocket_context *context, struct libwebsocket *wsi)
+int lws_remove_server_child_wsi(struct lws_context *context, struct lws *wsi)
 {
-	struct libwebsocket **w = &wsi->u.http2.parent_wsi;
+	struct lws **w = &wsi->u.http2.parent_wsi;
 	do {
 		if (*w == wsi) {
 			*w = wsi->u.http2.next_child_wsi;
@@ -132,7 +132,7 @@
 	return 0;
 }
 
-struct libwebsocket *lws_http2_get_network_wsi(struct libwebsocket *wsi)
+struct lws *lws_http2_get_network_wsi(struct lws *wsi)
 {
 	while (wsi->u.http2.parent_wsi)
 		wsi = wsi->u.http2.parent_wsi;
@@ -140,9 +140,9 @@
 	return wsi;
 }
 
-int lws_http2_frame_write(struct libwebsocket *wsi, int type, int flags, unsigned int sid, unsigned int len, unsigned char *buf)
+int lws_http2_frame_write(struct lws *wsi, int type, int flags, unsigned int sid, unsigned int len, unsigned char *buf)
 {
-	struct libwebsocket *wsi_eff = lws_http2_get_network_wsi(wsi);
+	struct lws *wsi_eff = lws_http2_get_network_wsi(wsi);
 	unsigned char *p = &buf[-LWS_HTTP2_FRAME_HEADER_LENGTH];
 	int n;
 
@@ -172,7 +172,7 @@
 	return n;
 }
 
-static void lws_http2_settings_write(struct libwebsocket *wsi, int n, unsigned char *buf)
+static void lws_http2_settings_write(struct lws *wsi, int n, unsigned char *buf)
 {
 	*buf++ = n >> 8;
 	*buf++ = n;
@@ -186,12 +186,12 @@
 	"PRI * HTTP/2.0\x0d\x0a\x0d\x0aSM\x0d\x0a\x0d\x0a";
 
 int
-lws_http2_parser(struct libwebsocket_context *context,
-		     struct libwebsocket *wsi, unsigned char c)
+lws_http2_parser(struct lws_context *context,
+		     struct lws *wsi, unsigned char c)
 {
-	struct libwebsocket *swsi;
+	struct lws *swsi;
 	int n;
-	//dstruct libwebsocket *wsi_new;
+	//dstruct lws *wsi_new;
 
 	switch (wsi->state) {
 	case WSI_STATE_HTTP2_AWAIT_CLIENT_PREFACE:
@@ -413,10 +413,10 @@
 	return 0;
 }
 
-int lws_http2_do_pps_send(struct libwebsocket_context *context, struct libwebsocket *wsi)
+int lws_http2_do_pps_send(struct lws_context *context, struct lws *wsi)
 {
 	unsigned char settings[LWS_SEND_BUFFER_PRE_PADDING + 6 * LWS_HTTP2_SETTINGS__COUNT];
-	struct libwebsocket *swsi;
+	struct lws *swsi;
 	int n, m = 0;
 
 	lwsl_debug("%s: %p: %d\n", __func__, wsi, wsi->pps);
@@ -497,7 +497,7 @@
 	return 0;
 }
 
-struct libwebsocket * lws_http2_get_nth_child(struct libwebsocket *wsi, int n)
+struct lws * lws_http2_get_nth_child(struct lws *wsi, int n)
 {
 	do {
 		wsi = wsi->u.http2.next_child_wsi;
diff --git a/lib/libev.c b/lib/libev.c
index 323e2aa..d6858e1 100644
--- a/lib/libev.c
+++ b/lib/libev.c
@@ -32,9 +32,9 @@
 static void 
 lws_accept_cb(struct ev_loop *loop, struct ev_io *watcher, int revents)
 {
-	struct libwebsocket_pollfd eventfd;
+	struct lws_pollfd eventfd;
 	struct lws_io_watcher *lws_io = container_of(watcher, struct lws_io_watcher, watcher);
-	struct libwebsocket_context *context = lws_io->context;
+	struct lws_context *context = lws_io->context;
 
 	if (revents & EV_ERROR)
 		return;
@@ -58,7 +58,7 @@
 }
 
 LWS_VISIBLE int lws_sigint_cfg(
-	struct libwebsocket_context *context,
+	struct lws_context *context,
 	int use_ev_sigint,
 	lws_ev_signal_cb* cb)
 {
@@ -74,7 +74,7 @@
 
 LWS_VISIBLE int
 lws_initloop(
-	struct libwebsocket_context *context,
+	struct lws_context *context,
 	struct ev_loop *loop)
 {
 	int status = 0;
@@ -133,8 +133,8 @@
 }
 
 LWS_VISIBLE void
-lws_libev_accept(struct libwebsocket_context *context,
-				 struct libwebsocket *new_wsi, int accept_fd)
+lws_libev_accept(struct lws_context *context,
+				 struct lws *new_wsi, int accept_fd)
 {
 	struct ev_io *r = &new_wsi->w_read.watcher;
 	struct ev_io *w = &new_wsi->w_write.watcher;
@@ -149,8 +149,8 @@
 }
 
 LWS_VISIBLE void
-lws_libev_io(struct libwebsocket_context *context,
-					 struct libwebsocket *wsi, int flags)
+lws_libev_io(struct lws_context *context,
+					 struct lws *wsi, int flags)
 {
 	if (!LWS_LIBEV_ENABLED(context))
 		return;
@@ -175,7 +175,7 @@
 }
 
 LWS_VISIBLE int
-lws_libev_init_fd_table(struct libwebsocket_context *context)
+lws_libev_init_fd_table(struct lws_context *context)
 {
 	if (!LWS_LIBEV_ENABLED(context))
 		return 0;
@@ -187,7 +187,7 @@
 }
 
 LWS_VISIBLE void
-lws_libev_run(struct libwebsocket_context *context)
+lws_libev_run(struct lws_context *context)
 {
 	if (context->io_loop && LWS_LIBEV_ENABLED(context))
 		ev_run(context->io_loop, 0);
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index fa1fc43..787c4a0 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -38,7 +38,7 @@
 };
 
 void
-lws_free_wsi(struct libwebsocket *wsi)
+lws_free_wsi(struct lws *wsi)
 {
 	if (!wsi)
 		return;
@@ -61,8 +61,8 @@
 }
 
 void
-lws_close_and_free_session(struct libwebsocket_context *context,
-			 struct libwebsocket *wsi, enum lws_close_status reason)
+lws_close_and_free_session(struct lws_context *context,
+			 struct lws *wsi, enum lws_close_status reason)
 {
 	int n, m, ret;
 	int old_state;
@@ -324,7 +324,7 @@
 }
 
 LWS_VISIBLE int
-lws_get_addresses(struct libwebsocket_context *context,
+lws_get_addresses(struct lws_context *context,
 			    void *ads, char *name, int name_len,
 			    char *rip, int rip_len)
 {
@@ -408,7 +408,7 @@
 /**
  * lws_get_peer_addresses() - Get client address information
  * @context:	Libwebsockets context
- * @wsi:	Local struct libwebsocket associated with
+ * @wsi:	Local struct lws associated with
  * @fd:		Connection socket descriptor
  * @name:	Buffer to take client address name
  * @name_len:	Length of client address name buffer
@@ -422,8 +422,8 @@
  */
 
 LWS_VISIBLE void
-lws_get_peer_addresses(struct libwebsocket_context *context,
-	struct libwebsocket *wsi, lws_sockfd_type fd, char *name, int name_len,
+lws_get_peer_addresses(struct lws_context *context,
+	struct lws *wsi, lws_sockfd_type fd, char *name, int name_len,
 					char *rip, int rip_len)
 {
 #if LWS_POSIX
@@ -481,7 +481,7 @@
  *	using globals statics in the user code.
  */
 LWS_EXTERN void *
-lws_context_user(struct libwebsocket_context *context)
+lws_context_user(struct lws_context *context)
 {
 	return context->user_space;
 }
@@ -497,11 +497,11 @@
 
 LWS_VISIBLE int
 lws_callback_all_protocol(
-		const struct libwebsocket_protocols *protocol, int reason)
+		const struct lws_protocols *protocol, int reason)
 {
-	struct libwebsocket_context *context = protocol->owning_server;
+	struct lws_context *context = protocol->owning_server;
 	int n;
-	struct libwebsocket *wsi;
+	struct lws *wsi;
 
 	for (n = 0; n < context->fds_count; n++) {
 		wsi = wsi_from_fd(context, context->fds[n].fd);
@@ -526,7 +526,7 @@
  */
 
 LWS_VISIBLE void
-lws_set_timeout(struct libwebsocket *wsi,
+lws_set_timeout(struct lws *wsi,
 					  enum pending_timeout reason, int secs)
 {
 	time_t now;
@@ -549,7 +549,7 @@
  */
 
 LWS_VISIBLE int
-lws_get_socket_fd(struct libwebsocket *wsi)
+lws_get_socket_fd(struct lws *wsi)
 {
 	return wsi->sock;
 }
@@ -558,7 +558,7 @@
 
 #ifdef LWS_LATENCY
 void
-lws_latency(struct libwebsocket_context *context, struct libwebsocket *wsi,
+lws_latency(struct lws_context *context, struct lws *wsi,
 				     const char *action, int ret, int completed)
 {
 	unsigned long long u;
@@ -611,7 +611,7 @@
  */
 
 LWS_VISIBLE int
-lws_rx_flow_control(struct libwebsocket *wsi, int enable)
+lws_rx_flow_control(struct lws *wsi, int enable)
 {
 	if (enable == (wsi->rxflow_change_to & LWS_RXFLOW_ALLOW))
 		return 0;
@@ -634,11 +634,11 @@
 
 LWS_VISIBLE void
 lws_rx_flow_allow_all_protocol(
-				const struct libwebsocket_protocols *protocol)
+				const struct lws_protocols *protocol)
 {
-	struct libwebsocket_context *context = protocol->owning_server;
+	struct lws_context *context = protocol->owning_server;
 	int n;
-	struct libwebsocket *wsi;
+	struct lws *wsi;
 
 	for (n = 0; n < context->fds_count; n++) {
 		wsi = wsi_from_fd(context, context->fds[n].fd);
@@ -660,15 +660,15 @@
  * @context:	Websocket context
  */
 LWS_VISIBLE extern const char *
-lws_canonical_hostname(struct libwebsocket_context *context)
+lws_canonical_hostname(struct lws_context *context)
 {
 	return (const char *)context->canonical_hostname;
 }
 
 int user_callback_handle_rxflow(callback_function callback_function,
-		struct libwebsocket_context *context,
-			struct libwebsocket *wsi,
-			 enum libwebsocket_callback_reasons reason, void *user,
+		struct lws_context *context,
+			struct lws *wsi,
+			 enum lws_callback_reasons reason, void *user,
 							  void *in, size_t len)
 {
 	int n;
@@ -682,8 +682,8 @@
 
 
 /**
- * lws_set_proxy() - Setups proxy to libwebsocket_context.
- * @context:	pointer to struct libwebsocket_context you want set proxy to
+ * lws_set_proxy() - Setups proxy to lws_context.
+ * @context:	pointer to struct lws_context you want set proxy to
  * @proxy: pointer to c string containing proxy in format address:port
  *
  * Returns 0 if proxy string was parsed and proxy was setup. 
@@ -693,14 +693,14 @@
  * environment variable (eg, OSX)
  *
  *   IMPORTANT! You should call this function right after creation of the
- *   libwebsocket_context and before call to connect. If you call this
+ *   lws_context and before call to connect. If you call this
  *   function after connect behavior is undefined.
- *   This function will override proxy settings made on libwebsocket_context
+ *   This function will override proxy settings made on lws_context
  *   creation with genenv() call.
  */
 
 LWS_VISIBLE int
-lws_set_proxy(struct libwebsocket_context *context, const char *proxy)
+lws_set_proxy(struct lws_context *context, const char *proxy)
 {
 	char *p;
 	char authstring[96];
@@ -763,26 +763,26 @@
  *	this is how you can get a pointer to the active protocol if needed.
  */
 
-LWS_VISIBLE const struct libwebsocket_protocols *
-lws_get_protocol(struct libwebsocket *wsi)
+LWS_VISIBLE const struct lws_protocols *
+lws_get_protocol(struct lws *wsi)
 {
 	return wsi->protocol;
 }
 
 LWS_VISIBLE int
-lws_is_final_fragment(struct libwebsocket *wsi)
+lws_is_final_fragment(struct lws *wsi)
 {
 	return wsi->u.ws.final;
 }
 
 LWS_VISIBLE unsigned char
-lws_get_reserved_bits(struct libwebsocket *wsi)
+lws_get_reserved_bits(struct lws *wsi)
 {
 	return wsi->u.ws.rsv;
 }
 
 int
-lws_ensure_user_space(struct libwebsocket *wsi)
+lws_ensure_user_space(struct lws *wsi)
 {
 	lwsl_info("%s: %p protocol %p\n", __func__, wsi, wsi->protocol);
 	if (!wsi->protocol)
@@ -870,7 +870,7 @@
  *	checked (appears for client wsi told to skip check on connection)
  */
 LWS_VISIBLE int
-lws_is_ssl(struct libwebsocket *wsi)
+lws_is_ssl(struct lws *wsi)
 {
 #ifdef LWS_OPENSSL_SUPPORT
 	return wsi->use_ssl;
@@ -898,13 +898,13 @@
  */
 
 LWS_VISIBLE int
-lws_partial_buffered(struct libwebsocket *wsi)
+lws_partial_buffered(struct lws *wsi)
 {
 	return !!wsi->truncated_send_len;	
 }
 
-void lws_set_protocol_write_pending(struct libwebsocket_context *context,
-				    struct libwebsocket *wsi,
+void lws_set_protocol_write_pending(struct lws_context *context,
+				    struct lws *wsi,
 				    enum lws_pending_protocol_send pend)
 {
 	lwsl_info("setting pps %d\n", pend);
@@ -917,7 +917,7 @@
 }
 
 LWS_VISIBLE size_t
-lws_get_peer_write_allowance(struct libwebsocket *wsi)
+lws_get_peer_write_allowance(struct lws *wsi)
 {
 #ifdef LWS_USE_HTTP2
 	/* only if we are using HTTP2 on this connection */
@@ -935,7 +935,7 @@
 }
 
 LWS_VISIBLE void
-lws_union_transition(struct libwebsocket *wsi, enum connection_mode mode)
+lws_union_transition(struct lws *wsi, enum connection_mode mode)
 {
 	memset(&wsi->u, 0, sizeof(wsi->u));
 	wsi->mode = mode;
@@ -959,8 +959,10 @@
  * libwebsockets.h will map them at compile time.
  */
 
+#undef libwebsocket
+
 #undef libwebsocket_create_context
-LWS_VISIBLE LWS_EXTERN struct libwebsocket_context *
+LWS_VISIBLE LWS_EXTERN struct lws_context *
 libwebsocket_create_context(struct lws_context_creation_info *info)
 {
 	return lws_create_context(info);
@@ -968,28 +970,28 @@
 
 #undef libwebsocket_set_proxy
 LWS_VISIBLE LWS_EXTERN int
-libwebsocket_set_proxy(struct libwebsocket_context *context, const char *proxy)
+libwebsocket_set_proxy(struct lws_context *context, const char *proxy)
 {
 	return lws_set_proxy(context, proxy);
 }
 
-#undef libwebsocket_context_destroy
+#undef lws_context_destroy
 LWS_VISIBLE LWS_EXTERN void
-libwebsocket_context_destroy(struct libwebsocket_context *context)
+libwebsocket_context_destroy(struct lws_context *context)
 {
 	lws_context_destroy(context);
 }
 
 #undef libwebsocket_service
 LWS_VISIBLE LWS_EXTERN int
-libwebsocket_service(struct libwebsocket_context *context, int timeout_ms)
+libwebsocket_service(struct lws_context *context, int timeout_ms)
 {
 	return lws_service(context, timeout_ms);
 }
 
 #undef libwebsocket_cancel_service
 LWS_VISIBLE LWS_EXTERN void
-libwebsocket_cancel_service(struct libwebsocket_context *context)
+libwebsocket_cancel_service(struct lws_context *context)
 {
 	lws_cancel_service(context);
 }
@@ -998,7 +1000,7 @@
 #undef libwebsocket_sigint_cfg
 LWS_VISIBLE LWS_EXTERN int
 libwebsocket_sigint_cfg(
-	struct libwebsocket_context *context,
+	struct lws_context *context,
 	int use_ev_sigint,
 	lws_ev_signal_cb* cb)
 {
@@ -1007,7 +1009,7 @@
 
 #undef libwebsocket_initloop
 LWS_VISIBLE LWS_EXTERN int
-libwebsocket_initloop(struct libwebsocket_context *context, struct ev_loop *loop)
+libwebsocket_initloop(struct lws_context *context, struct ev_loop *loop)
 {
 	return lws_initloop(context, loop);
 }
@@ -1023,22 +1025,22 @@
 
 #undef libwebsocket_service_fd
 LWS_VISIBLE LWS_EXTERN int
-libwebsocket_service_fd(struct libwebsocket_context *context,
-		struct libwebsocket_pollfd *pollfd)
+libwebsocket_service_fd(struct lws_context *context,
+		struct lws_pollfd *pollfd)
 {
 	return lws_service_fd(context, pollfd);
 }
 
-#undef libwebsocket_context_user
+#undef lws_context_user
 LWS_VISIBLE LWS_EXTERN void *
-libwebsocket_context_user(struct libwebsocket_context *context)
+libwebsocket_context_user(struct lws_context *context)
 {
 	return lws_context_user(context);
 }
 
 #undef libwebsocket_set_timeout
 LWS_VISIBLE LWS_EXTERN void
-libwebsocket_set_timeout(struct libwebsocket *wsi,
+libwebsocket_set_timeout(struct lws *wsi,
 					 enum pending_timeout reason, int secs)
 {
 	lws_set_timeout(wsi, reason, secs);
@@ -1046,7 +1048,7 @@
 
 #undef libwebsocket_write
 LWS_VISIBLE LWS_EXTERN int
-libwebsocket_write(struct libwebsocket *wsi, unsigned char *buf, size_t len,
+libwebsocket_write(struct lws *wsi, unsigned char *buf, size_t len,
 				     enum lws_write_protocol protocol)
 {
 	return lws_write(wsi, buf, len, protocol);
@@ -1054,16 +1056,16 @@
 
 #undef libwebsockets_serve_http_file_fragment
 LWS_VISIBLE LWS_EXTERN int
-libwebsockets_serve_http_file_fragment(struct libwebsocket_context *context,
-			struct libwebsocket *wsi)
+libwebsockets_serve_http_file_fragment(struct lws_context *context,
+			struct lws *wsi)
 {
 	return lws_serve_http_file_fragment(context, wsi);
 }
 
 #undef libwebsockets_serve_http_file
 LWS_VISIBLE LWS_EXTERN int
-libwebsockets_serve_http_file(struct libwebsocket_context *context,
-			struct libwebsocket *wsi, const char *file,
+libwebsockets_serve_http_file(struct lws_context *context,
+			struct lws *wsi, const char *file,
 			const char *content_type, const char *other_headers,
 			int other_headers_len)
 {
@@ -1074,16 +1076,16 @@
 #undef libwebsockets_return_http_status
 LWS_VISIBLE LWS_EXTERN int
 libwebsockets_return_http_status(
-		struct libwebsocket_context *context,
-			struct libwebsocket *wsi, unsigned int code,
+		struct lws_context *context,
+			struct lws *wsi, unsigned int code,
 							const char *html_body)
 {
 	return lws_return_http_status(context, wsi, code, html_body);
 }
 
 #undef libwebsockets_get_protocol
-LWS_VISIBLE LWS_EXTERN const struct libwebsocket_protocols *
-libwebsockets_get_protocol(struct libwebsocket *wsi)
+LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
+libwebsockets_get_protocol(struct lws *wsi)
 {
 	return lws_get_protocol(wsi);
 }
@@ -1091,15 +1093,15 @@
 #undef libwebsocket_callback_on_writable_all_protocol
 LWS_VISIBLE LWS_EXTERN int
 libwebsocket_callback_on_writable_all_protocol(
-				 const struct libwebsocket_protocols *protocol)
+				 const struct lws_protocols *protocol)
 {
 	return lws_callback_on_writable_all_protocol(protocol);
 }
 
 #undef libwebsocket_callback_on_writable
 LWS_VISIBLE LWS_EXTERN int
-libwebsocket_callback_on_writable(struct libwebsocket_context *context,
-						      struct libwebsocket *wsi)
+libwebsocket_callback_on_writable(struct lws_context *context,
+						      struct lws *wsi)
 {
 	return lws_callback_on_writable(context, wsi);
 }
@@ -1107,56 +1109,56 @@
 #undef libwebsocket_callback_all_protocol
 LWS_VISIBLE LWS_EXTERN int
 libwebsocket_callback_all_protocol(
-		const struct libwebsocket_protocols *protocol, int reason)
+		const struct lws_protocols *protocol, int reason)
 {
 	return lws_callback_all_protocol(protocol, reason);
 }
 
 #undef libwebsocket_get_socket_fd
 LWS_VISIBLE LWS_EXTERN int
-libwebsocket_get_socket_fd(struct libwebsocket *wsi)
+libwebsocket_get_socket_fd(struct lws *wsi)
 {
 	return lws_get_socket_fd(wsi);
 }
 
 #undef libwebsocket_is_final_fragment
 LWS_VISIBLE LWS_EXTERN int
-libwebsocket_is_final_fragment(struct libwebsocket *wsi)
+libwebsocket_is_final_fragment(struct lws *wsi)
 {
 	return lws_is_final_fragment(wsi);
 }
 
 #undef libwebsocket_get_reserved_bits
 LWS_VISIBLE LWS_EXTERN unsigned char
-libwebsocket_get_reserved_bits(struct libwebsocket *wsi)
+libwebsocket_get_reserved_bits(struct lws *wsi)
 {
 	return lws_get_reserved_bits(wsi);
 }
 
 #undef libwebsocket_rx_flow_control
 LWS_VISIBLE LWS_EXTERN int
-libwebsocket_rx_flow_control(struct libwebsocket *wsi, int enable)
+libwebsocket_rx_flow_control(struct lws *wsi, int enable)
 {
 	return lws_rx_flow_control(wsi, enable);
 }
 
 #undef libwebsocket_rx_flow_allow_all_protocol
 LWS_VISIBLE LWS_EXTERN void
-libwebsocket_rx_flow_allow_all_protocol(const struct libwebsocket_protocols *protocol)
+libwebsocket_rx_flow_allow_all_protocol(const struct lws_protocols *protocol)
 {
 	lws_rx_flow_allow_all_protocol(protocol);
 }
 
 #undef libwebsockets_remaining_packet_payload
 LWS_VISIBLE LWS_EXTERN size_t
-libwebsockets_remaining_packet_payload(struct libwebsocket *wsi)
+libwebsockets_remaining_packet_payload(struct lws *wsi)
 {
 	return lws_remaining_packet_payload(wsi);
 }
 
 #undef libwebsocket_client_connect
-LWS_VISIBLE LWS_EXTERN struct libwebsocket *
-libwebsocket_client_connect(struct libwebsocket_context *clients,
+LWS_VISIBLE LWS_EXTERN struct lws *
+libwebsocket_client_connect(struct lws_context *clients,
 			      const char *address,
 			      int port,
 			      int ssl_connection,
@@ -1169,8 +1171,8 @@
 	return lws_client_connect(clients, address, port, ssl_connection,
 			path, host, origin, protocol, ietf_version_or_minus_one);
 }
-LWS_VISIBLE LWS_EXTERN struct libwebsocket *
-libwebsocket_client_connect_extended(struct libwebsocket_context *clients,
+LWS_VISIBLE LWS_EXTERN struct lws *
+libwebsocket_client_connect_extended(struct lws_context *clients,
 			      const char *address,
 			      int port,
 			      int ssl_connection,
@@ -1187,15 +1189,15 @@
 
 #undef libwebsocket_canonical_hostname
 LWS_VISIBLE LWS_EXTERN const char *
-libwebsocket_canonical_hostname(struct libwebsocket_context *context)
+libwebsocket_canonical_hostname(struct lws_context *context)
 {
 	return lws_canonical_hostname(context);
 }
 
 #undef libwebsockets_get_peer_addresses
 LWS_VISIBLE LWS_EXTERN void
-libwebsockets_get_peer_addresses(struct libwebsocket_context *context,
-		struct libwebsocket *wsi, lws_sockfd_type fd, char *name,
+libwebsockets_get_peer_addresses(struct lws_context *context,
+		struct lws *wsi, lws_sockfd_type fd, char *name,
 		int name_len, char *rip, int rip_len)
 {
 	lws_get_peer_addresses(context, wsi, fd, name, name_len, rip, rip_len);
@@ -1203,7 +1205,7 @@
 
 #undef libwebsockets_get_random
 LWS_VISIBLE LWS_EXTERN int
-libwebsockets_get_random(struct libwebsocket_context *context, void *buf, int len)
+libwebsockets_get_random(struct lws_context *context, void *buf, int len)
 {
 	return lws_get_random(context, buf, len);
 }
@@ -1219,7 +1221,7 @@
 
 #undef libwebsocket_read
 LWS_VISIBLE LWS_EXTERN int
-libwebsocket_read(struct libwebsocket_context *context, struct libwebsocket *wsi,
+libwebsocket_read(struct lws_context *context, struct lws *wsi,
 	 unsigned char *buf, size_t len)
 {
 	return lws_read(context, wsi, buf, len);
@@ -1227,7 +1229,7 @@
 
 #ifndef LWS_NO_EXTENSIONS
 #undef libwebsocket_get_internal_extensions
-LWS_VISIBLE LWS_EXTERN struct libwebsocket_extension *
+LWS_VISIBLE LWS_EXTERN struct lws_extension *
 libwebsocket_get_internal_extensions()
 {
 	return lws_get_internal_extensions();
diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h
index 9697880..6b3112d 100644
--- a/lib/libwebsockets.h
+++ b/lib/libwebsockets.h
@@ -26,14 +26,14 @@
 
 #define libwebsocket_create_context lws_create_context
 #define libwebsocket_set_proxy lws_set_proxy
-#define libwebsocket_context_destroy lws_context_destroy
+#define lws_context_destroy lws_context_destroy
 #define libwebsocket_service lws_service
 #define libwebsocket_cancel_service lws_cancel_service
 #define libwebsocket_sigint_cfg lws_sigint_cfg
 #define libwebsocket_initloop lws_initloop
 #define libwebsocket_sigint_cb lws_sigint_cb
 #define libwebsocket_service_fd lws_service_fd
-#define libwebsocket_context_user lws_context_user
+#define lws_context_user lws_context_user
 #define libwebsocket_set_timeout lws_set_timeout
 #define libwebsocket_write lws_write
 #define libwebsockets_serve_http_file_fragment lws_serve_http_file_fragment
@@ -58,6 +58,13 @@
 #define libwebsocket_get_internal_extensions lws_get_internal_extensions
 #define libwebsocket_write_protocol lws_write_protocol
 
+#define libwebsocket_protocols lws_protocols
+#define libwebsocket_extension lws_extension
+#define libwebsocket_context lws_context
+#define libwebsocket_pollfd lws_pollfd
+#define lws_callback_reasons lws_callback_reasons
+#define libwebsocket lws
+
 #ifdef __cplusplus
 #include <cstddef>
 #include <cstdarg>
@@ -73,8 +80,8 @@
 }
 using namespace mbed::Sockets::v0;
 
-struct libwebsocket;
-struct libwebsocket_context;
+struct lws;
+struct lws_context;
 
 class lws_conn {
 	public:
@@ -87,19 +94,19 @@
 	}
 
 public:
-	void set_wsi(struct libwebsocket *_wsi) { wsi = _wsi; }
+	void set_wsi(struct lws *_wsi) { wsi = _wsi; }
 	int actual_onRX(Socket *s);
 	void onRX(Socket *s);
 	void onError(Socket *s, socket_error_t err);
 	void onDisconnect(TCPStream *s);
 	void onSent(Socket *s, uint16_t len);
-	void serialized_writeable(struct libwebsocket *wsi);
+	void serialized_writeable(struct lws *wsi);
 
 public:
 	TCPStream *ts;
 	
 public:
-	struct libwebsocket *wsi;
+	struct lws *wsi;
 	char buffer[BUFFER_SIZE];
 	char writeable;
 	char awaiting_on_writeable;
@@ -280,7 +287,7 @@
 
 #define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_ARG
 
-/* the struct libwebsocket_protocols has the id field present */
+/* the struct lws_protocols has the id field present */
 #define LWS_FEATURE_PROTOCOLS_HAS_ID_FIELD
 
 /* you can call lws_get_peer_write_allowance */
@@ -289,7 +296,7 @@
 /* extra parameter introduced in 917f43ab821 */
 #define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_LEN
 
-enum libwebsocket_context_options {
+enum lws_context_options {
 	LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT = 2,
 	LWS_SERVER_OPTION_SKIP_SERVER_CANONICAL_NAME = 4,
 	LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT = 8,
@@ -299,7 +306,7 @@
 	LWS_SERVER_OPTION_PEER_CERT_NOT_REQUIRED = 128,
 };
 
-enum libwebsocket_callback_reasons {
+enum lws_callback_reasons {
 	LWS_CALLBACK_ESTABLISHED,
 	LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
 	LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH,
@@ -349,12 +356,12 @@
 #if defined(_WIN32) && (_WIN32_WINNT < 0x0600)
 typedef SOCKET lws_sockfd_type;
 #define lws_sockfd_valid(sfd) (!!sfd)
-struct libwebsocket_pollfd {
+struct lws_pollfd {
 	lws_sockfd_type fd;
 	SHORT events;
 	SHORT revents;
 };
-WINSOCK_API_LINKAGE int WSAAPI WSAPoll(struct libwebsocket_pollfd fdArray[], ULONG fds, INT timeout);
+WINSOCK_API_LINKAGE int WSAAPI WSAPoll(struct lws_pollfd fdArray[], ULONG fds, INT timeout);
 #else
 
 #if defined(MBED_OPERATORS)
@@ -373,29 +380,29 @@
 #define POLLHUP         0x0010
 #define POLLNVAL        0x0020
 
-struct libwebsocket;
+struct lws;
 
 void * mbed3_create_tcp_stream_socket(void);
 void mbed3_delete_tcp_stream_socket(void *sockfd);
-void mbed3_tcp_stream_bind(void *sock, int port, struct libwebsocket *);
-void mbed3_tcp_stream_accept(void *sock, struct libwebsocket *);
+void mbed3_tcp_stream_bind(void *sock, int port, struct lws *);
+void mbed3_tcp_stream_accept(void *sock, struct lws *);
 #else
 typedef int lws_sockfd_type;
 #define lws_sockfd_valid(sfd) (sfd >= 0)
 #endif
 
-#define libwebsocket_pollfd pollfd
+#define lws_pollfd pollfd
 #endif
 
 // argument structure for all external poll related calls
 // passed in via 'in'
-struct libwebsocket_pollargs {
+struct lws_pollargs {
     lws_sockfd_type fd;            // applicable file descriptor
     int events;        // the new event mask
     int prev_events;   // the previous event mask
 };
 
-enum libwebsocket_extension_callback_reasons {
+enum lws_extension_callback_reasons {
 	LWS_EXT_CALLBACK_SERVER_CONTEXT_CONSTRUCT,
 	LWS_EXT_CALLBACK_CLIENT_CONTEXT_CONSTRUCT,
 	LWS_EXT_CALLBACK_SERVER_CONTEXT_DESTRUCT,
@@ -714,10 +721,10 @@
 	HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED,
 };
 
-struct libwebsocket;
-struct libwebsocket_context;
+struct lws;
+struct lws_context;
 /* needed even with extensions disabled for create context */
-struct libwebsocket_extension;
+struct lws_extension;
 
 /**
  * callback_function() - User server actions
@@ -733,7 +740,7 @@
  *
  *	For each connection / session there is user data allocated that is
  *	pointed to by "user".  You set the size of this user data area when
- *	the library is initialized with libwebsocket_create_server.
+ *	the library is initialized with lws_create_server.
  *
  *	You get an opportunity to initialize user data when called back with
  *	LWS_CALLBACK_ESTABLISHED reason.
@@ -956,7 +963,7 @@
  *	will be integrating libwebsockets sockets into an external polling
  *	array.
  *
- *	For these calls, @in points to a struct libwebsocket_pollargs that
+ *	For these calls, @in points to a struct lws_pollargs that
  *	contains @fd, @events and @prev_events members
  *
  *	LWS_CALLBACK_ADD_POLL_FD: libwebsocket deals with its poll() loop
@@ -969,7 +976,7 @@
  *		serving case.
  *		This callback happens when a socket needs to be
  *		added to the polling loop: @in points to a struct
- *		libwebsocket_pollargs; the @fd member of the struct is the file
+ *		lws_pollargs; the @fd member of the struct is the file
  *		descriptor, and @events contains the active events.
  *
  *		If you are using the internal polling loop (the "service"
@@ -977,13 +984,13 @@
  *
  *	LWS_CALLBACK_DEL_POLL_FD: This callback happens when a socket descriptor
  *		needs to be removed from an external polling array.  @in is
- *		again the struct libwebsocket_pollargs containing the @fd member
+ *		again the struct lws_pollargs containing the @fd member
  *		to be removed.  If you are using the internal polling
  *		loop, you can just ignore it.
  *
  *	LWS_CALLBACK_CHANGE_MODE_POLL_FD: This callback happens when
  *		libwebsockets wants to modify the events for a connectiion.
- *		@in is the struct libwebsocket_pollargs with the @fd to change.
+ *		@in is the struct lws_pollargs with the @fd to change.
  *		The new event mask is in @events member and the old mask is in
  *		the @prev_events member.
  *		If you are using the internal polling loop, you can just ignore
@@ -1002,14 +1009,14 @@
  *		wsi lifecycle changes if it acquires the same lock for the
  *		duration of wsi dereference from the other thread context.
  */
-LWS_VISIBLE LWS_EXTERN int callback(struct libwebsocket_context *context,
-			struct libwebsocket *wsi,
-			 enum libwebsocket_callback_reasons reason, void *user,
+LWS_VISIBLE LWS_EXTERN int callback(struct lws_context *context,
+			struct lws *wsi,
+			 enum lws_callback_reasons reason, void *user,
 							  void *in, size_t len);
 
-typedef int (callback_function)(struct libwebsocket_context *context,
-			struct libwebsocket *wsi,
-			 enum libwebsocket_callback_reasons reason, void *user,
+typedef int (callback_function)(struct lws_context *context,
+			struct lws *wsi,
+			 enum lws_callback_reasons reason, void *user,
 							  void *in, size_t len);
 
 #ifndef LWS_NO_EXTENSIONS
@@ -1071,21 +1078,21 @@
  *		buffer safely, it should copy the data into its own buffer and
  *		set the lws_tokens token pointer to it.
  */
-LWS_VISIBLE LWS_EXTERN int extension_callback(struct libwebsocket_context *context,
-			struct libwebsocket_extension *ext,
-			struct libwebsocket *wsi,
-			enum libwebsocket_extension_callback_reasons reason,
+LWS_VISIBLE LWS_EXTERN int extension_callback(struct lws_context *context,
+			struct lws_extension *ext,
+			struct lws *wsi,
+			enum lws_extension_callback_reasons reason,
 			void *user, void *in, size_t len);
 
-typedef int (extension_callback_function)(struct libwebsocket_context *context,
-			struct libwebsocket_extension *ext,
-			struct libwebsocket *wsi,
-			enum libwebsocket_extension_callback_reasons reason,
+typedef int (extension_callback_function)(struct lws_context *context,
+			struct lws_extension *ext,
+			struct lws *wsi,
+			enum lws_extension_callback_reasons reason,
 			void *user, void *in, size_t len);
 #endif
 
 /**
- * struct libwebsocket_protocols -	List of protocols and handlers server
+ * struct lws_protocols -	List of protocols and handlers server
  *					supports.
  * @name:	Protocol name that must match the one given in the client
  *		Javascript new WebSocket(url, 'protocol') name.
@@ -1119,7 +1126,7 @@
  * @protocol_index: which protocol we are starting from zero
  *
  *	This structure represents one protocol supported by the server.  An
- *	array of these structures is passed to libwebsocket_create_server()
+ *	array of these structures is passed to lws_create_server()
  *	allows as many protocols as you like to be handled by one server.
  *
  *	The first protocol given has its callback used for user callbacks when
@@ -1127,7 +1134,7 @@
  *	connection and true if the client did not send a Protocol: header.
  */
 
-struct libwebsocket_protocols {
+struct lws_protocols {
 	const char *name;
 	callback_function *callback;
 	size_t per_session_data_size;
@@ -1140,13 +1147,13 @@
 	 * no need for user to use them directly either
 	 */
 
-	struct libwebsocket_context *owning_server;
+	struct lws_context *owning_server;
 	int protocol_index;
 };
 
 #ifndef LWS_NO_EXTENSIONS
 /**
- * struct libwebsocket_extension -	An extension we know how to cope with
+ * struct lws_extension -	An extension we know how to cope with
  *
  * @name:			Formal extension name, eg, "deflate-stream"
  * @callback:			Service callback
@@ -1158,7 +1165,7 @@
  *				all sessions, etc, if it wants
  */
 
-struct libwebsocket_extension {
+struct lws_extension {
 	const char *name;
 	extension_callback_function *callback;
 	size_t per_session_data_size;
@@ -1179,7 +1186,7 @@
  *		specific callback for each one.  The list is ended with an
  *		entry that has a NULL callback pointer.
  *		It's not const because we write the owning_server member
- * @extensions: NULL or array of libwebsocket_extension structs listing the
+ * @extensions: NULL or array of lws_extension structs listing the
  *		extensions this context supports.  If you configured with
  *		--without-extensions, you should give NULL here.
  * @token_limits: NULL or struct lws_token_limits pointer which is initialized
@@ -1220,8 +1227,8 @@
 struct lws_context_creation_info {
 	int port;
 	const char *iface;
-	struct libwebsocket_protocols *protocols;
-	struct libwebsocket_extension *extensions;
+	struct lws_protocols *protocols;
+	struct lws_extension *extensions;
 	struct lws_token_limits *token_limits;
 	const char *ssl_private_key_password;
 	const char *ssl_cert_filepath;
@@ -1251,72 +1258,72 @@
 LWS_VISIBLE LWS_EXTERN void
 lwsl_emit_syslog(int level, const char *line);
 
-LWS_VISIBLE LWS_EXTERN struct libwebsocket_context *
+LWS_VISIBLE LWS_EXTERN struct lws_context *
 lws_create_context(struct lws_context_creation_info *info);
 	
 LWS_VISIBLE LWS_EXTERN int
-lws_set_proxy(struct libwebsocket_context *context, const char *proxy);
+lws_set_proxy(struct lws_context *context, const char *proxy);
 
 LWS_VISIBLE LWS_EXTERN void
-lws_context_destroy(struct libwebsocket_context *context);
+lws_context_destroy(struct lws_context *context);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_service(struct libwebsocket_context *context, int timeout_ms);
+lws_service(struct lws_context *context, int timeout_ms);
 
 LWS_VISIBLE LWS_EXTERN void
-lws_cancel_service(struct libwebsocket_context *context);
+lws_cancel_service(struct lws_context *context);
 
 LWS_VISIBLE LWS_EXTERN const unsigned char *
 lws_token_to_string(enum lws_token_indexes token);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_add_http_header_by_name(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+lws_add_http_header_by_name(struct lws_context *context,
+			    struct lws *wsi,
 			    const unsigned char *name,
 			    const unsigned char *value,
 			    int length,
 			    unsigned char **p,
 			    unsigned char *end);
 LWS_VISIBLE LWS_EXTERN int 
-lws_finalize_http_header(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+lws_finalize_http_header(struct lws_context *context,
+			    struct lws *wsi,
 			    unsigned char **p,
 			    unsigned char *end);
 LWS_VISIBLE LWS_EXTERN int
-lws_add_http_header_by_token(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+lws_add_http_header_by_token(struct lws_context *context,
+			    struct lws *wsi,
 			    enum lws_token_indexes token,
 			    const unsigned char *value,
 			    int length,
 			    unsigned char **p,
 			    unsigned char *end);
 LWS_VISIBLE LWS_EXTERN int
-lws_add_http_header_content_length(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+lws_add_http_header_content_length(struct lws_context *context,
+			    struct lws *wsi,
 			    unsigned long content_length,
 			    unsigned char **p,
 			    unsigned char *end);
 LWS_VISIBLE LWS_EXTERN int
-lws_add_http_header_status(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+lws_add_http_header_status(struct lws_context *context,
+			    struct lws *wsi,
 			    unsigned int code,
 			    unsigned char **p,
 			    unsigned char *end);
 
-LWS_EXTERN int lws_http_transaction_completed(struct libwebsocket *wsi);
+LWS_EXTERN int lws_http_transaction_completed(struct lws *wsi);
 
 #ifdef LWS_USE_LIBEV
 typedef void (lws_ev_signal_cb)(EV_P_ struct ev_signal *w, int revents);
 
 LWS_VISIBLE LWS_EXTERN int
 lws_sigint_cfg(
-	struct libwebsocket_context *context,
+	struct lws_context *context,
 	int use_ev_sigint,
 	lws_ev_signal_cb* cb);
 
 LWS_VISIBLE LWS_EXTERN int
 lws_initloop(
-	struct libwebsocket_context *context, struct ev_loop *loop);
+	struct lws_context *context, struct ev_loop *loop);
 
 LWS_VISIBLE void
 lws_sigint_cb(
@@ -1324,11 +1331,11 @@
 #endif /* LWS_USE_LIBEV */
 
 LWS_VISIBLE LWS_EXTERN int
-lws_service_fd(struct libwebsocket_context *context,
-		struct libwebsocket_pollfd *pollfd);
+lws_service_fd(struct lws_context *context,
+		struct lws_pollfd *pollfd);
 
 LWS_VISIBLE LWS_EXTERN void *
-lws_context_user(struct libwebsocket_context *context);
+lws_context_user(struct lws_context *context);
 
 enum pending_timeout {
 	NO_PENDING_TIMEOUT = 0,
@@ -1347,7 +1354,7 @@
 };
 
 LWS_VISIBLE LWS_EXTERN void
-lws_set_timeout(struct libwebsocket *wsi,
+lws_set_timeout(struct lws *wsi,
 					 enum pending_timeout reason, int secs);
 
 /*
@@ -1408,7 +1415,7 @@
 #define LWS_SEND_BUFFER_POST_PADDING 4
 
 LWS_VISIBLE LWS_EXTERN int
-lws_write(struct libwebsocket *wsi, unsigned char *buf, size_t len,
+lws_write(struct lws *wsi, unsigned char *buf, size_t len,
 				     enum lws_write_protocol protocol);
 
 /* helper for case where buffer may be const */
@@ -1416,51 +1423,48 @@
 	lws_write(wsi, (unsigned char *)(buf), len, LWS_WRITE_HTTP)
 
 LWS_VISIBLE LWS_EXTERN int
-lws_serve_http_file(struct libwebsocket_context *context,
-			struct libwebsocket *wsi, const char *file,
+lws_serve_http_file(struct lws_context *context,
+			struct lws *wsi, const char *file,
 			const char *content_type, const char *other_headers,
 			int other_headers_len);
 LWS_VISIBLE LWS_EXTERN int
-lws_serve_http_file_fragment(struct libwebsocket_context *context,
-			struct libwebsocket *wsi);
-
-LWS_VISIBLE LWS_EXTERN int lws_return_http_status(
-		struct libwebsocket_context *context,
-			struct libwebsocket *wsi, unsigned int code,
-							const char *html_body);
-
-LWS_VISIBLE LWS_EXTERN const struct libwebsocket_protocols *
-lws_get_protocol(struct libwebsocket *wsi);
+lws_serve_http_file_fragment(struct lws_context *context,
+			struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_callback_on_writable(struct libwebsocket_context *context,
-						      struct libwebsocket *wsi);
+lws_return_http_status(struct lws_context *context,
+		       struct lws *wsi, unsigned int code,
+		       const char *html_body);
+
+LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
+lws_get_protocol(struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_callback_on_writable_all_protocol(
-				 const struct libwebsocket_protocols *protocol);
+lws_callback_on_writable(struct lws_context *context, struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_callback_all_protocol(
-		const struct libwebsocket_protocols *protocol, int reason);
+lws_callback_on_writable_all_protocol(const struct lws_protocols *protocol);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_get_socket_fd(struct libwebsocket *wsi);
+lws_callback_all_protocol(const struct lws_protocols *protocol, int reason);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_is_final_fragment(struct libwebsocket *wsi);
+lws_get_socket_fd(struct lws *wsi);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_is_final_fragment(struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN unsigned char
-lws_get_reserved_bits(struct libwebsocket *wsi);
+lws_get_reserved_bits(struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_rx_flow_control(struct libwebsocket *wsi, int enable);
+lws_rx_flow_control(struct lws *wsi, int enable);
 
 LWS_VISIBLE LWS_EXTERN void
-lws_rx_flow_allow_all_protocol(const struct libwebsocket_protocols *protocol);
+lws_rx_flow_allow_all_protocol(const struct lws_protocols *protocol);
 
 LWS_VISIBLE LWS_EXTERN size_t
-lws_remaining_packet_payload(struct libwebsocket *wsi);
+lws_remaining_packet_payload(struct lws *wsi);
 
 /*
  * if the protocol does not have any guidance, returns -1.  Currently only
@@ -1479,10 +1483,10 @@
  * intermediary dynamically.
  */
 LWS_VISIBLE LWS_EXTERN size_t
-lws_get_peer_write_allowance(struct libwebsocket *wsi);
+lws_get_peer_write_allowance(struct lws *wsi);
 
-LWS_VISIBLE LWS_EXTERN struct libwebsocket *
-lws_client_connect(struct libwebsocket_context *clients,
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_client_connect(struct lws_context *clients,
 			      const char *address,
 			      int port,
 			      int ssl_connection,
@@ -1492,8 +1496,8 @@
 			      const char *protocol,
 			      int ietf_version_or_minus_one);
 
-LWS_VISIBLE LWS_EXTERN struct libwebsocket *
-lws_client_connect_extended(struct libwebsocket_context *clients,
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_client_connect_extended(struct lws_context *clients,
 			      const char *address,
 			      int port,
 			      int ssl_connection,
@@ -1505,32 +1509,32 @@
 			      void *userdata);
 
 LWS_VISIBLE LWS_EXTERN const char *
-lws_canonical_hostname(struct libwebsocket_context *context);
+lws_canonical_hostname(struct lws_context *context);
 
 
 LWS_VISIBLE LWS_EXTERN void
-lws_get_peer_addresses(struct libwebsocket_context *context,
-		struct libwebsocket *wsi, lws_sockfd_type fd,
+lws_get_peer_addresses(struct lws_context *context,
+		struct lws *wsi, lws_sockfd_type fd,
 		char *name, int name_len,
 		char *rip, int rip_len);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_get_random(struct libwebsocket_context *context, void *buf, int len);
+lws_get_random(struct lws_context *context, void *buf, int len);
 
 LWS_VISIBLE LWS_EXTERN int
 lws_daemonize(const char *_lock_path);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_send_pipe_choked(struct libwebsocket *wsi);
+lws_send_pipe_choked(struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_partial_buffered(struct libwebsocket *wsi);
+lws_partial_buffered(struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_frame_is_binary(struct libwebsocket *wsi);
+lws_frame_is_binary(struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_is_ssl(struct libwebsocket *wsi);
+lws_is_ssl(struct lws *wsi);
 #ifdef LWS_SHA1_USE_OPENSSL_NAME
 #define lws_SHA1 SHA1
 #else
@@ -1550,10 +1554,10 @@
 /* access to headers... only valid while headers valid */
 
 LWS_VISIBLE LWS_EXTERN int
-lws_hdr_total_length(struct libwebsocket *wsi, enum lws_token_indexes h);
+lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_hdr_copy(struct libwebsocket *wsi, char *dest, int len,
+lws_hdr_copy(struct lws *wsi, char *dest, int len,
 						enum lws_token_indexes h);
 
 /*
@@ -1562,12 +1566,11 @@
  */
 
 LWS_VISIBLE LWS_EXTERN int
-lws_read(struct libwebsocket_context *context,
-				struct libwebsocket *wsi,
-					       unsigned char *buf, size_t len);
+lws_read(struct lws_context *context, struct lws *wsi,
+	 unsigned char *buf, size_t len);
 
 #ifndef LWS_NO_EXTENSIONS
-LWS_VISIBLE LWS_EXTERN struct libwebsocket_extension *lws_get_internal_extensions();
+LWS_VISIBLE LWS_EXTERN struct lws_extension *lws_get_internal_extensions();
 #endif
 
 /*
diff --git a/lib/lws-plat-mbed3.c b/lib/lws-plat-mbed3.c
index de5956f..06d3ca8 100644
--- a/lib/lws-plat-mbed3.c
+++ b/lib/lws-plat-mbed3.c
@@ -12,7 +12,7 @@
 	return 0;
 }
 
-LWS_VISIBLE int lws_get_random(struct libwebsocket_context *context,
+LWS_VISIBLE int lws_get_random(struct lws_context *context,
 							     void *buf, int len)
 {
 	(void)context;
@@ -38,10 +38,10 @@
  * get their turn at the network device.
  */
 
-LWS_VISIBLE int lws_send_pipe_choked(struct libwebsocket *wsi)
+LWS_VISIBLE int lws_send_pipe_choked(struct lws *wsi)
 {
 #if 0
-	struct libwebsocket_pollfd fds;
+	struct lws_pollfd fds;
 
 	/* treat the fact we got a truncated send pending as if we're choked */
 	if (wsi->truncated_send_len)
@@ -64,7 +64,7 @@
 }
 
 LWS_VISIBLE int
-lws_poll_listen_fd(struct libwebsocket_pollfd *fd)
+lws_poll_listen_fd(struct lws_pollfd *fd)
 {
 	(void)fd;
 	return -1;
@@ -81,7 +81,7 @@
  *	it.
  */
 LWS_VISIBLE void
-lws_cancel_service(struct libwebsocket_context *context)
+lws_cancel_service(struct lws_context *context)
 {
 	(void)context;
 }
@@ -92,7 +92,7 @@
 }
 
 LWS_VISIBLE int
-lws_plat_set_socket_options(struct libwebsocket_context *context, lws_sockfd_type fd)
+lws_plat_set_socket_options(struct lws_context *context, lws_sockfd_type fd)
 {
 	(void)context;
 	(void)fd;
@@ -106,14 +106,14 @@
 }
 
 LWS_VISIBLE int
-lws_plat_init_lookup(struct libwebsocket_context *context)
+lws_plat_init_lookup(struct lws_context *context)
 {
 	(void)context;
 	return 0;
 }
 
 LWS_VISIBLE int
-lws_plat_init_fd_tables(struct libwebsocket_context *context)
+lws_plat_init_fd_tables(struct lws_context *context)
 {
 	(void)context;
 	return 0;
@@ -127,20 +127,20 @@
 }
 
 LWS_VISIBLE void
-lws_plat_context_early_destroy(struct libwebsocket_context *context)
+lws_plat_context_early_destroy(struct lws_context *context)
 {
 	(void)context;
 }
 
 LWS_VISIBLE void
-lws_plat_context_late_destroy(struct libwebsocket_context *context)
+lws_plat_context_late_destroy(struct lws_context *context)
 {
 	(void)context;
 }
 
 
 LWS_VISIBLE void
-lws_plat_service_periodic(struct libwebsocket_context *context)
+lws_plat_service_periodic(struct lws_context *context)
 {
 	(void)context;
 }
@@ -164,7 +164,7 @@
 }
 
 LWS_VISIBLE int
-insert_wsi(struct libwebsocket_context *context, struct libwebsocket *wsi)
+insert_wsi(struct lws_context *context, struct lws *wsi)
 {
 	(void)context;
 	(void)wsi;
@@ -173,7 +173,7 @@
 }
 
 LWS_VISIBLE int
-delete_from_fd(struct libwebsocket_context *context, lws_sockfd_type fd)
+delete_from_fd(struct lws_context *context, lws_sockfd_type fd)
 {
 	(void)context;
 	(void)fd;
diff --git a/lib/lws-plat-mbed3.cpp b/lib/lws-plat-mbed3.cpp
index 7d5ddc2..a96cbb7 100644
--- a/lib/lws-plat-mbed3.cpp
+++ b/lib/lws-plat-mbed3.cpp
@@ -21,10 +21,10 @@
 	delete conn;
 }
 
-void lws_conn::serialized_writeable(struct libwebsocket *_wsi)
+void lws_conn::serialized_writeable(struct lws *_wsi)
 {
-	struct libwebsocket *wsi = (struct libwebsocket *)_wsi;
-	struct libwebsocket_pollfd pollfd;
+	struct lws *wsi = (struct lws *)_wsi;
+	struct lws_pollfd pollfd;
 	lws_conn *conn = (lws_conn *)wsi->sock;
 	
 	conn->awaiting_on_writeable = 0;
@@ -38,7 +38,7 @@
 	lws_service_fd(wsi->protocol->owning_server, &pollfd);
 }
 
-extern "C" void mbed3_tcp_stream_bind(void *sock, int port, struct libwebsocket *wsi)
+extern "C" void mbed3_tcp_stream_bind(void *sock, int port, struct lws *wsi)
 {
 	lws_conn_listener *srv = (lws_conn_listener *)sock;
 	
@@ -50,7 +50,7 @@
 	minar::Scheduler::postCallback(fp.bind(port));
 }
 
-extern "C" void mbed3_tcp_stream_accept(void *sock, struct libwebsocket *wsi)
+extern "C" void mbed3_tcp_stream_accept(void *sock, struct lws *wsi)
 {
 	lws_conn *conn = (lws_conn *)sock;
 
@@ -59,8 +59,8 @@
 }
 
 extern "C" LWS_VISIBLE int
-lws_plat_change_pollfd(struct libwebsocket_context *context,
-		      struct libwebsocket *wsi, struct libwebsocket_pollfd *pfd)
+lws_plat_change_pollfd(struct lws_context *context,
+		      struct lws *wsi, struct lws_pollfd *pfd)
 {
 	lws_conn *conn = (lws_conn *)wsi->sock;
 	
@@ -68,7 +68,7 @@
 	if (pfd->events & POLLOUT) {
 		conn->awaiting_on_writeable = 1;
 		if (conn->writeable) {
- 			mbed::util::FunctionPointer1<void, struct libwebsocket *> book(conn, &lws_conn::serialized_writeable);
+ 			mbed::util::FunctionPointer1<void, struct lws *> book(conn, &lws_conn::serialized_writeable);
 			minar::Scheduler::postCallback(book.bind(wsi));
 			lwsl_debug("%s: wsi %p (booked callback)\r\n", __func__, (void *)wsi);
 		} else {
@@ -82,8 +82,8 @@
 }
 
 extern "C" LWS_VISIBLE int
-lws_ssl_capable_read_no_ssl(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi, unsigned char *buf, int len)
+lws_ssl_capable_read_no_ssl(struct lws_context *context,
+			    struct lws *wsi, unsigned char *buf, int len)
 {
 	socket_error_t err;
 	size_t _len = len;
@@ -110,7 +110,7 @@
 }
 
 extern "C" LWS_VISIBLE int
-lws_ssl_capable_write_no_ssl(struct libwebsocket *wsi, unsigned char *buf, int len)
+lws_ssl_capable_write_no_ssl(struct lws *wsi, unsigned char *buf, int len)
 {
 	socket_error_t err;
 	lws_conn *conn = (lws_conn *)wsi->sock;
@@ -159,7 +159,7 @@
 
 int lws_conn::actual_onRX(Socket *s)
 {
-	struct libwebsocket_pollfd pollfd;
+	struct lws_pollfd pollfd;
 	
 	(void)s;
 
@@ -215,8 +215,8 @@
 	lwsl_debug("%s: exit\n", __func__);
 }
 
-extern "C" LWS_VISIBLE struct libwebsocket *
-wsi_from_fd(struct libwebsocket_context *context, lws_sockfd_type fd)
+extern "C" LWS_VISIBLE struct lws *
+wsi_from_fd(struct lws_context *context, lws_sockfd_type fd)
 {
 	lws_conn *conn = (lws_conn *)fd;
 	(void)context;
@@ -225,8 +225,8 @@
 }
 
 extern "C" LWS_VISIBLE void
-lws_plat_insert_socket_into_fds(struct libwebsocket_context *context,
-						       struct libwebsocket *wsi)
+lws_plat_insert_socket_into_fds(struct lws_context *context,
+						       struct lws *wsi)
 {
 	(void)wsi;
 	lws_libev_io(context, wsi, LWS_EV_START | LWS_EV_READ);
@@ -234,8 +234,8 @@
 }
 
 extern "C" LWS_VISIBLE void
-lws_plat_delete_socket_from_fds(struct libwebsocket_context *context,
-						struct libwebsocket *wsi, int m)
+lws_plat_delete_socket_from_fds(struct lws_context *context,
+						struct lws *wsi, int m)
 {
 	(void)context;
 	(void)wsi;
@@ -256,7 +256,7 @@
 }
 
 extern "C" LWS_VISIBLE int
-lws_plat_service(struct libwebsocket_context *context, int timeout_ms)
+lws_plat_service(struct lws_context *context, int timeout_ms)
 {
 	(void)context;
 	(void)timeout_ms;
@@ -266,7 +266,7 @@
 
 void lws_conn::onSent(Socket *s, uint16_t len)
 {
-	struct libwebsocket_pollfd pollfd;
+	struct lws_pollfd pollfd;
 
 	(void)s;
 	(void)len;
diff --git a/lib/lws-plat-unix.c b/lib/lws-plat-unix.c
index 720e3d0..a087439 100644
--- a/lib/lws-plat-unix.c
+++ b/lib/lws-plat-unix.c
@@ -14,15 +14,15 @@
 	return ((unsigned long long)tv.tv_sec * 1000000LL) + tv.tv_usec;
 }
 
-LWS_VISIBLE int lws_get_random(struct libwebsocket_context *context,
+LWS_VISIBLE int lws_get_random(struct lws_context *context,
 							     void *buf, int len)
 {
 	return read(context->fd_random, (char *)buf, len);
 }
 
-LWS_VISIBLE int lws_send_pipe_choked(struct libwebsocket *wsi)
+LWS_VISIBLE int lws_send_pipe_choked(struct lws *wsi)
 {
-	struct libwebsocket_pollfd fds;
+	struct lws_pollfd fds;
 
 	/* treat the fact we got a truncated send pending as if we're choked */
 	if (wsi->truncated_send_len)
@@ -44,7 +44,7 @@
 }
 
 LWS_VISIBLE int
-lws_poll_listen_fd(struct libwebsocket_pollfd *fd)
+lws_poll_listen_fd(struct lws_pollfd *fd)
 {
 	return poll(fd, 1, 0);
 }
@@ -65,7 +65,7 @@
  *	immediately return.
  */
 LWS_VISIBLE void
-lws_cancel_service(struct libwebsocket_context *context)
+lws_cancel_service(struct lws_context *context)
 {
 	char buf = 0;
 
@@ -95,13 +95,13 @@
 }
 
 LWS_VISIBLE int
-lws_plat_service(struct libwebsocket_context *context, int timeout_ms)
+lws_plat_service(struct lws_context *context, int timeout_ms)
 {
 	int n;
 	int m;
 	char buf;
 #ifdef LWS_OPENSSL_SUPPORT
-	struct libwebsocket *wsi, *wsi_next;
+	struct lws *wsi, *wsi_next;
 #endif
 
 	/* stay dead once we are dead */
@@ -188,7 +188,7 @@
 }
 
 LWS_VISIBLE int
-lws_plat_set_socket_options(struct libwebsocket_context *context, int fd)
+lws_plat_set_socket_options(struct lws_context *context, int fd)
 {
 	int optval = 1;
 	socklen_t optlen = sizeof(optval);
@@ -272,9 +272,9 @@
 }
 
 LWS_VISIBLE int
-lws_plat_init_lookup(struct libwebsocket_context *context)
+lws_plat_init_lookup(struct lws_context *context)
 {
-	context->lws_lookup = lws_zalloc(sizeof(struct libwebsocket *) * context->max_fds);
+	context->lws_lookup = lws_zalloc(sizeof(struct lws *) * context->max_fds);
 	if (context->lws_lookup == NULL) {
 		lwsl_err(
 		  "Unable to allocate lws_lookup array for %d connections\n",
@@ -286,7 +286,7 @@
 }
 
 LWS_VISIBLE int
-lws_plat_init_fd_tables(struct libwebsocket_context *context)
+lws_plat_init_fd_tables(struct lws_context *context)
 {
 	context->fd_random = open(SYSTEM_RANDOM_FILEPATH, O_RDONLY);
 	if (context->fd_random < 0) {
@@ -335,12 +335,12 @@
 }
 
 LWS_VISIBLE void
-lws_plat_context_early_destroy(struct libwebsocket_context *context)
+lws_plat_context_early_destroy(struct lws_context *context)
 {
 }
 
 LWS_VISIBLE void
-lws_plat_context_late_destroy(struct libwebsocket_context *context)
+lws_plat_context_late_destroy(struct lws_context *context)
 {
 	if (context->lws_lookup)
 		lws_free(context->lws_lookup);
@@ -353,7 +353,7 @@
 /* cast a struct sockaddr_in6 * into addr for ipv6 */
 
 LWS_VISIBLE int
-interface_to_sa(struct libwebsocket_context *context,
+interface_to_sa(struct lws_context *context,
 		const char *ifname, struct sockaddr_in *addr, size_t addrlen)
 {
 	int rc = -1;
@@ -422,21 +422,21 @@
 }
 
 LWS_VISIBLE void
-lws_plat_insert_socket_into_fds(struct libwebsocket_context *context,
-						       struct libwebsocket *wsi)
+lws_plat_insert_socket_into_fds(struct lws_context *context,
+						       struct lws *wsi)
 {
 	lws_libev_io(context, wsi, LWS_EV_START | LWS_EV_READ);
 	context->fds[context->fds_count++].revents = 0;
 }
 
 LWS_VISIBLE void
-lws_plat_delete_socket_from_fds(struct libwebsocket_context *context,
-						struct libwebsocket *wsi, int m)
+lws_plat_delete_socket_from_fds(struct lws_context *context,
+						struct lws *wsi, int m)
 {
 }
 
 LWS_VISIBLE void
-lws_plat_service_periodic(struct libwebsocket_context *context)
+lws_plat_service_periodic(struct lws_context *context)
 {
 	/* if our parent went down, don't linger around */
 	if (context->started_with_parent &&
@@ -445,8 +445,8 @@
 }
 
 LWS_VISIBLE int
-lws_plat_change_pollfd(struct libwebsocket_context *context,
-		      struct libwebsocket *wsi, struct libwebsocket_pollfd *pfd)
+lws_plat_change_pollfd(struct lws_context *context,
+		      struct lws *wsi, struct lws_pollfd *pfd)
 {
 	return 0;
 }
diff --git a/lib/lws-plat-win.c b/lib/lws-plat-win.c
index 0610beb..9ed6528 100644
--- a/lib/lws-plat-win.c
+++ b/lib/lws-plat-win.c
@@ -35,8 +35,8 @@
 
 /* file descriptor hash management */
 
-struct libwebsocket *
-wsi_from_fd(struct libwebsocket_context *context, int fd)
+struct lws *
+wsi_from_fd(struct lws_context *context, int fd)
 {
 	int h = LWS_FD_HASH(fd);
 	int n = 0;
@@ -49,7 +49,7 @@
 }
 
 int
-insert_wsi(struct libwebsocket_context *context, struct libwebsocket *wsi)
+insert_wsi(struct lws_context *context, struct lws *wsi)
 {
 	int h = LWS_FD_HASH(wsi->sock);
 
@@ -64,7 +64,7 @@
 }
 
 int
-delete_from_fd(struct libwebsocket_context *context, int fd)
+delete_from_fd(struct lws_context *context, int fd)
 {
 	int h = LWS_FD_HASH(fd);
 	int n = 0;
@@ -86,7 +86,7 @@
 	return 1;
 }
 
-LWS_VISIBLE int lws_get_random(struct libwebsocket_context *context,
+LWS_VISIBLE int lws_get_random(struct lws_context *context,
 							     void *buf, int len)
 {
 	int n;
@@ -98,12 +98,12 @@
 	return n;
 }
 
-LWS_VISIBLE int lws_send_pipe_choked(struct libwebsocket *wsi)
+LWS_VISIBLE int lws_send_pipe_choked(struct lws *wsi)
 {
 	return wsi->sock_send_blocking;
 }
 
-LWS_VISIBLE int lws_poll_listen_fd(struct libwebsocket_pollfd *fd)
+LWS_VISIBLE int lws_poll_listen_fd(struct lws_pollfd *fd)
 {
 	fd_set readfds;
 	struct timeval tv = { 0, 0 };
@@ -124,7 +124,7 @@
  *	immediately return.
  */
 LWS_VISIBLE void
-lws_cancel_service(struct libwebsocket_context *context)
+lws_cancel_service(struct lws_context *context)
 {
 	WSASetEvent(context->events[0]);
 }
@@ -135,14 +135,14 @@
 }
 
 LWS_VISIBLE int
-lws_plat_service(struct libwebsocket_context *context, int timeout_ms)
+lws_plat_service(struct lws_context *context, int timeout_ms)
 {
 	int n;
 	int i;
 	DWORD ev;
 	WSANETWORKEVENTS networkevents;
-	struct libwebsocket_pollfd *pfd;
-	struct libwebsocket *wsi;
+	struct lws_pollfd *pfd;
+	struct lws *wsi;
 
 	/* stay dead once we are dead */
 
@@ -207,7 +207,7 @@
 }
 
 LWS_VISIBLE int
-lws_plat_set_socket_options(struct libwebsocket_context *context, int fd)
+lws_plat_set_socket_options(struct lws_context *context, int fd)
 {
 	int optval = 1;
 	int optlen = sizeof(optval);
@@ -254,12 +254,12 @@
 }
 
 LWS_VISIBLE int
-lws_plat_init_lookup(struct libwebsocket_context *context)
+lws_plat_init_lookup(struct lws_context *context)
 {
 	int i;
 
 	for (i = 0; i < FD_HASHTABLE_MODULUS; i++) {
-		context->fd_hashtable[i].wsi = lws_zalloc(sizeof(struct libwebsocket*) * context->max_fds);
+		context->fd_hashtable[i].wsi = lws_zalloc(sizeof(struct lws*) * context->max_fds);
 
 		if (!context->fd_hashtable[i].wsi) {
 			return -1;
@@ -270,7 +270,7 @@
 }
 
 LWS_VISIBLE int
-lws_plat_init_fd_tables(struct libwebsocket_context *context)
+lws_plat_init_fd_tables(struct lws_context *context)
 {
 	context->events = lws_malloc(sizeof(WSAEVENT) * (context->max_fds + 1));
 	if (context->events == NULL) {
@@ -310,7 +310,7 @@
 }
 
 LWS_VISIBLE void
-lws_plat_context_early_destroy(struct libwebsocket_context *context)
+lws_plat_context_early_destroy(struct lws_context *context)
 {
 	if (context->events) {
 		WSACloseEvent(context->events[0]);
@@ -319,7 +319,7 @@
 }
 
 LWS_VISIBLE void
-lws_plat_context_late_destroy(struct libwebsocket_context *context)
+lws_plat_context_late_destroy(struct lws_context *context)
 {
 	int n;
 
@@ -332,7 +332,7 @@
 }
 
 LWS_VISIBLE int
-interface_to_sa(struct libwebsocket_context *context,
+interface_to_sa(struct lws_context *context,
 		const char *ifname, struct sockaddr_in *addr, size_t addrlen)
 {
 	long long address = inet_addr(ifname);
@@ -352,8 +352,8 @@
 }
 
 LWS_VISIBLE void
-lws_plat_insert_socket_into_fds(struct libwebsocket_context *context,
-						       struct libwebsocket *wsi)
+lws_plat_insert_socket_into_fds(struct lws_context *context,
+						       struct lws *wsi)
 {
 	context->fds[context->fds_count++].revents = 0;
 	context->events[context->fds_count] = WSACreateEvent();
@@ -361,21 +361,21 @@
 }
 
 LWS_VISIBLE void
-lws_plat_delete_socket_from_fds(struct libwebsocket_context *context,
-						struct libwebsocket *wsi, int m)
+lws_plat_delete_socket_from_fds(struct lws_context *context,
+						struct lws *wsi, int m)
 {
 	WSACloseEvent(context->events[m + 1]);
 	context->events[m + 1] = context->events[context->fds_count + 1];
 }
 
 LWS_VISIBLE void
-lws_plat_service_periodic(struct libwebsocket_context *context)
+lws_plat_service_periodic(struct lws_context *context)
 {
 }
 
 LWS_VISIBLE int
-lws_plat_change_pollfd(struct libwebsocket_context *context,
-		      struct libwebsocket *wsi, struct libwebsocket_pollfd *pfd)
+lws_plat_change_pollfd(struct lws_context *context,
+		      struct lws *wsi, struct lws_pollfd *pfd)
 {
 	long networkevents = LWS_POLLHUP;
 		
diff --git a/lib/output.c b/lib/output.c
index 42261cd..0cd044d 100644
--- a/lib/output.c
+++ b/lib/output.c
@@ -22,7 +22,7 @@
 #include "private-libwebsockets.h"
 
 static int
-lws_0405_frame_mask_generate(struct libwebsocket *wsi)
+lws_0405_frame_mask_generate(struct lws *wsi)
 {
 	int n;
 
@@ -90,9 +90,9 @@
  * notice this returns number of bytes consumed, or -1
  */
 
-int lws_issue_raw(struct libwebsocket *wsi, unsigned char *buf, size_t len)
+int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
 {
-	struct libwebsocket_context *context = wsi->protocol->owning_server;
+	struct lws_context *context = wsi->protocol->owning_server;
 	int n;
 	size_t real_len = len;
 	int m;
@@ -246,7 +246,7 @@
  *	pressure at any given time.
  */
 
-LWS_VISIBLE int lws_write(struct libwebsocket *wsi, unsigned char *buf,
+LWS_VISIBLE int lws_write(struct lws *wsi, unsigned char *buf,
 			  size_t len, enum lws_write_protocol protocol)
 {
 	int n;
@@ -516,7 +516,7 @@
 }
 
 LWS_VISIBLE int lws_serve_http_file_fragment(
-		struct libwebsocket_context *context, struct libwebsocket *wsi)
+		struct lws_context *context, struct lws *wsi)
 {
 	int n;
 	int m;
@@ -580,8 +580,8 @@
 
 #if LWS_POSIX
 LWS_VISIBLE int
-lws_ssl_capable_read_no_ssl(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi, unsigned char *buf, int len)
+lws_ssl_capable_read_no_ssl(struct lws_context *context,
+			    struct lws *wsi, unsigned char *buf, int len)
 {
 	int n;
 
@@ -601,7 +601,7 @@
 }
 
 LWS_VISIBLE int
-lws_ssl_capable_write_no_ssl(struct libwebsocket *wsi, unsigned char *buf, int len)
+lws_ssl_capable_write_no_ssl(struct lws *wsi, unsigned char *buf, int len)
 {
 	int n = 0;
 
@@ -631,7 +631,7 @@
 }
 #endif
 LWS_VISIBLE int
-lws_ssl_pending_no_ssl(struct libwebsocket *wsi)
+lws_ssl_pending_no_ssl(struct lws *wsi)
 {
 	(void)wsi;
 	return 0;
diff --git a/lib/parsers.c b/lib/parsers.c
index c7b47d4..add6220 100644
--- a/lib/parsers.c
+++ b/lib/parsers.c
@@ -59,7 +59,7 @@
 	}
 }
 
-int lws_allocate_header_table(struct libwebsocket *wsi)
+int lws_allocate_header_table(struct lws *wsi)
 {
 	/* Be sure to free any existing header data to avoid mem leak: */
 	lws_free_header_table(wsi);
@@ -75,14 +75,14 @@
 	return 0;
 }
 
-int lws_free_header_table(struct libwebsocket *wsi)
+int lws_free_header_table(struct lws *wsi)
 {
 	lws_free2(wsi->u.hdr.ah);
 	wsi->u.hdr.ah = NULL;
 	return 0;
 };
 
-LWS_VISIBLE int lws_hdr_total_length(struct libwebsocket *wsi, enum lws_token_indexes h)
+LWS_VISIBLE int lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h)
 {
 	int n;
 	int len = 0;
@@ -98,7 +98,7 @@
 	return len;
 }
 
-LWS_VISIBLE int lws_hdr_copy(struct libwebsocket *wsi, char *dest, int len,
+LWS_VISIBLE int lws_hdr_copy(struct lws *wsi, char *dest, int len,
 						enum lws_token_indexes h)
 {
 	int toklen = lws_hdr_total_length(wsi, h);
@@ -121,7 +121,7 @@
 	return toklen;
 }
 
-char *lws_hdr_simple_ptr(struct libwebsocket *wsi, enum lws_token_indexes h)
+char *lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h)
 {
 	int n;
 
@@ -132,7 +132,7 @@
 	return &wsi->u.hdr.ah->data[wsi->u.hdr.ah->frags[n].offset];
 }
 
-int lws_hdr_simple_create(struct libwebsocket *wsi,
+int lws_hdr_simple_create(struct lws *wsi,
 				enum lws_token_indexes h, const char *s)
 {
 	wsi->u.hdr.ah->next_frag_index++;
@@ -178,7 +178,7 @@
 	return -1;
 }
 
-static int issue_char(struct libwebsocket *wsi, unsigned char c)
+static int issue_char(struct lws *wsi, unsigned char c)
 {
 	unsigned short frag_len;
 	if (wsi->u.hdr.ah->pos == sizeof(wsi->u.hdr.ah->data)) {
@@ -207,8 +207,8 @@
 }
 
 int lws_parse(
-		struct libwebsocket_context *context,
-		struct libwebsocket *wsi, unsigned char c)
+		struct lws_context *context,
+		struct lws *wsi, unsigned char c)
 {
 	static const unsigned char methods[] = {
 		WSI_TOKEN_GET_URI,
@@ -572,13 +572,13 @@
  * mode.
  */
 
-LWS_VISIBLE int lws_frame_is_binary(struct libwebsocket *wsi)
+LWS_VISIBLE int lws_frame_is_binary(struct lws *wsi)
 {
 	return wsi->u.ws.frame_is_binary;
 }
 
 int
-lws_rx_sm(struct libwebsocket *wsi, unsigned char c)
+lws_rx_sm(struct lws *wsi, unsigned char c)
 {
 	struct lws_tokens eff_buf;
 	int ret = 0;
@@ -998,7 +998,7 @@
 						wsi->protocol->callback,
 						wsi->protocol->owning_server,
 						wsi,
-						(enum libwebsocket_callback_reasons)callback_action,
+						(enum lws_callback_reasons)callback_action,
 						wsi->user_space,
 						eff_buf.token,
 						eff_buf.token_len);
@@ -1039,7 +1039,7 @@
  */
 
 LWS_VISIBLE size_t
-lws_remaining_packet_payload(struct libwebsocket *wsi)
+lws_remaining_packet_payload(struct lws *wsi)
 {
 	return wsi->u.ws.rx_packet_length;
 }
diff --git a/lib/pollfd.c b/lib/pollfd.c
index 83e1c9d..79a2c88 100644
--- a/lib/pollfd.c
+++ b/lib/pollfd.c
@@ -22,10 +22,10 @@
 #include "private-libwebsockets.h"
 
 int
-insert_wsi_socket_into_fds(struct libwebsocket_context *context,
-						       struct libwebsocket *wsi)
+insert_wsi_socket_into_fds(struct lws_context *context,
+						       struct lws *wsi)
 {
-	struct libwebsocket_pollargs pa = { wsi->sock, LWS_POLLIN, 0 };
+	struct lws_pollargs pa = { wsi->sock, LWS_POLLIN, 0 };
 
 	if (context->fds_count >= context->max_fds) {
 		lwsl_err("Too many fds (%d)\n", context->max_fds);
@@ -70,11 +70,11 @@
 }
 
 int
-remove_wsi_socket_from_fds(struct libwebsocket_context *context,
-						      struct libwebsocket *wsi)
+remove_wsi_socket_from_fds(struct lws_context *context,
+						      struct lws *wsi)
 {
 	int m;
-	struct libwebsocket_pollargs pa = { wsi->sock, 0, 0 };
+	struct lws_pollargs pa = { wsi->sock, 0, 0 };
 
 	lws_libev_io(context, wsi, LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE);
 
@@ -130,13 +130,13 @@
 }
 
 int
-lws_change_pollfd(struct libwebsocket *wsi, int _and, int _or)
+lws_change_pollfd(struct lws *wsi, int _and, int _or)
 {
-	struct libwebsocket_context *context;
+	struct lws_context *context;
 	int tid;
 	int sampled_tid;
-	struct libwebsocket_pollfd *pfd;
-	struct libwebsocket_pollargs pa;
+	struct lws_pollfd *pfd;
+	struct lws_pollargs pa;
 
 	if (!wsi || !wsi->protocol || wsi->position_in_fds_table < 0)
 		return 1;
@@ -206,11 +206,11 @@
  */
 
 LWS_VISIBLE int
-lws_callback_on_writable(struct libwebsocket_context *context,
-						      struct libwebsocket *wsi)
+lws_callback_on_writable(struct lws_context *context,
+						      struct lws *wsi)
 {
 #ifdef LWS_USE_HTTP2
-	struct libwebsocket *network_wsi, *wsi2;
+	struct lws *network_wsi, *wsi2;
 	int already;
 
 	lwsl_info("%s: %p\n", __func__, wsi);
@@ -285,11 +285,11 @@
 
 LWS_VISIBLE int
 lws_callback_on_writable_all_protocol(
-				  const struct libwebsocket_protocols *protocol)
+				  const struct lws_protocols *protocol)
 {
-	struct libwebsocket_context *context = protocol->owning_server;
+	struct lws_context *context = protocol->owning_server;
 	int n;
-	struct libwebsocket *wsi;
+	struct lws *wsi;
 
 	for (n = 0; n < context->fds_count; n++) {
 		wsi = wsi_from_fd(context,context->fds[n].fd);
diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h
index 01fcbea..203377a 100644
--- a/lib/private-libwebsockets.h
+++ b/lib/private-libwebsockets.h
@@ -442,39 +442,39 @@
 	LWS_RXFLOW_PENDING_CHANGE = (1 << 1),
 };
 
-struct libwebsocket_protocols;
-struct libwebsocket;
+struct lws_protocols;
+struct lws;
 
 #ifdef LWS_USE_LIBEV
 struct lws_io_watcher {
 	struct ev_io watcher;
-	struct libwebsocket_context* context;
+	struct lws_context* context;
 };
 
 struct lws_signal_watcher {
 	struct ev_signal watcher;
-	struct libwebsocket_context* context;
+	struct lws_context* context;
 };
 #endif /* LWS_USE_LIBEV */
 
 #ifdef _WIN32
 #define LWS_FD_HASH(fd) ((fd ^ (fd >> 8) ^ (fd >> 16)) % FD_HASHTABLE_MODULUS)
 struct lws_fd_hashtable {
-	struct libwebsocket **wsi;
+	struct lws **wsi;
 	int length;
 };
 #endif
 
-struct libwebsocket_context {
+struct lws_context {
 #ifdef _WIN32
 	WSAEVENT *events;
 #endif
-	struct libwebsocket_pollfd *fds;
+	struct lws_pollfd *fds;
 #ifdef _WIN32
 /* different implementation between unix and windows */
 	struct lws_fd_hashtable fd_hashtable[FD_HASHTABLE_MODULUS];
 #else
-	struct libwebsocket **lws_lookup;  /* fd to wsi */
+	struct lws **lws_lookup;  /* fd to wsi */
 #endif
 	int fds_count;
 #ifdef LWS_USE_LIBEV
@@ -535,15 +535,15 @@
 	unsigned int user_supplied_ssl_ctx:1;
 	SSL_CTX *ssl_ctx;
 	SSL_CTX *ssl_client_ctx;
-	struct libwebsocket *pending_read_list; /* linked list */
+	struct lws *pending_read_list; /* linked list */
 #define lws_ssl_anybody_has_buffered_read(ctx) (ctx->use_ssl && ctx->pending_read_list)
 #else
 #define lws_ssl_anybody_has_buffered_read(ctx) (0)
 #endif
-	struct libwebsocket_protocols *protocols;
+	struct lws_protocols *protocols;
 	int count_protocols;
 #ifndef LWS_NO_EXTENSIONS
-	struct libwebsocket_extension *extensions;
+	struct lws_extension *extensions;
 #endif
     struct lws_token_limits *token_limits;
 	void *user_space;
@@ -560,15 +560,15 @@
 #define LWS_LIBEV_ENABLED(context) (context->options & LWS_SERVER_OPTION_LIBEV)
 LWS_EXTERN void lws_feature_status_libev(struct lws_context_creation_info *info);
 LWS_EXTERN void
-lws_libev_accept(struct libwebsocket_context *context,
-		 struct libwebsocket *new_wsi, lws_sockfd_type accept_fd);
+lws_libev_accept(struct lws_context *context,
+		 struct lws *new_wsi, lws_sockfd_type accept_fd);
 LWS_EXTERN void
-lws_libev_io(struct libwebsocket_context *context,
-				struct libwebsocket *wsi, int flags);
+lws_libev_io(struct lws_context *context,
+				struct lws *wsi, int flags);
 LWS_EXTERN int
-lws_libev_init_fd_table(struct libwebsocket_context *context);
+lws_libev_init_fd_table(struct lws_context *context);
 LWS_EXTERN void
-lws_libev_run(struct libwebsocket_context *context);
+lws_libev_run(struct lws_context *context);
 #else
 #define LWS_LIBEV_ENABLED(context) (0)
 #ifdef LWS_POSIX
@@ -758,8 +758,8 @@
 	struct http2_settings my_settings;
 	struct http2_settings peer_settings;
 	
-	struct libwebsocket *parent_wsi;
-	struct libwebsocket *next_child_wsi;
+	struct lws *parent_wsi;
+	struct lws *next_child_wsi;
 
 	struct hpack_dynamic_table *hpack_dyn_table;
 	
@@ -768,7 +768,7 @@
 	/* frame */
 	unsigned int length;
 	unsigned int stream_id;
-	struct libwebsocket *stream_wsi;
+	struct lws *stream_wsi;
 	unsigned char type;
 	unsigned char flags;
 	unsigned char frame_state;
@@ -845,7 +845,7 @@
 	unsigned char ping_pending_flag;
 };
 
-struct libwebsocket {
+struct lws {
 
 	/* lifetime members */
 
@@ -853,9 +853,9 @@
     struct lws_io_watcher w_read;
     struct lws_io_watcher w_write;
 #endif /* LWS_USE_LIBEV */
-	const struct libwebsocket_protocols *protocol;
+	const struct lws_protocols *protocol;
 #ifndef LWS_NO_EXTENSIONS
-	struct libwebsocket_extension *
+	struct lws_extension *
 				   active_extensions[LWS_MAX_EXTENSIONS_ACTIVE];
 	void *active_extensions_user[LWS_MAX_EXTENSIONS_ACTIVE];
 	unsigned char count_active_extensions;
@@ -909,7 +909,7 @@
 #ifdef LWS_OPENSSL_SUPPORT
 	SSL *ssl;
 	BIO *client_bio;
-	struct libwebsocket *pending_read_list_prev, *pending_read_list_next;
+	struct lws *pending_read_list_prev, *pending_read_list_next;
 	unsigned int use_ssl:2;
 	unsigned int upgraded:1;
 #endif
@@ -922,54 +922,54 @@
 LWS_EXTERN int log_level;
 
 LWS_EXTERN void
-lws_close_and_free_session(struct libwebsocket_context *context,
-			       struct libwebsocket *wsi, enum lws_close_status);
+lws_close_and_free_session(struct lws_context *context,
+			       struct lws *wsi, enum lws_close_status);
 
 LWS_EXTERN int
-remove_wsi_socket_from_fds(struct libwebsocket_context *context,
-						      struct libwebsocket *wsi);
+remove_wsi_socket_from_fds(struct lws_context *context,
+						      struct lws *wsi);
 LWS_EXTERN int
-lws_rxflow_cache(struct libwebsocket *wsi, unsigned char *buf, int n, int len);
+lws_rxflow_cache(struct lws *wsi, unsigned char *buf, int n, int len);
 
 #ifndef LWS_LATENCY
-static inline void lws_latency(struct libwebsocket_context *context,
-		struct libwebsocket *wsi, const char *action,
+static inline void lws_latency(struct lws_context *context,
+		struct lws *wsi, const char *action,
 		int ret, int completion) { do { (void)context; (void)wsi; (void)action; (void)ret; (void)completion; } while (0); }
-static inline void lws_latency_pre(struct libwebsocket_context *context,
-					struct libwebsocket *wsi) { do { (void)context; (void)wsi; } while (0); }
+static inline void lws_latency_pre(struct lws_context *context,
+					struct lws *wsi) { do { (void)context; (void)wsi; } while (0); }
 #else
 #define lws_latency_pre(_context, _wsi) lws_latency(_context, _wsi, NULL, 0, 0)
 extern void
-lws_latency(struct libwebsocket_context *context,
-			struct libwebsocket *wsi, const char *action,
+lws_latency(struct lws_context *context,
+			struct lws *wsi, const char *action,
 						       int ret, int completion);
 #endif
 
-LWS_EXTERN void lws_set_protocol_write_pending(struct libwebsocket_context *context,
-				    struct libwebsocket *wsi,
+LWS_EXTERN void lws_set_protocol_write_pending(struct lws_context *context,
+				    struct lws *wsi,
 				    enum lws_pending_protocol_send pend);
 LWS_EXTERN int
-lws_client_rx_sm(struct libwebsocket *wsi, unsigned char c);
+lws_client_rx_sm(struct lws *wsi, unsigned char c);
 
 LWS_EXTERN int
-lws_parse(struct libwebsocket_context *context,
-		struct libwebsocket *wsi, unsigned char c);
+lws_parse(struct lws_context *context,
+		struct lws *wsi, unsigned char c);
 
 LWS_EXTERN int
-lws_http_action(struct libwebsocket_context *context, struct libwebsocket *wsi);
+lws_http_action(struct lws_context *context, struct lws *wsi);
 
 LWS_EXTERN int
 lws_b64_selftest(void);
 
 #if defined(_WIN32) || defined(MBED_OPERATORS)
-LWS_EXTERN struct libwebsocket *
-wsi_from_fd(struct libwebsocket_context *context, lws_sockfd_type fd);
+LWS_EXTERN struct lws *
+wsi_from_fd(struct lws_context *context, lws_sockfd_type fd);
 
 LWS_EXTERN int 
-insert_wsi(struct libwebsocket_context *context, struct libwebsocket *wsi);
+insert_wsi(struct lws_context *context, struct lws *wsi);
 
 LWS_EXTERN int
-delete_from_fd(struct libwebsocket_context *context, lws_sockfd_type fd);
+delete_from_fd(struct lws_context *context, lws_sockfd_type fd);
 #else
 #define wsi_from_fd(A,B)  A->lws_lookup[B] 
 #define insert_wsi(A,B)   A->lws_lookup[B->sock]=B
@@ -977,31 +977,31 @@
 #endif
 
 LWS_EXTERN int
-insert_wsi_socket_into_fds(struct libwebsocket_context *context,
-						      struct libwebsocket *wsi);
+insert_wsi_socket_into_fds(struct lws_context *context,
+						      struct lws *wsi);
 
 LWS_EXTERN int
-lws_issue_raw(struct libwebsocket *wsi, unsigned char *buf, size_t len);
+lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len);
 
 
 LWS_EXTERN int
-lws_service_timeout_check(struct libwebsocket_context *context,
-				    struct libwebsocket *wsi, unsigned int sec);
+lws_service_timeout_check(struct lws_context *context,
+				    struct lws *wsi, unsigned int sec);
 
-LWS_EXTERN struct libwebsocket *
-lws_client_connect_2(struct libwebsocket_context *context,
-	struct libwebsocket *wsi);
+LWS_EXTERN struct lws *
+lws_client_connect_2(struct lws_context *context,
+	struct lws *wsi);
 
-LWS_EXTERN struct libwebsocket *
-lws_create_new_server_wsi(struct libwebsocket_context *context);
+LWS_EXTERN struct lws *
+lws_create_new_server_wsi(struct lws_context *context);
 
 LWS_EXTERN char *
-lws_generate_client_handshake(struct libwebsocket_context *context,
-		struct libwebsocket *wsi, char *pkt);
+lws_generate_client_handshake(struct lws_context *context,
+		struct lws *wsi, char *pkt);
 
 LWS_EXTERN int
-lws_handle_POLLOUT_event(struct libwebsocket_context *context,
-			      struct libwebsocket *wsi, struct libwebsocket_pollfd *pollfd);
+lws_handle_POLLOUT_event(struct lws_context *context,
+			      struct lws *wsi, struct lws_pollfd *pollfd);
 
 /*
  * EXTENSIONS
@@ -1010,19 +1010,19 @@
 #ifndef LWS_NO_EXTENSIONS
 LWS_VISIBLE void
 lws_context_init_extensions(struct lws_context_creation_info *info,
-				    struct libwebsocket_context *context);
+				    struct lws_context *context);
 LWS_EXTERN int
-lws_any_extension_handled(struct libwebsocket_context *context,
-			  struct libwebsocket *wsi,
-			  enum libwebsocket_extension_callback_reasons r,
+lws_any_extension_handled(struct lws_context *context,
+			  struct lws *wsi,
+			  enum lws_extension_callback_reasons r,
 			  void *v, size_t len);
 
 LWS_EXTERN int
-lws_ext_callback_for_each_active(struct libwebsocket *wsi, int reason,
+lws_ext_callback_for_each_active(struct lws *wsi, int reason,
 						    void *buf, int len);
 LWS_EXTERN int
 lws_ext_callback_for_each_extension_type(
-		struct libwebsocket_context *context, struct libwebsocket *wsi,
+		struct lws_context *context, struct lws *wsi,
 			int reason, void *arg, int len);
 #else
 #define lws_any_extension_handled(_a, _b, _c, _d, _e) (0)
@@ -1033,104 +1033,104 @@
 #endif
 
 LWS_EXTERN int
-lws_client_interpret_server_handshake(struct libwebsocket_context *context,
-		struct libwebsocket *wsi);
+lws_client_interpret_server_handshake(struct lws_context *context,
+		struct lws *wsi);
 
 LWS_EXTERN int
-lws_rx_sm(struct libwebsocket *wsi, unsigned char c);
+lws_rx_sm(struct lws *wsi, unsigned char c);
 
 LWS_EXTERN int
-lws_issue_raw_ext_access(struct libwebsocket *wsi,
+lws_issue_raw_ext_access(struct lws *wsi,
 						unsigned char *buf, size_t len);
 
 LWS_EXTERN int
-_lws_rx_flow_control(struct libwebsocket *wsi);
+_lws_rx_flow_control(struct lws *wsi);
 
 LWS_EXTERN void
-lws_union_transition(struct libwebsocket *wsi, enum connection_mode mode);
+lws_union_transition(struct lws *wsi, enum connection_mode mode);
 
 LWS_EXTERN int
 user_callback_handle_rxflow(callback_function,
-		struct libwebsocket_context *context,
-			struct libwebsocket *wsi,
-			 enum libwebsocket_callback_reasons reason, void *user,
+		struct lws_context *context,
+			struct lws *wsi,
+			 enum lws_callback_reasons reason, void *user,
 							  void *in, size_t len);
 #ifdef LWS_USE_HTTP2
-LWS_EXTERN struct libwebsocket *lws_http2_get_network_wsi(struct libwebsocket *wsi);
-struct libwebsocket * lws_http2_get_nth_child(struct libwebsocket *wsi, int n);
+LWS_EXTERN struct lws *lws_http2_get_network_wsi(struct lws *wsi);
+struct lws * lws_http2_get_nth_child(struct lws *wsi, int n);
 LWS_EXTERN int
 lws_http2_interpret_settings_payload(struct http2_settings *settings, unsigned char *buf, int len);
 LWS_EXTERN void lws_http2_init(struct http2_settings *settings);
 LWS_EXTERN int
-lws_http2_parser(struct libwebsocket_context *context,
-		     struct libwebsocket *wsi, unsigned char c);
-LWS_EXTERN int lws_http2_do_pps_send(struct libwebsocket_context *context, struct libwebsocket *wsi);
-LWS_EXTERN int lws_http2_frame_write(struct libwebsocket *wsi, int type, int flags, unsigned int sid, unsigned int len, unsigned char *buf);
-LWS_EXTERN struct libwebsocket *
-lws_http2_wsi_from_id(struct libwebsocket *wsi, unsigned int sid);
-LWS_EXTERN int lws_hpack_interpret(struct libwebsocket_context *context,
-				   struct libwebsocket *wsi,
+lws_http2_parser(struct lws_context *context,
+		     struct lws *wsi, unsigned char c);
+LWS_EXTERN int lws_http2_do_pps_send(struct lws_context *context, struct lws *wsi);
+LWS_EXTERN int lws_http2_frame_write(struct lws *wsi, int type, int flags, unsigned int sid, unsigned int len, unsigned char *buf);
+LWS_EXTERN struct lws *
+lws_http2_wsi_from_id(struct lws *wsi, unsigned int sid);
+LWS_EXTERN int lws_hpack_interpret(struct lws_context *context,
+				   struct lws *wsi,
 				   unsigned char c);
 LWS_EXTERN int
-lws_add_http2_header_by_name(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+lws_add_http2_header_by_name(struct lws_context *context,
+			    struct lws *wsi,
 			    const unsigned char *name,
 			    const unsigned char *value,
 			    int length,
 			    unsigned char **p,
 			    unsigned char *end);
 LWS_EXTERN int
-lws_add_http2_header_by_token(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+lws_add_http2_header_by_token(struct lws_context *context,
+			    struct lws *wsi,
 			    enum lws_token_indexes token,
 			    const unsigned char *value,
 			    int length,
 			    unsigned char **p,
 			    unsigned char *end);
 LWS_EXTERN int
-lws_add_http2_header_status(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi,
+lws_add_http2_header_status(struct lws_context *context,
+			    struct lws *wsi,
 			    unsigned int code,
 			    unsigned char **p,
 			    unsigned char *end);
 LWS_EXTERN
-void lws_http2_configure_if_upgraded(struct libwebsocket *wsi);
+void lws_http2_configure_if_upgraded(struct lws *wsi);
 #else
 #define lws_http2_configure_if_upgraded(x)
 #endif
 
 LWS_EXTERN int
-lws_plat_set_socket_options(struct libwebsocket_context *context, lws_sockfd_type fd);
+lws_plat_set_socket_options(struct lws_context *context, lws_sockfd_type fd);
 
 LWS_EXTERN int
-lws_allocate_header_table(struct libwebsocket *wsi);
+lws_allocate_header_table(struct lws *wsi);
 
 LWS_EXTERN int
-lws_free_header_table(struct libwebsocket *wsi);
+lws_free_header_table(struct lws *wsi);
 
 LWS_EXTERN char *
-lws_hdr_simple_ptr(struct libwebsocket *wsi, enum lws_token_indexes h);
+lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h);
 
 LWS_EXTERN int
-lws_hdr_simple_create(struct libwebsocket *wsi,
+lws_hdr_simple_create(struct lws *wsi,
 				enum lws_token_indexes h, const char *s);
 
 LWS_EXTERN int
-lws_ensure_user_space(struct libwebsocket *wsi);
+lws_ensure_user_space(struct lws *wsi);
 
 LWS_EXTERN int
-lws_change_pollfd(struct libwebsocket *wsi, int _and, int _or);
+lws_change_pollfd(struct lws *wsi, int _and, int _or);
 
 #ifndef LWS_NO_SERVER
 int lws_context_init_server(struct lws_context_creation_info *info,
-			    struct libwebsocket_context *context);
-LWS_EXTERN int handshake_0405(struct libwebsocket_context *context,
-						      struct libwebsocket *wsi);
+			    struct lws_context *context);
+LWS_EXTERN int handshake_0405(struct lws_context *context,
+						      struct lws *wsi);
 LWS_EXTERN int
-lws_interpret_incoming_packet(struct libwebsocket *wsi,
+lws_interpret_incoming_packet(struct lws *wsi,
 						unsigned char *buf, size_t len);
 LWS_EXTERN void
-lws_server_get_canonical_hostname(struct libwebsocket_context *context,
+lws_server_get_canonical_hostname(struct lws_context *context,
 				struct lws_context_creation_info *info);
 #else
 #define lws_context_init_server(_a, _b) (0)
@@ -1145,7 +1145,7 @@
 #endif
 
 #if !defined(MBED_OPERATORS)
-LWS_EXTERN int interface_to_sa(struct libwebsocket_context *context,
+LWS_EXTERN int interface_to_sa(struct lws_context *context,
 		const char *ifname, struct sockaddr_in *addr, size_t addrlen);
 #endif
 LWS_EXTERN void lwsl_emit_stderr(int level, const char *line);
@@ -1177,64 +1177,64 @@
 #define LWS_SSL_ENABLED(context) (context->use_ssl)
 LWS_EXTERN int openssl_websocket_private_data_index;
 LWS_EXTERN int
-lws_ssl_capable_read(struct libwebsocket_context *context,
-		     struct libwebsocket *wsi, unsigned char *buf, int len);
+lws_ssl_capable_read(struct lws_context *context,
+		     struct lws *wsi, unsigned char *buf, int len);
 LWS_EXTERN int
-lws_ssl_capable_write(struct libwebsocket *wsi, unsigned char *buf, int len);
+lws_ssl_capable_write(struct lws *wsi, unsigned char *buf, int len);
 LWS_EXTERN int
-lws_ssl_pending(struct libwebsocket *wsi);
+lws_ssl_pending(struct lws *wsi);
 LWS_EXTERN int
-lws_server_socket_service_ssl(struct libwebsocket_context *context,
-		struct libwebsocket **wsi, struct libwebsocket *new_wsi,
-		lws_sockfd_type accept_fd, struct libwebsocket_pollfd *pollfd);
+lws_server_socket_service_ssl(struct lws_context *context,
+		struct lws **wsi, struct lws *new_wsi,
+		lws_sockfd_type accept_fd, struct lws_pollfd *pollfd);
 LWS_EXTERN int
-lws_ssl_close(struct libwebsocket *wsi);
+lws_ssl_close(struct lws *wsi);
 LWS_EXTERN void
-lws_ssl_context_destroy(struct libwebsocket_context *context);
+lws_ssl_context_destroy(struct lws_context *context);
 LWS_VISIBLE void
-lws_ssl_remove_wsi_from_buffered_list(struct libwebsocket_context *context,
-		     struct libwebsocket *wsi);
+lws_ssl_remove_wsi_from_buffered_list(struct lws_context *context,
+		     struct lws *wsi);
 #ifndef LWS_NO_SERVER
 LWS_EXTERN int
 lws_context_init_server_ssl(struct lws_context_creation_info *info,
-		     struct libwebsocket_context *context);
+		     struct lws_context *context);
 #else
 #define lws_context_init_server_ssl(_a, _b) (0)
 #endif
 LWS_EXTERN void
-lws_ssl_destroy(struct libwebsocket_context *context);
+lws_ssl_destroy(struct lws_context *context);
 
 /* HTTP2-related */
 
 #ifdef LWS_USE_HTTP2
 LWS_EXTERN void
-lws_context_init_http2_ssl(struct libwebsocket_context *context);
+lws_context_init_http2_ssl(struct lws_context *context);
 #else
 #define lws_context_init_http2_ssl(_a)
 #endif
 #endif
 
 LWS_EXTERN int
-lws_ssl_capable_read_no_ssl(struct libwebsocket_context *context,
-			    struct libwebsocket *wsi, unsigned char *buf, int len);
+lws_ssl_capable_read_no_ssl(struct lws_context *context,
+			    struct lws *wsi, unsigned char *buf, int len);
 
 LWS_EXTERN int
-lws_ssl_capable_write_no_ssl(struct libwebsocket *wsi, unsigned char *buf, int len);
+lws_ssl_capable_write_no_ssl(struct lws *wsi, unsigned char *buf, int len);
 
 LWS_EXTERN int
-lws_ssl_pending_no_ssl(struct libwebsocket *wsi);
+lws_ssl_pending_no_ssl(struct lws *wsi);
 
 #ifndef LWS_NO_CLIENT
 	LWS_EXTERN int lws_client_socket_service(
-		struct libwebsocket_context *context,
-		struct libwebsocket *wsi, struct libwebsocket_pollfd *pollfd);
+		struct lws_context *context,
+		struct lws *wsi, struct lws_pollfd *pollfd);
 #ifdef LWS_OPENSSL_SUPPORT
 	LWS_EXTERN int lws_context_init_client_ssl(struct lws_context_creation_info *info,
-			    struct libwebsocket_context *context);
+			    struct lws_context *context);
 #else
 	#define lws_context_init_client_ssl(_a, _b) (0)
 #endif
-	LWS_EXTERN int lws_handshake_client(struct libwebsocket *wsi, unsigned char **buf, size_t len);
+	LWS_EXTERN int lws_handshake_client(struct lws *wsi, unsigned char **buf, size_t len);
 	LWS_EXTERN void
 	lws_decode_ssl_error(void);
 #else
@@ -1243,18 +1243,18 @@
 #endif
 #ifndef LWS_NO_SERVER
 	LWS_EXTERN int lws_server_socket_service(
-		struct libwebsocket_context *context,
-		struct libwebsocket *wsi, struct libwebsocket_pollfd *pollfd);
-	LWS_EXTERN int _lws_rx_flow_control(struct libwebsocket *wsi);
-	LWS_EXTERN int lws_handshake_server(struct libwebsocket_context *context,
-		     struct libwebsocket *wsi, unsigned char **buf, size_t len);
+		struct lws_context *context,
+		struct lws *wsi, struct lws_pollfd *pollfd);
+	LWS_EXTERN int _lws_rx_flow_control(struct lws *wsi);
+	LWS_EXTERN int lws_handshake_server(struct lws_context *context,
+		     struct lws *wsi, unsigned char **buf, size_t len);
 #else
 #define lws_server_socket_service(_a, _b, _c) (0)
 #define _lws_rx_flow_control(_a) (0)
 #define lws_handshake_server(_a, _b, _c, _d) (0)
 #endif
 	
-LWS_EXTERN int lws_get_addresses(struct libwebsocket_context *context,
+LWS_EXTERN int lws_get_addresses(struct lws_context *context,
 			    void *ads, char *name, int name_len,
 			    char *rip, int rip_len);
 
@@ -1275,31 +1275,31 @@
  * lws_plat_
  */
 LWS_EXTERN void
-lws_plat_delete_socket_from_fds(struct libwebsocket_context *context,
-					       struct libwebsocket *wsi, int m);
+lws_plat_delete_socket_from_fds(struct lws_context *context,
+					       struct lws *wsi, int m);
 LWS_EXTERN void
-lws_plat_insert_socket_into_fds(struct libwebsocket_context *context,
-						      struct libwebsocket *wsi);
+lws_plat_insert_socket_into_fds(struct lws_context *context,
+						      struct lws *wsi);
 LWS_EXTERN void
-lws_plat_service_periodic(struct libwebsocket_context *context);
+lws_plat_service_periodic(struct lws_context *context);
 
 LWS_EXTERN int
-lws_plat_change_pollfd(struct libwebsocket_context *context,
-		     struct libwebsocket *wsi, struct libwebsocket_pollfd *pfd);
+lws_plat_change_pollfd(struct lws_context *context,
+		     struct lws *wsi, struct lws_pollfd *pfd);
 LWS_EXTERN int
 lws_plat_context_early_init(void);
 LWS_EXTERN void
-lws_plat_context_early_destroy(struct libwebsocket_context *context);
+lws_plat_context_early_destroy(struct lws_context *context);
 LWS_EXTERN void
-lws_plat_context_late_destroy(struct libwebsocket_context *context);
+lws_plat_context_late_destroy(struct lws_context *context);
 LWS_EXTERN int
-lws_poll_listen_fd(struct libwebsocket_pollfd *fd);
+lws_poll_listen_fd(struct lws_pollfd *fd);
 LWS_EXTERN int
-lws_plat_service(struct libwebsocket_context *context, int timeout_ms);
+lws_plat_service(struct lws_context *context, int timeout_ms);
 LWS_EXTERN int
-lws_plat_init_lookup(struct libwebsocket_context *context);
+lws_plat_init_lookup(struct lws_context *context);
 LWS_EXTERN int
-lws_plat_init_fd_tables(struct libwebsocket_context *context);
+lws_plat_init_fd_tables(struct lws_context *context);
 LWS_EXTERN void
 lws_plat_drop_app_privileges(struct lws_context_creation_info *info);
 LWS_EXTERN unsigned long long
diff --git a/lib/server-handshake.c b/lib/server-handshake.c
index 5962cd8..847cb2f 100644
--- a/lib/server-handshake.c
+++ b/lib/server-handshake.c
@@ -24,13 +24,13 @@
 #define LWS_CPYAPP(ptr, str) { strcpy(ptr, str); ptr += strlen(str); }
 #ifndef LWS_NO_EXTENSIONS
 LWS_VISIBLE int
-lws_extension_server_handshake(struct libwebsocket_context *context,
-			  struct libwebsocket *wsi, char **p)
+lws_extension_server_handshake(struct lws_context *context,
+			  struct lws *wsi, char **p)
 {
 	int n;
 	char *c;
 	char ext_name[128];
-	struct libwebsocket_extension *ext;
+	struct lws_extension *ext;
 	int ext_count = 0;
 	int more = 1;
 
@@ -156,7 +156,7 @@
 }
 #endif
 int
-handshake_0405(struct libwebsocket_context *context, struct libwebsocket *wsi)
+handshake_0405(struct lws_context *context, struct lws *wsi)
 {
 	unsigned char hash[20];
 	int n;
diff --git a/lib/server.c b/lib/server.c
index d295fcd..1438814 100644
--- a/lib/server.c
+++ b/lib/server.c
@@ -23,7 +23,7 @@
 #include "private-libwebsockets.h"
 
 int lws_context_init_server(struct lws_context_creation_info *info,
-			    struct libwebsocket_context *context)
+			    struct lws_context *context)
 {
 	lws_sockfd_type sockfd;
 #if LWS_POSIX
@@ -37,7 +37,7 @@
 	struct sockaddr *v;
 	int opt = 1;
 #endif
-	struct libwebsocket *wsi;
+	struct lws *wsi;
 
 	/* set up our external listening socket we serve on */
 
@@ -121,7 +121,7 @@
 
 	context->listen_port = info->port;
 
-	wsi = lws_zalloc(sizeof(struct libwebsocket));
+	wsi = lws_zalloc(sizeof(struct lws));
 	if (wsi == NULL) {
 		lwsl_err("Out of mem\n");
 		compatible_close(sockfd);
@@ -151,9 +151,9 @@
 }
 
 int
-_lws_rx_flow_control(struct libwebsocket *wsi)
+_lws_rx_flow_control(struct lws *wsi)
 {
-	struct libwebsocket_context *context = wsi->protocol->owning_server;
+	struct lws_context *context = wsi->protocol->owning_server;
 
 	/* there is no pending change */
 	if (!(wsi->rxflow_change_to & LWS_RXFLOW_PENDING_CHANGE))
@@ -187,8 +187,8 @@
 	return 0;
 }
 
-int lws_http_action(struct libwebsocket_context *context,
-		    struct libwebsocket *wsi)
+int lws_http_action(struct lws_context *context,
+		    struct lws *wsi)
 {
 	char *uri_ptr = NULL;
 	int uri_len = 0;
@@ -343,8 +343,8 @@
 }
 
 
-int lws_handshake_server(struct libwebsocket_context *context,
-		struct libwebsocket *wsi, unsigned char **buf, size_t len)
+int lws_handshake_server(struct lws_context *context,
+		struct lws *wsi, unsigned char **buf, size_t len)
 {
 	struct allocated_headers *ah;
 	int protocol_len;
@@ -596,12 +596,12 @@
 	return 1;
 }
 
-struct libwebsocket *
-lws_create_new_server_wsi(struct libwebsocket_context *context)
+struct lws *
+lws_create_new_server_wsi(struct lws_context *context)
 {
-	struct libwebsocket *new_wsi;
+	struct lws *new_wsi;
 
-	new_wsi = lws_zalloc(sizeof(struct libwebsocket));
+	new_wsi = lws_zalloc(sizeof(struct lws));
 	if (new_wsi == NULL) {
 		lwsl_err("Out of memory for new connection\n");
 		return NULL;
@@ -656,7 +656,7 @@
  */
 
 LWS_VISIBLE
-int lws_http_transaction_completed(struct libwebsocket *wsi)
+int lws_http_transaction_completed(struct lws *wsi)
 {
 	/* if we can't go back to accept new headers, drop the connection */
 	if (wsi->u.http.connection_type != HTTP_CONNECTION_KEEP_ALIVE) {
@@ -684,10 +684,10 @@
 }
 
 LWS_VISIBLE
-int lws_server_socket_service(struct libwebsocket_context *context,
-			struct libwebsocket *wsi, struct libwebsocket_pollfd *pollfd)
+int lws_server_socket_service(struct lws_context *context,
+			struct lws *wsi, struct lws_pollfd *pollfd)
 {
-	struct libwebsocket *new_wsi = NULL;
+	struct lws *new_wsi = NULL;
 	lws_sockfd_type accept_fd = LWS_SOCK_INVALID;
 #if LWS_POSIX
 	socklen_t clilen;
@@ -910,8 +910,8 @@
  */
 
 LWS_VISIBLE int lws_serve_http_file(
-		struct libwebsocket_context *context,
-			struct libwebsocket *wsi, const char *file,
+		struct lws_context *context,
+			struct lws *wsi, const char *file,
 			   const char *content_type, const char *other_headers,
 			   int other_headers_len)
 {
@@ -963,7 +963,7 @@
 }
 
 
-int lws_interpret_incoming_packet(struct libwebsocket *wsi,
+int lws_interpret_incoming_packet(struct lws *wsi,
 						 unsigned char *buf, size_t len)
 {
 	size_t n = 0;
@@ -1000,7 +1000,7 @@
 }
 
 LWS_VISIBLE void
-lws_server_get_canonical_hostname(struct libwebsocket_context *context,
+lws_server_get_canonical_hostname(struct lws_context *context,
 				struct lws_context_creation_info *info)
 {
 	if (info->options & LWS_SERVER_OPTION_SKIP_SERVER_CANONICAL_NAME)
diff --git a/lib/service.c b/lib/service.c
index 3430399..170d475 100644
--- a/lib/service.c
+++ b/lib/service.c
@@ -22,8 +22,8 @@
 #include "private-libwebsockets.h"
 
 static int
-lws_calllback_as_writeable(struct libwebsocket_context *context,
-		   struct libwebsocket *wsi)
+lws_calllback_as_writeable(struct lws_context *context,
+		   struct lws *wsi)
 {
 	int n;
 
@@ -40,18 +40,18 @@
 	}
 	lwsl_info("%s: %p (user=%p)\n", __func__, wsi, wsi->user_space);
 	return user_callback_handle_rxflow(wsi->protocol->callback, context,
-			wsi, (enum libwebsocket_callback_reasons) n,
+			wsi, (enum lws_callback_reasons) n,
 						      wsi->user_space, NULL, 0);
 }
 
 int
-lws_handle_POLLOUT_event(struct libwebsocket_context *context,
-		   struct libwebsocket *wsi, struct libwebsocket_pollfd *pollfd)
+lws_handle_POLLOUT_event(struct lws_context *context,
+		   struct lws *wsi, struct lws_pollfd *pollfd)
 {
 	int n;
 	struct lws_tokens eff_buf;
 #ifdef LWS_USE_HTTP2
-	struct libwebsocket *wsi2;
+	struct lws *wsi2;
 #endif
 	int ret;
 	int m;
@@ -280,8 +280,8 @@
 
 
 int
-lws_service_timeout_check(struct libwebsocket_context *context,
-				     struct libwebsocket *wsi, unsigned int sec)
+lws_service_timeout_check(struct lws_context *context,
+				     struct lws *wsi, unsigned int sec)
 {
 	/*
 	 * if extensions want in on it (eg, we are a mux parent)
@@ -315,7 +315,7 @@
 	return 0;
 }
 
-int lws_rxflow_cache(struct libwebsocket *wsi, unsigned char *buf, int n, int len)
+int lws_rxflow_cache(struct lws *wsi, unsigned char *buf, int n, int len)
 {
 	/* his RX is flowcontrolled, don't send remaining now */
 	if (wsi->rxflow_buffer) {
@@ -342,13 +342,13 @@
  *
  *	This function takes a pollfd that has POLLIN or POLLOUT activity and
  *	services it according to the state of the associated
- *	struct libwebsocket.
+ *	struct lws.
  *
  *	The one call deals with all "service" that might happen on a socket
  *	including listen accepts, http files as well as websocket protocol.
  *
  *	If a pollfd says it has something, you can just pass it to
- *	libwebsocket_serice_fd() whether it is a socket handled by lws or not.
+ *	lws_service_fd() whether it is a socket handled by lws or not.
  *	If it sees it is a lws socket, the traffic will be handled and
  *	pollfd->revents will be zeroed now.
  *
@@ -358,10 +358,10 @@
  */
 
 LWS_VISIBLE int
-lws_service_fd(struct libwebsocket_context *context,
-					struct libwebsocket_pollfd *pollfd)
+lws_service_fd(struct lws_context *context,
+					struct lws_pollfd *pollfd)
 {
-	struct libwebsocket *wsi;
+	struct lws *wsi;
 	int n, m;
 	lws_sockfd_type mfd;
 #if LWS_POSIX
@@ -675,7 +675,7 @@
  */
 
 LWS_VISIBLE int
-lws_service(struct libwebsocket_context *context, int timeout_ms)
+lws_service(struct lws_context *context, int timeout_ms)
 {
 	return lws_plat_service(context, timeout_ms);
 }
diff --git a/lib/ssl-http2.c b/lib/ssl-http2.c
index caa028c..84c39f5 100644
--- a/lib/ssl-http2.c
+++ b/lib/ssl-http2.c
@@ -86,7 +86,7 @@
 #endif
 
 LWS_VISIBLE void
-lws_context_init_http2_ssl(struct libwebsocket_context *context)
+lws_context_init_http2_ssl(struct lws_context *context)
 {
 #if OPENSSL_VERSION_NUMBER >= 0x10002000L
 	static struct alpn_ctx protos = { (unsigned char *)
@@ -106,7 +106,7 @@
 #endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
 }
 
-void lws_http2_configure_if_upgraded(struct libwebsocket *wsi)
+void lws_http2_configure_if_upgraded(struct lws *wsi)
 {
 #if OPENSSL_VERSION_NUMBER >= 0x10002000L
 	struct allocated_headers *ah;
diff --git a/lib/ssl.c b/lib/ssl.c
index 21d1a3c..6f55826 100644
--- a/lib/ssl.c
+++ b/lib/ssl.c
@@ -57,7 +57,7 @@
 {
 	SSL *ssl;
 	int n;
-	struct libwebsocket_context *context;
+	struct lws_context *context;
 
 	ssl = X509_STORE_CTX_get_ex_data(x509_ctx,
 		SSL_get_ex_data_X509_STORE_CTX_idx());
@@ -78,7 +78,7 @@
 
 LWS_VISIBLE int
 lws_context_init_server_ssl(struct lws_context_creation_info *info,
-		     struct libwebsocket_context *context)
+		     struct lws_context *context)
 {
 	SSL_METHOD *method;
 	int error;
@@ -246,7 +246,7 @@
 #endif
 
 LWS_VISIBLE void
-lws_ssl_destroy(struct libwebsocket_context *context)
+lws_ssl_destroy(struct lws_context *context)
 {
 	if (context->ssl_ctx)
 		SSL_CTX_free(context->ssl_ctx);
@@ -278,7 +278,7 @@
 #ifndef LWS_NO_CLIENT
 
 int lws_context_init_client_ssl(struct lws_context_creation_info *info,
-			    struct libwebsocket_context *context)
+			    struct lws_context *context)
 {
 	int error;
 	int n;
@@ -406,8 +406,8 @@
 #endif
 
 LWS_VISIBLE void
-lws_ssl_remove_wsi_from_buffered_list(struct libwebsocket_context *context,
-		     struct libwebsocket *wsi)
+lws_ssl_remove_wsi_from_buffered_list(struct lws_context *context,
+		     struct lws *wsi)
 {
 	if (!wsi->pending_read_list_prev &&
 	    !wsi->pending_read_list_next &&
@@ -432,8 +432,8 @@
 }
 
 LWS_VISIBLE int
-lws_ssl_capable_read(struct libwebsocket_context *context,
-		     struct libwebsocket *wsi, unsigned char *buf, int len)
+lws_ssl_capable_read(struct lws_context *context,
+		     struct lws *wsi, unsigned char *buf, int len)
 {
 	int n;
 
@@ -477,7 +477,7 @@
 }
 
 LWS_VISIBLE int
-lws_ssl_pending(struct libwebsocket *wsi)
+lws_ssl_pending(struct lws *wsi)
 {
 	if (!wsi->ssl)
 		return 0;
@@ -486,7 +486,7 @@
 }
 
 LWS_VISIBLE int
-lws_ssl_capable_write(struct libwebsocket *wsi, unsigned char *buf, int len)
+lws_ssl_capable_write(struct lws *wsi, unsigned char *buf, int len)
 {
 	int n;
 
@@ -508,7 +508,7 @@
 }
 
 LWS_VISIBLE int
-lws_ssl_close(struct libwebsocket *wsi)
+lws_ssl_close(struct lws *wsi)
 {
 	int n;
 
@@ -525,12 +525,12 @@
 }
 
 LWS_VISIBLE int
-lws_server_socket_service_ssl(struct libwebsocket_context *context,
-		struct libwebsocket **pwsi, struct libwebsocket *new_wsi,
-			int accept_fd, struct libwebsocket_pollfd *pollfd)
+lws_server_socket_service_ssl(struct lws_context *context,
+		struct lws **pwsi, struct lws *new_wsi,
+			int accept_fd, struct lws_pollfd *pollfd)
 {
 	int n, m;
-	struct libwebsocket *wsi = *pwsi;
+	struct lws *wsi = *pwsi;
 #ifndef USE_WOLFSSL
 	BIO *bio;
 #endif
@@ -711,7 +711,7 @@
 }
 
 LWS_VISIBLE void
-lws_ssl_context_destroy(struct libwebsocket_context *context)
+lws_ssl_context_destroy(struct lws_context *context)
 {
 	if (context->ssl_ctx)
 		SSL_CTX_free(context->ssl_ctx);