api rationalization: eliminate all libwebsocket[s]_ prefixes
authorAndy Green <andy.green@linaro.org>
Fri, 4 Dec 2015 03:08:32 +0000 (11:08 +0800)
committerAndy Green <andy.green@linaro.org>
Fri, 4 Dec 2015 03:08:32 +0000 (11:08 +0800)
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>
41 files changed:
README.coding.md
lib/client-handshake.c
lib/client-parser.c
lib/client.c
lib/context.c
lib/extension-deflate-frame.c
lib/extension-deflate-frame.h
lib/extension-deflate-stream.c
lib/extension-deflate-stream.h
lib/extension.c
lib/handshake.c
lib/header.c
lib/hpack.c
lib/http2.c
lib/libev.c
lib/libwebsockets.c
lib/libwebsockets.h
lib/lws-plat-mbed3.c
lib/lws-plat-mbed3.cpp
lib/lws-plat-unix.c
lib/lws-plat-win.c
lib/output.c
lib/parsers.c
lib/pollfd.c
lib/private-libwebsockets.h
lib/server-handshake.c
lib/server.c
lib/service.c
lib/ssl-http2.c
lib/ssl.c
libwebsockets-api-doc.html
test-server/test-client.c
test-server/test-echo.c
test-server/test-fraggle.c
test-server/test-ping.c
test-server/test-server-dumb-increment.c
test-server/test-server-http.c
test-server/test-server-mirror.c
test-server/test-server-pthreads.c
test-server/test-server.c
test-server/test-server.h

index c221347..28be02c 100644 (file)
@@ -61,8 +61,8 @@ clients).
 If you want to send something, do not just send it but request a callback
 when the socket is writeable using
 
- - `libwebsocket_callback_on_writable(context, wsi)`` for a specific `wsi`, or
- - `libwebsocket_callback_on_writable_all_protocol(protocol)` for all connections
+ - `lws_callback_on_writable(context, wsi)`` for a specific `wsi`, or
+ - `lws_callback_on_writable_all_protocol(protocol)` for all connections
 using that protocol to get a callback when next writeable.
 
 Usually you will get called back immediately next time around the service
@@ -93,7 +93,7 @@ Closing connections from the user side
 When you want to close a connection, you do it by returning `-1` from a
 callback for that connection.
 
-You can provoke a callback by calling `libwebsocket_callback_on_writable` on
+You can provoke a callback by calling `lws_callback_on_writable` on
 the wsi, then notice in the callback you want to close it and just return -1.
 But usually, the decision to close is made in a callback already and returning
 -1 is simple.
@@ -112,7 +112,7 @@ Fragmented messages
 -------------------
 
 To support fragmented messages you need to check for the final
-frame of a message with `libwebsocket_is_final_fragment`. This
+frame of a message with `lws_is_final_fragment`. This
 check can be combined with `libwebsockets_remaining_packet_payload`
 to gather the whole contents of a message, eg:
 
@@ -120,9 +120,9 @@ to gather the whole contents of a message, eg:
     case LWS_CALLBACK_RECEIVE:
     {
         Client * const client = (Client *)user;
-        const size_t remaining = libwebsockets_remaining_packet_payload(wsi);
+        const size_t remaining = lws_remaining_packet_payload(wsi);
 
-        if (!remaining && libwebsocket_is_final_fragment(wsi)) {
+        if (!remaining && lws_is_final_fragment(wsi)) {
             if (client->HasFragments()) {
                 client->AppendMessageFragment(in, len, 0);
                 in = (void *)client->GetMessage();
@@ -178,7 +178,7 @@ Four callbacks `LWS_CALLBACK_ADD_POLL_FD`, `LWS_CALLBACK_DEL_POLL_FD`,
 appear in the callback for protocol 0 and allow interface code to
 manage socket descriptors in other poll loops.
 
-You can pass all pollfds that need service to `libwebsocket_service_fd()`, even
+You can pass all pollfds that need service to `lws_service_fd()`, even
 if the socket or file does not belong to **libwebsockets** it is safe.
 
 If **libwebsocket** handled it, it zeros the pollfd `revents` field before returning.
@@ -261,7 +261,7 @@ if left `NULL`, then the "DEFAULT" set of ciphers are all possible to select.
 Async nature of client connections
 ----------------------------------
 
-When you call `libwebsocket_client_connect(..)` and get a `wsi` back, it does not
+When you call `lws_client_connect(..)` and get a `wsi` back, it does not
 mean your connection is active.  It just mean it started trying to connect.
 
 Your client connection is actually active only when you receive
@@ -273,6 +273,6 @@ other reasons, if any of that happens you'll get a
 `wsi`.
 
 After attempting the connection and getting back a non-`NULL` `wsi` you should
-loop calling `libwebsocket_service()` until one of the above callbacks occurs.
+loop calling `lws_service()` until one of the above callbacks occurs.
 
 As usual, see [test-client.c](test-server/test-client.c) for example code.
index 7c642eb..11dcc29 100644 (file)
@@ -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 @@ failed:
  *     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 @@ lws_client_connect(struct libwebsocket_context *context,
                              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 @@ bail:
  *     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 @@ lws_client_connect_extended(struct libwebsocket_context *context,
                              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);
index 0795926..7eaf220 100644 (file)
@@ -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 @@ ping_drop:
                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);
index 293df31..895a523 100644 (file)
@@ -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 @@ int lws_handshake_client(struct libwebsocket *wsi, unsigned char **buf, size_t l
        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 @@ strtolower(char *s)
 }
 
 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 @@ lws_client_interpret_server_handshake(struct libwebsocket_context *context,
        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 @@ bail2:
 
 
 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 @@ lws_generate_client_handshake(struct libwebsocket_context *context,
        char *p = pkt;
        int n;
 #ifndef LWS_NO_EXTENSIONS
-       struct libwebsocket_extension *ext;
+       struct lws_extension *ext;
        int ext_count = 0;
 #endif
 
index 5ef85a2..8651d44 100644 (file)
@@ -48,7 +48,7 @@ lws_get_library_version(void)
  *     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 @@ lws_get_library_version(void)
  *     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 @@ lws_create_context(struct lws_context_creation_info *info)
        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 @@ lws_create_context(struct lws_context_creation_info *info)
        /* 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 @@ lws_create_context(struct lws_context_creation_info *info)
 
        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 @@ bail:
  *     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 @@ lws_context_destroy(struct libwebsocket_context *context)
 #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;
index 96285a9..87eac8b 100644 (file)
@@ -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 =
index 00a4447..5e5b3f1 100644 (file)
@@ -18,8 +18,8 @@ struct lws_ext_deflate_frame_conn {
 };
 
 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);
index addaa2c..f69b12b 100644 (file)
@@ -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 =
index fcadc07..b417790 100644 (file)
@@ -13,8 +13,8 @@ struct lws_ext_deflate_stream_conn {
 };
 
 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);
index 7451ba2..ad6a37e 100644 (file)
@@ -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 @@ struct libwebsocket_extension libwebsocket_internal_extensions[] = {
 
 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_active(struct libwebsocket *wsi, int reason,
 }
 
 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_ext_callback_for_each_extension_type(
 }
 
 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 @@ lws_issue_raw_ext_access(struct libwebsocket *wsi,
 }
 
 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;
index 229fb8c..1c783a6 100644 (file)
@@ -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;
index d974737..8e985db 100644 (file)
@@ -29,8 +29,8 @@ const unsigned char *lws_token_to_string(enum lws_token_indexes token)
        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 @@ int lws_add_http_header_by_name(struct libwebsocket_context *context,
        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 @@ int lws_finalize_http_header(struct libwebsocket_context *context,
        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 @@ int lws_add_http_header_by_token(struct libwebsocket_context *context,
        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 @@ static const char *err500[] = {
        "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 @@ int lws_add_http_header_status(struct libwebsocket_context *context,
  *     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;
index 63c7595..4cadd39 100644 (file)
@@ -189,13 +189,13 @@ static int huftable_decode(int pos, char c)
        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 @@ static int lws_frag_start(struct libwebsocket *wsi, int hdr_token_idx)
        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 @@ static int lws_frag_append(struct libwebsocket *wsi, unsigned char c)
        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 @@ static int lws_frag_end(struct libwebsocket *wsi)
        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 @@ static void lws_dump_header(struct libwebsocket *wsi, int hdr)
        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 @@ static int lws_token_from_index(struct libwebsocket *wsi, int index, char **arg,
        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 @@ bail1:
        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 @@ static int lws_write_indexed_hdr(struct libwebsocket *wsi, int idx)
        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 @@ static int lws_http2_num(int starting_bits, unsigned long num, unsigned char **p
        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 @@ int lws_add_http2_header_by_name(struct libwebsocket_context *context,
        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 @@ int lws_add_http2_header_by_token(struct libwebsocket_context *context,
        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)
index b73d8bf..3b49c47 100644 (file)
@@ -38,8 +38,8 @@ void lws_http2_init(struct http2_settings *settings)
        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 @@ lws_http2_wsi_from_id(struct libwebsocket *wsi, unsigned int sid)
        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 @@ lws_create_server_child_wsi(struct libwebsocket_context *context, struct libwebs
        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 @@ lws_http2_interpret_settings_payload(struct http2_settings *settings, unsigned c
        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 @@ struct libwebsocket *lws_http2_get_network_wsi(struct libwebsocket *wsi)
        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 @@ int lws_http2_frame_write(struct libwebsocket *wsi, int type, int flags, unsigne
        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 @@ static const char * https_client_preface =
        "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 @@ update_end_headers:
        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 @@ int lws_http2_do_pps_send(struct libwebsocket_context *context, struct libwebsoc
        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;
index 323e2aa..d6858e1 100644 (file)
@@ -32,9 +32,9 @@ void lws_feature_status_libev(struct lws_context_creation_info *info)
 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_sigint_cb(struct ev_loop *loop,
 }
 
 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_sigint_cfg(
 
 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_initloop(
 }
 
 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_libev_accept(struct libwebsocket_context *context,
 }
 
 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_libev_io(struct libwebsocket_context *context,
 }
 
 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_libev_init_fd_table(struct libwebsocket_context *context)
 }
 
 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);
index fa1fc43..787c4a0 100644 (file)
@@ -38,7 +38,7 @@ static const char * const log_level_names[] = {
 };
 
 void
-lws_free_wsi(struct libwebsocket *wsi)
+lws_free_wsi(struct lws *wsi)
 {
        if (!wsi)
                return;
@@ -61,8 +61,8 @@ lws_free_wsi(struct libwebsocket *wsi)
 }
 
 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 @@ just_kill_connection:
 }
 
 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_addresses(struct libwebsocket_context *context,
 /**
  * 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_get_addresses(struct libwebsocket_context *context,
  */
 
 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 @@ bail:
  *     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_context_user(struct libwebsocket_context *context)
 
 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_callback_all_protocol(
  */
 
 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_set_timeout(struct libwebsocket *wsi,
  */
 
 LWS_VISIBLE int
-lws_get_socket_fd(struct libwebsocket *wsi)
+lws_get_socket_fd(struct lws *wsi)
 {
        return wsi->sock;
 }
@@ -558,7 +558,7 @@ lws_get_socket_fd(struct libwebsocket *wsi)
 
 #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_latency(struct libwebsocket_context *context, struct libwebsocket *wsi,
  */
 
 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_rx_flow_control(struct libwebsocket *wsi, int enable)
 
 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 @@ lws_rx_flow_allow_all_protocol(
  * @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 @@ int user_callback_handle_rxflow(callback_function callback_function,
 
 
 /**
- * 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 @@ int user_callback_handle_rxflow(callback_function callback_function,
  * 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 @@ auth_too_long:
  *     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 @@ LWS_VISIBLE void lws_set_log_level(int level, void (*log_emit_function)(int leve
  *     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_is_ssl(struct libwebsocket *wsi)
  */
 
 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 @@ void lws_set_protocol_write_pending(struct libwebsocket_context *context,
 }
 
 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_get_peer_write_allowance(struct libwebsocket *wsi)
 }
 
 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 @@ lws_union_transition(struct libwebsocket *wsi, enum connection_mode mode)
  * 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 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
 
 #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 @@ libwebsocket_cancel_service(struct libwebsocket_context *context)
 #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 @@ libwebsocket_sigint_cfg(
 
 #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 @@ libwebsocket_sigint_cb(
 
 #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 @@ libwebsocket_set_timeout(struct libwebsocket *wsi,
 
 #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 @@ libwebsocket_write(struct libwebsocket *wsi, unsigned char *buf, size_t len,
 
 #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 @@ libwebsockets_serve_http_file(struct libwebsocket_context *context,
 #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 @@ libwebsockets_get_protocol(struct libwebsocket *wsi)
 #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 @@ libwebsocket_callback_on_writable(struct libwebsocket_context *context,
 #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 @@ libwebsocket_client_connect(struct libwebsocket_context *clients,
        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 @@ libwebsocket_client_connect_extended(struct libwebsocket_context *clients,
 
 #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 @@ libwebsockets_get_peer_addresses(struct libwebsocket_context *context,
 
 #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 @@ libwebsockets_SHA1(const unsigned char *d, size_t n, unsigned char *md)
 
 #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 @@ libwebsocket_read(struct libwebsocket_context *context, struct libwebsocket *wsi
 
 #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();
index 9697880..6b3112d 100644 (file)
 
 #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
 #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 @@ namespace {
 }
 using namespace mbed::Sockets::v0;
 
-struct libwebsocket;
-struct libwebsocket_context;
+struct lws;
+struct lws_context;
 
 class lws_conn {
        public:
@@ -87,19 +94,19 @@ class lws_conn {
        }
 
 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 @@ LWS_VISIBLE LWS_EXTERN void lwsl_hexdump(void *buf, size_t len);
 
 #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 @@ LWS_VISIBLE LWS_EXTERN void lwsl_hexdump(void *buf, size_t len);
 /* 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 @@ enum libwebsocket_context_options {
        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 @@ enum libwebsocket_callback_reasons {
 #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 @@ struct pollfd {
 #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 @@ enum http_status {
        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 @@ struct libwebsocket_extension;
  *
  *     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 @@ struct libwebsocket_extension;
  *     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 @@ struct libwebsocket_extension;
  *             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 @@ struct libwebsocket_extension;
  *
  *     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 @@ struct libwebsocket_extension;
  *             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 @@ typedef int (callback_function)(struct libwebsocket_context *context,
  *             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 @@ typedef int (extension_callback_function)(struct libwebsocket_context *context,
  * @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 @@ typedef int (extension_callback_function)(struct libwebsocket_context *context,
  *     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 @@ struct libwebsocket_protocols {
         * 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 @@ struct libwebsocket_protocols {
  *                             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 @@ struct libwebsocket_extension {
  *             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 libwebsocket_extension {
 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 @@ void lws_set_log_level(int level,
 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 @@ lws_sigint_cb(
 #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 @@ enum pending_timeout {
 };
 
 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 @@ lws_set_timeout(struct libwebsocket *wsi,
 #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(struct libwebsocket *wsi, unsigned char *buf, size_t len,
        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_serve_http_file_fragment(struct lws_context *context,
+                       struct lws *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 int
+lws_return_http_status(struct lws_context *context,
+                      struct lws *wsi, unsigned int code,
+                      const char *html_body);
 
-LWS_VISIBLE LWS_EXTERN const struct libwebsocket_protocols *
-lws_get_protocol(struct libwebsocket *wsi);
+LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
+lws_get_protocol(struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_callback_on_writable(struct libwebsocket_context *context,
-                                                     struct libwebsocket *wsi);
+lws_callback_on_writable(struct lws_context *context, struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_callback_on_writable_all_protocol(
-                                const struct libwebsocket_protocols *protocol);
+lws_callback_on_writable_all_protocol(const struct lws_protocols *protocol);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_callback_all_protocol(
-               const struct libwebsocket_protocols *protocol, int reason);
+lws_callback_all_protocol(const struct lws_protocols *protocol, int reason);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_get_socket_fd(struct libwebsocket *wsi);
+lws_get_socket_fd(struct lws *wsi);
 
 LWS_VISIBLE LWS_EXTERN int
-lws_is_final_fragment(struct libwebsocket *wsi);
+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 @@ lws_remaining_packet_payload(struct libwebsocket *wsi);
  * 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 @@ lws_client_connect(struct libwebsocket_context *clients,
                              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 @@ lws_client_connect_extended(struct libwebsocket_context *clients,
                              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 @@ lws_get_library_version(void);
 /* 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_hdr_copy(struct libwebsocket *wsi, char *dest, int len,
  */
 
 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
 
 /*
index de5956f..06d3ca8 100644 (file)
@@ -12,7 +12,7 @@ unsigned long long time_in_microseconds(void)
        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 @@ LWS_VISIBLE int lws_get_random(struct libwebsocket_context *context,
  * 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_send_pipe_choked(struct libwebsocket *wsi)
 }
 
 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 @@ lws_poll_listen_fd(struct libwebsocket_pollfd *fd)
  *     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 void lwsl_emit_syslog(int level, const char *line)
 }
 
 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_plat_drop_app_privileges(struct lws_context_creation_info *info)
 }
 
 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_plat_context_early_init(void)
 }
 
 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_plat_inet_ntop(int af, const void *src, char *dst, int cnt)
 }
 
 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 @@ insert_wsi(struct libwebsocket_context *context, struct libwebsocket *wsi)
 }
 
 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;
index 7d5ddc2..a96cbb7 100644 (file)
@@ -21,10 +21,10 @@ extern "C" void mbed3_delete_tcp_stream_socket(void *sock)
        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 @@ void lws_conn::serialized_writeable(struct libwebsocket *_wsi)
        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 @@ extern "C" void mbed3_tcp_stream_bind(void *sock, int port, struct libwebsocket
        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" void mbed3_tcp_stream_accept(void *sock, struct libwebsocket *wsi)
 }
 
 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 @@ lws_plat_change_pollfd(struct libwebsocket_context *context,
        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 @@ lws_plat_change_pollfd(struct libwebsocket_context *context,
 }
 
 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 @@ lws_ssl_capable_read_no_ssl(struct libwebsocket_context *context,
 }
 
 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 @@ void lws_conn_listener::start(const uint16_t port)
 
 int lws_conn::actual_onRX(Socket *s)
 {
-       struct libwebsocket_pollfd pollfd;
+       struct lws_pollfd pollfd;
        
        (void)s;
 
@@ -215,8 +215,8 @@ void lws_conn_listener::onIncoming(TCPListener *tl, void *impl)
        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 @@ wsi_from_fd(struct libwebsocket_context *context, lws_sockfd_type fd)
 }
 
 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 @@ lws_plat_insert_socket_into_fds(struct libwebsocket_context *context,
 }
 
 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 @@ void lws_conn_listener::onDisconnect(TCPStream *s)
 }
 
 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 @@ lws_plat_service(struct libwebsocket_context *context, int timeout_ms)
 
 void lws_conn::onSent(Socket *s, uint16_t len)
 {
-       struct libwebsocket_pollfd pollfd;
+       struct lws_pollfd pollfd;
 
        (void)s;
        (void)len;
index 720e3d0..a087439 100644 (file)
@@ -14,15 +14,15 @@ unsigned long long time_in_microseconds(void)
        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_send_pipe_choked(struct libwebsocket *wsi)
 }
 
 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 @@ static void lws_sigusr2(int sig)
  *     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 void lwsl_emit_syslog(int level, const char *line)
 }
 
 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_plat_service(struct libwebsocket_context *context, int timeout_ms)
 }
 
 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_plat_drop_app_privileges(struct lws_context_creation_info *info)
 }
 
 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_plat_init_lookup(struct libwebsocket_context *context)
 }
 
 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_plat_context_early_init(void)
 }
 
 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 @@ lws_plat_context_late_destroy(struct libwebsocket_context *context)
 /* 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 @@ interface_to_sa(struct libwebsocket_context *context,
 }
 
 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_plat_service_periodic(struct libwebsocket_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)
 {
        return 0;
 }
index 0610beb..9ed6528 100644 (file)
@@ -35,8 +35,8 @@ time_t time(time_t *t)
 
 /* 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 @@ wsi_from_fd(struct libwebsocket_context *context, int fd)
 }
 
 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 @@ insert_wsi(struct libwebsocket_context *context, struct libwebsocket *wsi)
 }
 
 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 @@ delete_from_fd(struct libwebsocket_context *context, int fd)
        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 @@ LWS_VISIBLE int lws_get_random(struct libwebsocket_context *context,
        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 @@ LWS_VISIBLE int lws_poll_listen_fd(struct libwebsocket_pollfd *fd)
  *     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 void lwsl_emit_syslog(int level, const char *line)
 }
 
 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_plat_service(struct libwebsocket_context *context, int timeout_ms)
 }
 
 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_plat_drop_app_privileges(struct lws_context_creation_info *info)
 }
 
 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_plat_init_lookup(struct libwebsocket_context *context)
 }
 
 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_plat_context_early_init(void)
 }
 
 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_plat_context_early_destroy(struct libwebsocket_context *context)
 }
 
 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_plat_context_late_destroy(struct libwebsocket_context *context)
 }
 
 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 @@ interface_to_sa(struct libwebsocket_context *context,
 }
 
 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_plat_insert_socket_into_fds(struct libwebsocket_context *context,
 }
 
 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;
                
index 42261cd..0cd044d 100644 (file)
@@ -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 @@ LWS_VISIBLE void lwsl_hexdump(void *vbuf, size_t len)
  * 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 @@ handle_truncated_send:
  *     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 @@ send_raw:
 }
 
 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 @@ all_sent:
 
 #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_ssl_capable_read_no_ssl(struct libwebsocket_context *context,
 }
 
 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 @@ lws_ssl_capable_write_no_ssl(struct libwebsocket *wsi, unsigned char *buf, int l
 }
 #endif
 LWS_VISIBLE int
-lws_ssl_pending_no_ssl(struct libwebsocket *wsi)
+lws_ssl_pending_no_ssl(struct lws *wsi)
 {
        (void)wsi;
        return 0;
index c7b47d4..add6220 100644 (file)
@@ -59,7 +59,7 @@ int lextable_decode(int pos, char c)
        }
 }
 
-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 @@ int lws_allocate_header_table(struct libwebsocket *wsi)
        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 @@ LWS_VISIBLE int lws_hdr_total_length(struct libwebsocket *wsi, enum lws_token_in
        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 @@ LWS_VISIBLE int lws_hdr_copy(struct libwebsocket *wsi, char *dest, int len,
        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 @@ char *lws_hdr_simple_ptr(struct libwebsocket *wsi, enum lws_token_indexes h)
        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 @@ static signed char char_to_hex(const char c)
        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 @@ static int issue_char(struct libwebsocket *wsi, unsigned char c)
 }
 
 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 @@ set_parsing_complete:
  * 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 @@ ping_drop:
                                                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 @@ illegal_ctl_length:
  */
 
 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;
 }
index 83e1c9d..79a2c88 100644 (file)
 #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 @@ insert_wsi_socket_into_fds(struct libwebsocket_context *context,
 }
 
 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 @@ remove_wsi_socket_from_fds(struct libwebsocket_context *context,
 }
 
 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_change_pollfd(struct libwebsocket *wsi, int _and, int _or)
  */
 
 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 @@ network_sock:
 
 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);
index 01fcbea..203377a 100644 (file)
@@ -442,39 +442,39 @@ enum {
        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 @@ struct libwebsocket_context {
        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 @@ enum {
 #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 _lws_http2_related {
        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 @@ struct _lws_http2_related {
        /* 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 @@ struct _lws_websocket_related {
        unsigned char ping_pending_flag;
 };
 
-struct libwebsocket {
+struct lws {
 
        /* lifetime members */
 
@@ -853,9 +853,9 @@ struct libwebsocket {
     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 @@ struct libwebsocket {
 #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 @@ struct libwebsocket {
 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 @@ delete_from_fd(struct libwebsocket_context *context, lws_sockfd_type fd);
 #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 @@ lws_handle_POLLOUT_event(struct libwebsocket_context *context,
 #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 @@ lws_ext_callback_for_each_extension_type(
 #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 @@ LWS_EXTERN int get_daemonize_pid();
 #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 @@ enum lws_ssl_capable_status {
 #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 @@ lws_ssl_pending_no_ssl(struct libwebsocket *wsi);
 #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_zalloc(size_t size);
  * 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
index 5962cd8..847cb2f 100644 (file)
 #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 @@ lws_extension_server_handshake(struct libwebsocket_context *context,
 }
 #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;
index d295fcd..1438814 100644 (file)
@@ -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 @@ int lws_context_init_server(struct lws_context_creation_info *info,
        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 @@ int lws_context_init_server(struct lws_context_creation_info *info,
 
        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_context_init_server(struct lws_context_creation_info *info,
 }
 
 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 @@ _lws_rx_flow_control(struct libwebsocket *wsi)
        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 @@ bail_nuke_ah:
 }
 
 
-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 @@ bail_nuke_ah:
        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_create_new_server_wsi(struct libwebsocket_context *context)
  */
 
 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 @@ int lws_http_transaction_completed(struct libwebsocket *wsi)
 }
 
 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 @@ fail:
  */
 
 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 @@ LWS_VISIBLE int lws_serve_http_file(
 }
 
 
-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 @@ int lws_interpret_incoming_packet(struct libwebsocket *wsi,
 }
 
 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)
index 3430399..170d475 100644 (file)
@@ -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 @@ lws_calllback_as_writeable(struct libwebsocket_context *context,
        }
        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 @@ notify:
 
 
 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 @@ lws_service_timeout_check(struct libwebsocket_context *context,
        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 @@ int lws_rxflow_cache(struct libwebsocket *wsi, unsigned char *buf, int n, int le
  *
  *     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 @@ int lws_rxflow_cache(struct libwebsocket *wsi, unsigned char *buf, int n, int le
  */
 
 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 @@ handled:
  */
 
 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);
 }
index caa028c..84c39f5 100644 (file)
@@ -86,7 +86,7 @@ static int alpn_cb(SSL *s, const unsigned char **out,
 #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 @@ lws_context_init_http2_ssl(struct libwebsocket_context *context)
 #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;
index 21d1a3c..6f55826 100644 (file)
--- a/lib/ssl.c
+++ b/lib/ssl.c
@@ -57,7 +57,7 @@ OpenSSL_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx)
 {
        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 @@ OpenSSL_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx)
 
 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 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
 #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 @@ lws_decode_ssl_error(void)
 #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 @@ int lws_context_init_client_ssl(struct lws_context_creation_info *info,
 #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_ssl_remove_wsi_from_buffered_list(struct libwebsocket_context *context,
 }
 
 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 @@ lwsl_err("%s: LWS_SSL_CAPABLE_ERROR\n", __func__);
 }
 
 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_ssl_pending(struct libwebsocket *wsi)
 }
 
 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 @@ lwsl_err("%s: LWS_SSL_CAPABLE_ERROR\n", __func__);
 }
 
 LWS_VISIBLE int
-lws_ssl_close(struct libwebsocket *wsi)
+lws_ssl_close(struct lws *wsi)
 {
        int n;
 
@@ -525,12 +525,12 @@ lws_ssl_close(struct libwebsocket *wsi)
 }
 
 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 @@ fail:
 }
 
 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);
index 7a15045..0abef38 100644 (file)
-<h2>lws_frame_is_binary - </h2>
+<h2>lws_write - Apply protocol then write data to client</h2>
 <i>int</i>
-<b>lws_frame_is_binary</b>
-(<i>struct libwebsocket *</i> <b>wsi</b>)
+<b>lws_write</b>
+(<i>struct lws *</i> <b>wsi</b>,
+<i>unsigned char *</i> <b>buf</b>,
+<i>size_t</i> <b>len</b>,
+<i>enum lws_write_protocol</i> <b>protocol</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>wsi</b>
-<dd>the connection we are inquiring about
+<dd>Websocket instance (available from user callback)
+<dt><b>buf</b>
+<dd>The data to send.  For data being sent on a websocket
+connection (ie, not default http), this buffer MUST have
+LWS_SEND_BUFFER_PRE_PADDING bytes valid BEFORE the pointer
+and an additional LWS_SEND_BUFFER_POST_PADDING bytes valid
+in the buffer after (buf + len).  This is so the protocol
+header and trailer data can be added in-situ.
+<dt><b>len</b>
+<dd>Count of the data bytes in the payload starting from buf
+<dt><b>protocol</b>
+<dd>Use LWS_WRITE_HTTP to reply to an http connection, and one
+of LWS_WRITE_BINARY or LWS_WRITE_TEXT to send appropriate
+data on a websockets connection.  Remember to allow the extra
+bytes before and after buf if LWS_WRITE_BINARY or LWS_WRITE_TEXT
+are used.
 </dl>
 <h3>Description</h3>
 <blockquote>
-This is intended to be called from the LWS_CALLBACK_RECEIVE callback if
-it's interested to see if the frame it's dealing with was sent in binary
-mode.
+This function provides the way to issue data back to the client
+for both http and websocket protocols.
+<p>
+In the case of sending using websocket protocol, be sure to allocate
+valid storage before and after buf as explained above.  This scheme
+allows maximum efficiency of sending data and protocol in a single
+packet while not burdening the user code with any protocol knowledge.
+<p>
+Return may be -1 for a fatal error needing connection close, or a
+positive number reflecting the amount of bytes actually sent.  This
+can be less than the requested number of bytes due to OS memory
+pressure at any given time.
 </blockquote>
 <hr>
-<h2>libwebsockets_remaining_packet_payload - Bytes to come before "overall" rx packet is complete</h2>
-<i>size_t</i>
-<b>libwebsockets_remaining_packet_payload</b>
-(<i>struct libwebsocket *</i> <b>wsi</b>)
+<h2>lws_http_transaction_completed - wait for new http transaction or close</h2>
+<i>int</i>
+<b>lws_http_transaction_completed</b>
+(<i>struct lws *</i> <b>wsi</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>wsi</b>
-<dd>Websocket instance (available from user callback)
+<dd>websocket connection
 </dl>
 <h3>Description</h3>
 <blockquote>
-This function is intended to be called from the callback if the
-user code is interested in "complete packets" from the client.
-libwebsockets just passes through payload as it comes and issues a buffer
-additionally when it hits a built-in limit.  The LWS_CALLBACK_RECEIVE
-callback handler can use this API to find out if the buffer it has just
-been given is the last piece of a "complete packet" from the client --
-when that is the case <b>libwebsockets_remaining_packet_payload</b> will return
-0.
-<p>
-Many protocols won't care becuse their packets are always small.
+Returns 1 if the HTTP connection must close now
+Returns 0 and resets connection to wait for new HTTP header /
+transaction if possible
 </blockquote>
 <hr>
-<h2>lws_get_library_version - </h2>
-<i>const char *</i>
-<b>lws_get_library_version</b>
-(<i></i> <b>void</b>)
+<h2>lws_serve_http_file - Send a file back to the client using http</h2>
+<i>int</i>
+<b>lws_serve_http_file</b>
+(<i>struct lws_context *</i> <b>context</b>,
+<i>struct lws *</i> <b>wsi</b>,
+<i>const char *</i> <b>file</b>,
+<i>const char *</i> <b>content_type</b>,
+<i>const char *</i> <b>other_headers</b>,
+<i>int</i> <b>other_headers_len</b>)
 <h3>Arguments</h3>
 <dl>
-<dt><b>void</b>
-<dd>no arguments
+<dt><b>context</b>
+<dd>libwebsockets context
+<dt><b>wsi</b>
+<dd>Websocket instance (available from user callback)
+<dt><b>file</b>
+<dd>The file to issue over http
+<dt><b>content_type</b>
+<dd>The http content type, eg, text/html
+<dt><b>other_headers</b>
+<dd>NULL or pointer to \0-terminated other header string
 </dl>
 <h3>Description</h3>
 <blockquote>
+This function is intended to be called from the callback in response
+to http requests from the client.  It allows the callback to issue
+local files down the http link in a single step.
 <p>
-returns a const char * to a string like "1.1 178d78c"
-representing the library version followed by the git head hash it
-was built from
+Returning &lt;0 indicates error and the wsi should be closed.  Returning
+&gt;0 indicates the file was completely sent and
+<b>lws_http_transaction_completed</b> called on the wsi (and close if != 0)
+==0 indicates the file transfer is started and needs more service later,
+the wsi should be left alone.
 </blockquote>
 <hr>
-<h2>libwebsockets_get_peer_addresses - Get client address information</h2>
-<i>void</i>
-<b>libwebsockets_get_peer_addresses</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>,
-<i>struct libwebsocket *</i> <b>wsi</b>,
-<i>int</i> <b>fd</b>,
-<i>char *</i> <b>name</b>,
-<i>int</i> <b>name_len</b>,
-<i>char *</i> <b>rip</b>,
-<i>int</i> <b>rip_len</b>)
+<h2>lws_return_http_status - Return simple http status</h2>
+<i>int</i>
+<b>lws_return_http_status</b>
+(<i>struct lws_context *</i> <b>context</b>,
+<i>struct lws *</i> <b>wsi</b>,
+<i>unsigned int</i> <b>code</b>,
+<i>const char *</i> <b>html_body</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>context</b>
-<dd>Libwebsockets context
+<dd>libwebsockets context
 <dt><b>wsi</b>
-<dd>Local struct libwebsocket associated with
-<dt><b>fd</b>
-<dd>Connection socket descriptor
-<dt><b>name</b>
-<dd>Buffer to take client address name
-<dt><b>name_len</b>
-<dd>Length of client address name buffer
-<dt><b>rip</b>
-<dd>Buffer to take client address IP qotted quad
-<dt><b>rip_len</b>
-<dd>Length of client address IP buffer
+<dd>Websocket instance (available from user callback)
+<dt><b>code</b>
+<dd>Status index, eg, 404
+<dt><b>html_body</b>
+<dd>User-readable HTML description &lt; 1KB, or NULL
 </dl>
 <h3>Description</h3>
 <blockquote>
-This function fills in <tt><b>name</b></tt> and <tt><b>rip</b></tt> with the name and IP of
-the client connected with socket descriptor <tt><b>fd</b></tt>.  Names may be
-truncated if there is not enough room.  If either cannot be
-determined, they will be returned as valid zero-length strings.
+Helper to report HTTP errors back to the client cleanly and
+consistently
 </blockquote>
 <hr>
-<h2>libwebsocket_service_fd - Service polled socket with something waiting</h2>
-<i>int</i>
-<b>libwebsocket_service_fd</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>,
-<i>struct pollfd *</i> <b>pollfd</b>)
+<h2>lws_client_connect - Connect to another websocket server</h2>
+<i>struct lws *</i>
+<b>lws_client_connect</b>
+(<i>struct lws_context *</i> <b>context</b>,
+<i>const char *</i> <b>address</b>,
+<i>int</i> <b>port</b>,
+<i>int</i> <b>ssl_connection</b>,
+<i>const char *</i> <b>path</b>,
+<i>const char *</i> <b>host</b>,
+<i>const char *</i> <b>origin</b>,
+<i>const char *</i> <b>protocol</b>,
+<i>int</i> <b>ietf_version_or_minus_one</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>context</b>
 <dd>Websocket context
-<dt><b>pollfd</b>
-<dd>The pollfd entry describing the socket fd and which events
-happened.
+<dt><b>address</b>
+<dd>Remote server address, eg, "myserver.com"
+<dt><b>port</b>
+<dd>Port to connect to on the remote server, eg, 80
+<dt><b>ssl_connection</b>
+<dd>0 = ws://, 1 = wss:// encrypted, 2 = wss:// allow self
+signed certs
+<dt><b>path</b>
+<dd>Websocket path on server
+<dt><b>host</b>
+<dd>Hostname on server
+<dt><b>origin</b>
+<dd>Socket origin name
+<dt><b>protocol</b>
+<dd>Comma-separated list of protocols being asked for from
+the server, or just one.  The server will pick the one it
+likes best.  If you don't want to specify a protocol, which is
+legal, use NULL here.
+<dt><b>ietf_version_or_minus_one</b>
+<dd>-1 to ask to connect using the default, latest
+protocol supported, or the specific protocol ordinal
 </dl>
 <h3>Description</h3>
 <blockquote>
-This function takes a pollfd that has POLLIN or POLLOUT activity and
-services it according to the state of the associated
-struct libwebsocket.
-<p>
-The one call deals with all "service" that might happen on a socket
-including listen accepts, http files as well as websocket protocol.
-<p>
-If a pollfd says it has something, you can just pass it to
-<b>libwebsocket_serice_fd</b> 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-&gt;revents will be zeroed now.
-<p>
-If the socket is foreign to lws, it leaves revents alone.  So you can
-see if you should service yourself by checking the pollfd revents
-after letting lws try to service it.
+This function creates a connection to a remote server
 </blockquote>
 <hr>
-<h2>libwebsocket_context_destroy - Destroy the websocket context</h2>
-<i>void</i>
-<b>libwebsocket_context_destroy</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>)
+<h2>lws_client_connect_extended - Connect to another websocket server</h2>
+<i>struct lws *</i>
+<b>lws_client_connect_extended</b>
+(<i>struct lws_context *</i> <b>context</b>,
+<i>const char *</i> <b>address</b>,
+<i>int</i> <b>port</b>,
+<i>int</i> <b>ssl_connection</b>,
+<i>const char *</i> <b>path</b>,
+<i>const char *</i> <b>host</b>,
+<i>const char *</i> <b>origin</b>,
+<i>const char *</i> <b>protocol</b>,
+<i>int</i> <b>ietf_version_or_minus_one</b>,
+<i>void *</i> <b>userdata</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>context</b>
 <dd>Websocket context
+<dt><b>address</b>
+<dd>Remote server address, eg, "myserver.com"
+<dt><b>port</b>
+<dd>Port to connect to on the remote server, eg, 80
+<dt><b>ssl_connection</b>
+<dd>0 = ws://, 1 = wss:// encrypted, 2 = wss:// allow self
+signed certs
+<dt><b>path</b>
+<dd>Websocket path on server
+<dt><b>host</b>
+<dd>Hostname on server
+<dt><b>origin</b>
+<dd>Socket origin name
+<dt><b>protocol</b>
+<dd>Comma-separated list of protocols being asked for from
+the server, or just one.  The server will pick the one it
+likes best.
+<dt><b>ietf_version_or_minus_one</b>
+<dd>-1 to ask to connect using the default, latest
+protocol supported, or the specific protocol ordinal
+<dt><b>userdata</b>
+<dd>Pre-allocated user data
 </dl>
 <h3>Description</h3>
 <blockquote>
-This function closes any active connections and then frees the
-context.  After calling this, any further use of the context is
-undefined.
+This function creates a connection to a remote server
 </blockquote>
 <hr>
-<h2>libwebsocket_context_user - get the user data associated with the context</h2>
-<i>LWS_EXTERN void *</i>
-<b>libwebsocket_context_user</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>)
+<h2>lws_service_fd - Service polled socket with something waiting</h2>
+<i>int</i>
+<b>lws_service_fd</b>
+(<i>struct lws_context *</i> <b>context</b>,
+<i>struct lws_pollfd *</i> <b>pollfd</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>context</b>
 <dd>Websocket context
+<dt><b>pollfd</b>
+<dd>The pollfd entry describing the socket fd and which events
+happened.
 </dl>
 <h3>Description</h3>
 <blockquote>
-This returns the optional user allocation that can be attached to
-the context the sockets live in at context_create time.  It's a way
-to let all sockets serviced in the same context share data without
-using globals statics in the user code.
+This function takes a pollfd that has POLLIN or POLLOUT activity and
+services it according to the state of the associated
+struct lws.
+<p>
+The one call deals with all "service" that might happen on a socket
+including listen accepts, http files as well as websocket protocol.
+<p>
+If a pollfd says it has something, you can just pass it to
+<b>lws_service_fd</b> 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-&gt;revents will be zeroed now.
+<p>
+If the socket is foreign to lws, it leaves revents alone.  So you can
+see if you should service yourself by checking the pollfd revents
+after letting lws try to service it.
 </blockquote>
 <hr>
-<h2>libwebsocket_service - Service any pending websocket activity</h2>
+<h2>lws_service - Service any pending websocket activity</h2>
 <i>int</i>
-<b>libwebsocket_service</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>,
+<b>lws_service</b>
+(<i>struct lws_context *</i> <b>context</b>,
 <i>int</i> <b>timeout_ms</b>)
 <h3>Arguments</h3>
 <dl>
@@ -195,33 +277,114 @@ would call it with a timeout_ms of 0, so it returns immediately if
 nothing is pending, or as soon as it services whatever was pending.
 </blockquote>
 <hr>
-<h2>libwebsocket_callback_on_writable - Request a callback when this socket becomes able to be written to without blocking</h2>
+<h2>lws_frame_is_binary - </h2>
 <i>int</i>
-<b>libwebsocket_callback_on_writable</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>,
-<i>struct libwebsocket *</i> <b>wsi</b>)
+<b>lws_frame_is_binary</b>
+(<i>struct lws *</i> <b>wsi</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>wsi</b>
+<dd>the connection we are inquiring about
+</dl>
+<h3>Description</h3>
+<blockquote>
+This is intended to be called from the LWS_CALLBACK_RECEIVE callback if
+it's interested to see if the frame it's dealing with was sent in binary
+mode.
+</blockquote>
+<hr>
+<h2>lws_remaining_packet_payload - Bytes to come before "overall" rx packet is complete</h2>
+<i>size_t</i>
+<b>lws_remaining_packet_payload</b>
+(<i>struct lws *</i> <b>wsi</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>wsi</b>
+<dd>Websocket instance (available from user callback)
+</dl>
+<h3>Description</h3>
+<blockquote>
+This function is intended to be called from the callback if the
+user code is interested in "complete packets" from the client.
+libwebsockets just passes through payload as it comes and issues a buffer
+additionally when it hits a built-in limit.  The LWS_CALLBACK_RECEIVE
+callback handler can use this API to find out if the buffer it has just
+been given is the last piece of a "complete packet" from the client --
+when that is the case <b>lws_remaining_packet_payload</b> will return
+0.
+<p>
+Many protocols won't care becuse their packets are always small.
+</blockquote>
+<hr>
+<h2>lws_get_peer_addresses - Get client address information</h2>
+<i>void</i>
+<b>lws_get_peer_addresses</b>
+(<i>struct lws_context *</i> <b>context</b>,
+<i>struct lws *</i> <b>wsi</b>,
+<i>lws_sockfd_type</i> <b>fd</b>,
+<i>char *</i> <b>name</b>,
+<i>int</i> <b>name_len</b>,
+<i>char *</i> <b>rip</b>,
+<i>int</i> <b>rip_len</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>context</b>
-<dd>libwebsockets context
+<dd>Libwebsockets context
 <dt><b>wsi</b>
-<dd>Websocket connection instance to get callback for
+<dd>Local struct lws associated with
+<dt><b>fd</b>
+<dd>Connection socket descriptor
+<dt><b>name</b>
+<dd>Buffer to take client address name
+<dt><b>name_len</b>
+<dd>Length of client address name buffer
+<dt><b>rip</b>
+<dd>Buffer to take client address IP dotted quad
+<dt><b>rip_len</b>
+<dd>Length of client address IP buffer
+</dl>
+<h3>Description</h3>
+<blockquote>
+This function fills in <tt><b>name</b></tt> and <tt><b>rip</b></tt> with the name and IP of
+the client connected with socket descriptor <tt><b>fd</b></tt>.  Names may be
+truncated if there is not enough room.  If either cannot be
+determined, they will be returned as valid zero-length strings.
+</blockquote>
+<hr>
+<h2>lws_context_user - get the user data associated with the context</h2>
+<i>LWS_EXTERN void *</i>
+<b>lws_context_user</b>
+(<i>struct lws_context *</i> <b>context</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>context</b>
+<dd>Websocket context
 </dl>
+<h3>Description</h3>
+<blockquote>
+This returns the optional user allocation that can be attached to
+the context the sockets live in at context_create time.  It's a way
+to let all sockets serviced in the same context share data without
+using globals statics in the user code.
+</blockquote>
 <hr>
-<h2>libwebsocket_callback_on_writable_all_protocol - Request a callback for all connections using the given protocol when it becomes possible to write to each socket without blocking in turn.</h2>
+<h2>lws_callback_all_protocol - Callback all connections using the given protocol with the given reason</h2>
 <i>int</i>
-<b>libwebsocket_callback_on_writable_all_protocol</b>
-(<i>const struct libwebsocket_protocols *</i> <b>protocol</b>)
+<b>lws_callback_all_protocol</b>
+(<i>const struct lws_protocols *</i> <b>protocol</b>,
+<i>int</i> <b>reason</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>protocol</b>
 <dd>Protocol whose connections will get callbacks
+<dt><b>reason</b>
+<dd>Callback reason index
 </dl>
 <hr>
-<h2>libwebsocket_set_timeout - marks the wsi as subject to a timeout</h2>
+<h2>lws_set_timeout - marks the wsi as subject to a timeout</h2>
 <i>void</i>
-<b>libwebsocket_set_timeout</b>
-(<i>struct libwebsocket *</i> <b>wsi</b>,
+<b>lws_set_timeout</b>
+(<i>struct lws *</i> <b>wsi</b>,
 <i>enum pending_timeout</i> <b>reason</b>,
 <i>int</i> <b>secs</b>)
 <h3>Arguments</h3>
@@ -239,10 +402,10 @@ nothing is pending, or as soon as it services whatever was pending.
 You will not need this unless you are doing something special
 </blockquote>
 <hr>
-<h2>libwebsocket_get_socket_fd - returns the socket file descriptor</h2>
+<h2>lws_get_socket_fd - returns the socket file descriptor</h2>
 <i>int</i>
-<b>libwebsocket_get_socket_fd</b>
-(<i>struct libwebsocket *</i> <b>wsi</b>)
+<b>lws_get_socket_fd</b>
+(<i>struct lws *</i> <b>wsi</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>wsi</b>
@@ -254,10 +417,10 @@ You will not need this unless you are doing something special
 You will not need this unless you are doing something special
 </blockquote>
 <hr>
-<h2>libwebsocket_rx_flow_control - Enable and disable socket servicing for receieved packets.</h2>
+<h2>lws_rx_flow_control - Enable and disable socket servicing for received packets.</h2>
 <i>int</i>
-<b>libwebsocket_rx_flow_control</b>
-(<i>struct libwebsocket *</i> <b>wsi</b>,
+<b>lws_rx_flow_control</b>
+(<i>struct lws *</i> <b>wsi</b>,
 <i>int</i> <b>enable</b>)
 <h3>Arguments</h3>
 <dl>
@@ -273,10 +436,10 @@ If the output side of a server process becomes choked, this allows flow
 control for the input side.
 </blockquote>
 <hr>
-<h2>libwebsocket_rx_flow_allow_all_protocol - Allow all connections with this protocol to receive</h2>
+<h2>lws_rx_flow_allow_all_protocol - Allow all connections with this protocol to receive</h2>
 <i>void</i>
-<b>libwebsocket_rx_flow_allow_all_protocol</b>
-(<i>const struct libwebsocket_protocols *</i> <b>protocol</b>)
+<b>lws_rx_flow_allow_all_protocol</b>
+(<i>const struct lws_protocols *</i> <b>protocol</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>protocol</b>
@@ -290,10 +453,10 @@ call this to have the RX flow restriction removed from all connections using
 the given protocol.
 </blockquote>
 <hr>
-<h2>libwebsocket_canonical_hostname - returns this host's hostname</h2>
+<h2>lws_canonical_hostname - returns this host's hostname</h2>
 <i>const char *</i>
-<b>libwebsocket_canonical_hostname</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>)
+<b>lws_canonical_hostname</b>
+(<i>struct lws_context *</i> <b>context</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>context</b>
@@ -307,47 +470,37 @@ when making a client connection.  You can only call it after the context
 has been created.
 </blockquote>
 <hr>
-<h2>libwebsocket_create_context - Create the websocket handler</h2>
-<i>struct libwebsocket_context *</i>
-<b>libwebsocket_create_context</b>
-(<i>struct lws_context_creation_info *</i> <b>info</b>)
+<h2>lws_set_proxy - Setups proxy to lws_context.</h2>
+<i>int</i>
+<b>lws_set_proxy</b>
+(<i>struct lws_context *</i> <b>context</b>,
+<i>const char *</i> <b>proxy</b>)
 <h3>Arguments</h3>
 <dl>
-<dt><b>info</b>
-<dd>pointer to struct with parameters
+<dt><b>context</b>
+<dd>pointer to struct lws_context you want set proxy to
+<dt><b>proxy</b>
+<dd>pointer to c string containing proxy in format address:port
 </dl>
 <h3>Description</h3>
 <blockquote>
-This function creates the listening socket (if serving) and takes care
-of all initialization in one step.
-<p>
-After initialization, it returns a struct libwebsocket_context * that
-represents this server.  After calling, user code needs to take care
-of calling <b>libwebsocket_service</b> with the context pointer to get the
-server's sockets serviced.  This can be done in the same process context
-or a forked process, or another thread,
-<p>
-The protocol callback functions are called for a handful of events
-including http requests coming in, websocket connections becoming
-established, and data arriving; it's also called periodically to allow
-async transmission.
-<p>
-HTTP requests are sent always to the FIRST protocol in <tt><b>protocol</b></tt>, since
-at that time websocket protocol has not been negotiated.  Other
-protocols after the first one never see any HTTP callack activity.
+Returns 0 if proxy string was parsed and proxy was setup. 
+Returns -1 if <tt><b>proxy</b></tt> is NULL or has incorrect format.
 <p>
-The server created is a simple http server by default; part of the
-websocket standard is upgrading this http connection to a websocket one.
+This is only required if your OS does not provide the http_proxy
+environment variable (eg, OSX)
 <p>
-This allows the same server to provide files like scripts and favicon /
-images or whatever over http and dynamic data over websockets all in
-one place; they're all handled in the user callback.
+IMPORTANT! You should call this function right after creation of the
+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 lws_context
+creation with <b>genenv</b> call.
 </blockquote>
 <hr>
-<h2>libwebsockets_get_protocol - Returns a protocol pointer from a websocket connection.</h2>
-<i>const struct libwebsocket_protocols *</i>
-<b>libwebsockets_get_protocol</b>
-(<i>struct libwebsocket *</i> <b>wsi</b>)
+<h2>lws_get_protocol - Returns a protocol pointer from a websocket connection.</h2>
+<i>const struct lws_protocols *</i>
+<b>lws_get_protocol</b>
+(<i>struct lws *</i> <b>wsi</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>wsi</b>
@@ -380,172 +533,193 @@ log level defaults to "err", "warn" and "notice" contexts enabled and
 emission on stderr.
 </blockquote>
 <hr>
-<h2>libwebsocket_write - Apply protocol then write data to client</h2>
+<h2>lws_is_ssl - Find out if connection is using SSL</h2>
 <i>int</i>
-<b>libwebsocket_write</b>
-(<i>struct libwebsocket *</i> <b>wsi</b>,
-<i>unsigned char *</i> <b>buf</b>,
-<i>size_t</i> <b>len</b>,
-<i>enum libwebsocket_write_protocol</i> <b>protocol</b>)
+<b>lws_is_ssl</b>
+(<i>struct lws *</i> <b>wsi</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>wsi</b>
-<dd>Websocket instance (available from user callback)
-<dt><b>buf</b>
-<dd>The data to send.  For data being sent on a websocket
-connection (ie, not default http), this buffer MUST have
-LWS_SEND_BUFFER_PRE_PADDING bytes valid BEFORE the pointer
-and an additional LWS_SEND_BUFFER_POST_PADDING bytes valid
-in the buffer after (buf + len).  This is so the protocol
-header and trailer data can be added in-situ.
-<dt><b>len</b>
-<dd>Count of the data bytes in the payload starting from buf
-<dt><b>protocol</b>
-<dd>Use LWS_WRITE_HTTP to reply to an http connection, and one
-of LWS_WRITE_BINARY or LWS_WRITE_TEXT to send appropriate
-data on a websockets connection.  Remember to allow the extra
-bytes before and after buf if LWS_WRITE_BINARY or LWS_WRITE_TEXT
-are used.
+<dd>websocket connection to check
 </dl>
 <h3>Description</h3>
 <blockquote>
-This function provides the way to issue data back to the client
-for both http and websocket protocols.
+Returns 0 if the connection is not using SSL, 1 if using SSL and
+using verified cert, and 2 if using SSL but the cert was not
+checked (appears for client wsi told to skip check on connection)
+</blockquote>
+<hr>
+<h2>lws_partial_buffered - find out if lws buffered the last write</h2>
+<i>int</i>
+<b>lws_partial_buffered</b>
+(<i>struct lws *</i> <b>wsi</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>wsi</b>
+<dd>websocket connection to check
+</dl>
+<h3>Description</h3>
+<blockquote>
+Returns 1 if you cannot use lws_write because the last
+write on this connection is still buffered, and can't be cleared without
+returning to the service loop and waiting for the connection to be
+writeable again.
 <p>
-In the case of sending using websocket protocol, be sure to allocate
-valid storage before and after buf as explained above.  This scheme
-allows maximum efficiency of sending data and protocol in a single
-packet while not burdening the user code with any protocol knowledge.
+If you will try to do &gt;1 lws_write call inside a single
+WRITEABLE callback, you must check this after every write and bail if
+set, ask for a new writeable callback and continue writing from there.
 <p>
-Return may be -1 for a fatal error needing connection close, or a
-positive number reflecting the amount of bytes actually sent.  This
-can be less than the requested number of bytes due to OS memory
-pressure at any given time.
+This is never set at the start of a writeable callback, but any write
+may set it.
+</blockquote>
+<hr>
+<h2>lws_get_library_version - </h2>
+<i>const char *</i>
+<b>lws_get_library_version</b>
+(<i></i> <b>void</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>void</b>
+<dd>no arguments
+</dl>
+<h3>Description</h3>
+<blockquote>
+<p>
+returns a const char * to a string like "1.1 178d78c"
+representing the library version followed by the git head hash it
+was built from
+</blockquote>
+<hr>
+<h2>lws_create_context - Create the websocket handler</h2>
+<i>struct lws_context *</i>
+<b>lws_create_context</b>
+(<i>struct lws_context_creation_info *</i> <b>info</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>info</b>
+<dd>pointer to struct with parameters
+</dl>
+<h3>Description</h3>
+<blockquote>
+This function creates the listening socket (if serving) and takes care
+of all initialization in one step.
+<p>
+After initialization, it returns a struct lws_context * that
+represents this server.  After calling, user code needs to take care
+of calling <b>lws_service</b> with the context pointer to get the
+server's sockets serviced.  This must be done in the same process
+context as the initialization call.
+<p>
+The protocol callback functions are called for a handful of events
+including http requests coming in, websocket connections becoming
+established, and data arriving; it's also called periodically to allow
+async transmission.
+<p>
+HTTP requests are sent always to the FIRST protocol in <tt><b>protocol</b></tt>, since
+at that time websocket protocol has not been negotiated.  Other
+protocols after the first one never see any HTTP callack activity.
+<p>
+The server created is a simple http server by default; part of the
+websocket standard is upgrading this http connection to a websocket one.
+<p>
+This allows the same server to provide files like scripts and favicon /
+images or whatever over http and dynamic data over websockets all in
+one place; they're all handled in the user callback.
+</blockquote>
+<hr>
+<h2>lws_context_destroy - Destroy the websocket context</h2>
+<i>void</i>
+<b>lws_context_destroy</b>
+(<i>struct lws_context *</i> <b>context</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>context</b>
+<dd>Websocket context
+</dl>
+<h3>Description</h3>
+<blockquote>
+This function closes any active connections and then frees the
+context.  After calling this, any further use of the context is
+undefined.
 </blockquote>
 <hr>
-<h2>libwebsockets_serve_http_file - Send a file back to the client using http</h2>
+<h2>lws_callback_on_writable - Request a callback when this socket becomes able to be written to without blocking</h2>
 <i>int</i>
-<b>libwebsockets_serve_http_file</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>,
-<i>struct libwebsocket *</i> <b>wsi</b>,
-<i>const char *</i> <b>file</b>,
-<i>const char *</i> <b>content_type</b>)
+<b>lws_callback_on_writable</b>
+(<i>struct lws_context *</i> <b>context</b>,
+<i>struct lws *</i> <b>wsi</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>context</b>
 <dd>libwebsockets context
 <dt><b>wsi</b>
-<dd>Websocket instance (available from user callback)
-<dt><b>file</b>
-<dd>The file to issue over http
-<dt><b>content_type</b>
-<dd>The http content type, eg, text/html
+<dd>Websocket connection instance to get callback for
+</dl>
+<hr>
+<h2>lws_callback_on_writable_all_protocol - Request a callback for all connections using the given protocol when it becomes possible to write to each socket without blocking in turn.</h2>
+<i>int</i>
+<b>lws_callback_on_writable_all_protocol</b>
+(<i>const struct lws_protocols *</i> <b>protocol</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>protocol</b>
+<dd>Protocol whose connections will get callbacks
+</dl>
+<hr>
+<h2>lws_cancel_service - Cancel servicing of pending websocket activity</h2>
+<i>void</i>
+<b>lws_cancel_service</b>
+(<i>struct lws_context *</i> <b>context</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>context</b>
+<dd>Websocket context
 </dl>
 <h3>Description</h3>
 <blockquote>
-This function is intended to be called from the callback in response
-to http requests from the client.  It allows the callback to issue
-local files down the http link in a single step.
-<p>
-Returning &lt;0 indicates error and the wsi should be closed.  Returning
-&gt;0 indicates the file was completely sent and the wsi should be closed.
-==0 indicates the file transfer is started and needs more service later,
-the wsi should be left alone.
+This function let a call to <b>lws_service</b> waiting for a timeout
+immediately return.
 </blockquote>
 <hr>
-<h2>libwebsocket_client_connect - Connect to another websocket server</h2>
-<i>struct libwebsocket *</i>
-<b>libwebsocket_client_connect</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>,
-<i>const char *</i> <b>address</b>,
-<i>int</i> <b>port</b>,
-<i>int</i> <b>ssl_connection</b>,
-<i>const char *</i> <b>path</b>,
-<i>const char *</i> <b>host</b>,
-<i>const char *</i> <b>origin</b>,
-<i>const char *</i> <b>protocol</b>,
-<i>int</i> <b>ietf_version_or_minus_one</b>)
+<h2>lws_cancel_service - Cancel servicing of pending websocket activity</h2>
+<i>void</i>
+<b>lws_cancel_service</b>
+(<i>struct lws_context *</i> <b>context</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>context</b>
 <dd>Websocket context
-<dt><b>address</b>
-<dd>Remote server address, eg, "myserver.com"
-<dt><b>port</b>
-<dd>Port to connect to on the remote server, eg, 80
-<dt><b>ssl_connection</b>
-<dd>0 = ws://, 1 = wss:// encrypted, 2 = wss:// allow self
-signed certs
-<dt><b>path</b>
-<dd>Websocket path on server
-<dt><b>host</b>
-<dd>Hostname on server
-<dt><b>origin</b>
-<dd>Socket origin name
-<dt><b>protocol</b>
-<dd>Comma-separated list of protocols being asked for from
-the server, or just one.  The server will pick the one it
-likes best.
-<dt><b>ietf_version_or_minus_one</b>
-<dd>-1 to ask to connect using the default, latest
-protocol supported, or the specific protocol ordinal
 </dl>
 <h3>Description</h3>
 <blockquote>
-This function creates a connection to a remote server
+This function let a call to <b>lws_service</b> waiting for a timeout
+immediately return.
 </blockquote>
 <hr>
-<h2>libwebsocket_client_connect_extended - Connect to another websocket server</h2>
-<i>struct libwebsocket *</i>
-<b>libwebsocket_client_connect_extended</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>,
-<i>const char *</i> <b>address</b>,
-<i>int</i> <b>port</b>,
-<i>int</i> <b>ssl_connection</b>,
-<i>const char *</i> <b>path</b>,
-<i>const char *</i> <b>host</b>,
-<i>const char *</i> <b>origin</b>,
-<i>const char *</i> <b>protocol</b>,
-<i>int</i> <b>ietf_version_or_minus_one</b>,
-<i>void *</i> <b>userdata</b>)
+<h2>lws_cancel_service - Cancel servicing of pending websocket activity</h2>
+<i>void</i>
+<b>lws_cancel_service</b>
+(<i>struct lws_context *</i> <b>context</b>)
 <h3>Arguments</h3>
 <dl>
 <dt><b>context</b>
 <dd>Websocket context
-<dt><b>address</b>
-<dd>Remote server address, eg, "myserver.com"
-<dt><b>port</b>
-<dd>Port to connect to on the remote server, eg, 80
-<dt><b>ssl_connection</b>
-<dd>0 = ws://, 1 = wss:// encrypted, 2 = wss:// allow self
-signed certs
-<dt><b>path</b>
-<dd>Websocket path on server
-<dt><b>host</b>
-<dd>Hostname on server
-<dt><b>origin</b>
-<dd>Socket origin name
-<dt><b>protocol</b>
-<dd>Comma-separated list of protocols being asked for from
-the server, or just one.  The server will pick the one it
-likes best.
-<dt><b>ietf_version_or_minus_one</b>
-<dd>-1 to ask to connect using the default, latest
-protocol supported, or the specific protocol ordinal
-<dt><b>userdata</b>
-<dd>Pre-allocated user data
 </dl>
 <h3>Description</h3>
 <blockquote>
-This function creates a connection to a remote server
+This function let a call to <b>lws_service</b> waiting for a timeout
+immediately return.
+<p>
+There is no <b>poll</b> in MBED3, he will fire callbacks when he feels like
+it.
 </blockquote>
 <hr>
 <h2>callback - User server actions</h2>
 <i>LWS_EXTERN int</i>
 <b>callback</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>,
-<i>struct libwebsocket *</i> <b>wsi</b>,
-<i>enum libwebsocket_callback_reasons</i> <b>reason</b>,
+(<i>struct lws_context *</i> <b>context</b>,
+<i>struct lws *</i> <b>wsi</b>,
+<i>enum lws_callback_reasons</i> <b>reason</b>,
 <i>void *</i> <b>user</b>,
 <i>void *</i> <b>in</b>,
 <i>size_t</i> <b>len</b>)
@@ -571,7 +745,7 @@ protocol detail is hidden and handled by the library.
 <p>
 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.
 <p>
 You get an opportunity to initialize user data when called back with
 LWS_CALLBACK_ESTABLISHED reason.
@@ -584,7 +758,9 @@ an incoming client
 <h3>LWS_CALLBACK_CLIENT_CONNECTION_ERROR</h3>
 <blockquote>
 the request client connection has
-been unable to complete a handshake with the remote server
+been unable to complete a handshake with the remote server.  If
+in is non-NULL, you can find an error string of length len where
+it points to.
 </blockquote>
 <h3>LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH</h3>
 <blockquote>
@@ -605,6 +781,10 @@ a handshake with the remote server
 <blockquote>
 when the websocket session ends
 </blockquote>
+<h3>LWS_CALLBACK_CLOSED_HTTP</h3>
+<blockquote>
+when a HTTP (non-websocket) session ends
+</blockquote>
 <h3>LWS_CALLBACK_RECEIVE</h3>
 <blockquote>
 data has appeared for this server endpoint from a
@@ -631,7 +811,7 @@ one.  This is a chance to serve http content,
 for example, to send a script to the client
 which will then open the websockets connection.
 <tt><b>in</b></tt> points to the URI path requested and
-<b>libwebsockets_serve_http_file</b> makes it very
+<b>lws_serve_http_file</b> makes it very
 simple to send back a file to the client.
 Normally after sending the file you are done
 with the http connection, since the rest of the
@@ -642,6 +822,16 @@ That's important because it uses a slot in the
 total number of client connections allowed set
 by MAX_CLIENTS.
 </blockquote>
+<h3>LWS_CALLBACK_HTTP_BODY</h3>
+<blockquote>
+the next <tt><b>len</b></tt> bytes data from the http
+request body HTTP connection is now available in <tt><b>in</b></tt>.
+</blockquote>
+<h3>LWS_CALLBACK_HTTP_BODY_COMPLETION</h3>
+<blockquote>
+the expected amount of http request
+body has been delivered
+</blockquote>
 <h3>LWS_CALLBACK_HTTP_WRITEABLE</h3>
 <blockquote>
 you can write more down the http protocol
@@ -655,7 +845,7 @@ http link has completed.
 <h3>LWS_CALLBACK_SERVER_WRITEABLE</h3>
 <blockquote>
 If you call
-<b>libwebsocket_callback_on_writable</b> on a connection, you will
+<b>lws_callback_on_writable</b> on a connection, you will
 get one of these callbacks coming when the connection socket
 is able to accept another write packet without blocking.
 If it already was able to take another packet without blocking,
@@ -669,22 +859,50 @@ called when a client connects to
 the server at network level; the connection is accepted but then
 passed to this callback to decide whether to hang up immediately
 or not, based on the client IP.  <tt><b>in</b></tt> contains the connection
-socket's descriptor.  Return non-zero to terminate
-the connection before sending or receiving anything.
-Because this happens immediately after the network connection
-from the client, there's no websocket protocol selected yet so
-this callback is issued only to protocol 0.
+socket's descriptor. Since the client connection information is
+not available yet, <tt><b>wsi</b></tt> still pointing to the main server socket.
+Return non-zero to terminate the connection before sending or
+receiving anything. Because this happens immediately after the
+network connection from the client, there's no websocket protocol
+selected yet so this callback is issued only to protocol 0.
+</blockquote>
+<h3>LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED</h3>
+<blockquote>
+A new client just had
+been connected, accepted, and instantiated into the pool. This
+callback allows setting any relevant property to it. Because this
+happens immediately after the instantiation of a new client,
+there's no websocket protocol selected yet so this callback is
+issued only to protocol 0. Only <tt><b>wsi</b></tt> is defined, pointing to the
+new client, and the return value is ignored.
+</blockquote>
+<h3>LWS_CALLBACK_FILTER_HTTP_CONNECTION</h3>
+<blockquote>
+called when the request has
+been received and parsed from the client, but the response is
+not sent yet.  Return non-zero to disallow the connection.
+<tt><b>user</b></tt> is a pointer to the connection user space allocation,
+<tt><b>in</b></tt> is the URI, eg, "/"
+In your handler you can use the public APIs
+<b>lws_hdr_total_length</b> / <b>lws_hdr_copy</b> to access all of the
+headers using the header enums lws_token_indexes from
+libwebsockets.h to check for and read the supported header
+presence and content before deciding to allow the http
+connection to proceed or to kill the connection.
 </blockquote>
 <h3>LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION</h3>
 <blockquote>
 called when the handshake has
 been received and parsed from the client, but the response is
 not sent yet.  Return non-zero to disallow the connection.
-<tt><b>user</b></tt> is a pointer to an array of struct lws_tokens, you can
-use the header enums lws_token_indexes from libwebsockets.h
-to check for and read the supported header presence and
-content before deciding to allow the handshake to proceed or
-to kill the connection.
+<tt><b>user</b></tt> is a pointer to the connection user space allocation,
+<tt><b>in</b></tt> is the requested protocol name
+In your handler you can use the public APIs
+<b>lws_hdr_total_length</b> / <b>lws_hdr_copy</b> to access all of the
+headers using the header enums lws_token_indexes from
+libwebsockets.h to check for and read the supported header
+presence and content before deciding to allow the handshake
+to proceed or to kill the connection.
 </blockquote>
 <h3>LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS</h3>
 <blockquote>
@@ -703,6 +921,17 @@ to load extra certifcates into the server which allow it to
 verify the validity of certificates returned by clients.  <tt><b>user</b></tt>
 is the server's OpenSSL SSL_CTX*
 </blockquote>
+<h3>LWS_CALLBACK_OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY</h3>
+<blockquote>
+if configured for
+including OpenSSL support but no private key file has been specified
+(ssl_private_key_filepath is NULL), this callback is called to
+allow the user to set the private key directly via libopenssl
+and perform further operations if required; this might be useful
+in situations where the private key is not directly accessible by
+the OS, for example if it is stored on a smartcard
+<tt><b>user</b></tt> is the server's OpenSSL SSL_CTX*
+</blockquote>
 <h3>LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION</h3>
 <blockquote>
 if the
@@ -788,10 +1017,21 @@ One-time call per protocol indicating
 this protocol won't get used at all after this callback, the
 context is getting destroyed.  Take the opportunity to
 deallocate everything that was allocated by the protocol.
+</blockquote>
+<h3>LWS_CALLBACK_WSI_CREATE</h3>
+<blockquote>
+outermost (earliest) wsi create notification
+</blockquote>
+<h3>LWS_CALLBACK_WSI_DESTROY</h3>
+<blockquote>
+outermost (latest) wsi destroy notification
 <p>
-The next four reasons are optional and only need taking care of if you
+The next five reasons are optional and only need taking care of if you
 will be integrating libwebsockets sockets into an external polling
 array.
+<p>
+For these calls, <tt><b>in</b></tt> points to a struct lws_pollargs that
+contains <tt><b>fd</b></tt>, <tt><b>events</b></tt> and <tt><b>prev_events</b></tt> members
 </blockquote>
 <h3>LWS_CALLBACK_ADD_POLL_FD</h3>
 <blockquote>
@@ -802,46 +1042,58 @@ polling array with the other server.  This and the other
 POLL_FD related callbacks let you put your specialized
 poll array interface code in the callback for protocol 0, the
 first protocol you support, usually the HTTP protocol in the
-serving case.  This callback happens when a socket needs to be
+serving case.
+This callback happens when a socket needs to be
 </blockquote>
 <h3>added to the polling loop</h3>
 <blockquote>
-<tt><b>in</b></tt> contains the fd, and
-<tt><b>len</b></tt> is the events bitmap (like, POLLIN).  If you are using the
-internal polling loop (the "service" callback), you can just
-ignore these callbacks.
+<tt><b>in</b></tt> points to a struct
+lws_pollargs; the <tt><b>fd</b></tt> member of the struct is the file
+descriptor, and <tt><b>events</b></tt> contains the active events.
+<p>
+If you are using the internal polling loop (the "service"
+callback), you can just ignore these callbacks.
 </blockquote>
 <h3>LWS_CALLBACK_DEL_POLL_FD</h3>
 <blockquote>
 This callback happens when a socket descriptor
 needs to be removed from an external polling array.  <tt><b>in</b></tt> is
-the socket desricptor.  If you are using the internal polling
+again the struct lws_pollargs containing the <tt><b>fd</b></tt> member
+to be removed.  If you are using the internal polling
 loop, you can just ignore it.
 </blockquote>
-<h3>LWS_CALLBACK_SET_MODE_POLL_FD</h3>
+<h3>LWS_CALLBACK_CHANGE_MODE_POLL_FD</h3>
 <blockquote>
-This callback happens when libwebsockets
-wants to modify the events for the socket descriptor in <tt><b>in</b></tt>.
-The handler should OR <tt><b>len</b></tt> on to the events member of the pollfd
-struct for this socket descriptor.  If you are using the
-internal polling loop, you can just ignore it.
+This callback happens when
+libwebsockets wants to modify the events for a connectiion.
+<tt><b>in</b></tt> is the struct lws_pollargs with the <tt><b>fd</b></tt> to change.
+The new event mask is in <tt><b>events</b></tt> member and the old mask is in
+the <tt><b>prev_events</b></tt> member.
+If you are using the internal polling loop, you can just ignore
+it.
 </blockquote>
-<h3>LWS_CALLBACK_CLEAR_MODE_POLL_FD</h3>
+<h3>LWS_CALLBACK_UNLOCK_POLL</h3>
 <blockquote>
-This callback occurs when libwebsockets
-wants to modify the events for the socket descriptor in <tt><b>in</b></tt>.
-The handler should AND ~<tt><b>len</b></tt> on to the events member of the
-pollfd struct for this socket descriptor.  If you are using the
-internal polling loop, you can just ignore it.
+These allow the external poll changes driven
+by libwebsockets to participate in an external thread locking
+scheme around the changes, so the whole thing is threadsafe.
+These are called around three activities in the library,
+- inserting a new wsi in the wsi / fd table (len=1)
+- deleting a wsi from the wsi / fd table (len=1)
+- changing a wsi's POLLIN/OUT state (len=0)
+Locking and unlocking external synchronization objects when
+len == 1 allows external threads to be synchronized against
+wsi lifecycle changes if it acquires the same lock for the
+duration of wsi dereference from the other thread context.
 </blockquote>
 <hr>
 <h2>extension_callback - Hooks to allow extensions to operate</h2>
 <i>LWS_EXTERN int</i>
 <b>extension_callback</b>
-(<i>struct libwebsocket_context *</i> <b>context</b>,
-<i>struct libwebsocket_extension *</i> <b>ext</b>,
-<i>struct libwebsocket *</i> <b>wsi</b>,
-<i>enum libwebsocket_extension_callback_reasons</i> <b>reason</b>,
+(<i>struct lws_context *</i> <b>context</b>,
+<i>struct lws_extension *</i> <b>ext</b>,
+<i>struct lws *</i> <b>wsi</b>,
+<i>enum lws_extension_callback_reasons</i> <b>reason</b>,
 <i>void *</i> <b>user</b>,
 <i>void *</i> <b>in</b>,
 <i>size_t</i> <b>len</b>)
@@ -923,20 +1175,22 @@ buffer safely, it should copy the data into its own buffer and
 set the lws_tokens token pointer to it.
 </blockquote>
 <hr>
-<h2>struct libwebsocket_protocols - List of protocols and handlers server supports.</h2>
-<b>struct libwebsocket_protocols</b> {<br>
+<h2>struct lws_protocols - List of protocols and handlers server supports.</h2>
+<b>struct lws_protocols</b> {<br>
 &nbsp; &nbsp; <i>const char *</i> <b>name</b>;<br>
 &nbsp; &nbsp; <i>callback_function *</i> <b>callback</b>;<br>
 &nbsp; &nbsp; <i>size_t</i> <b>per_session_data_size</b>;<br>
 &nbsp; &nbsp; <i>size_t</i> <b>rx_buffer_size</b>;<br>
-&nbsp; &nbsp; <i>struct libwebsocket_context *</i> <b>owning_server</b>;<br>
+&nbsp; &nbsp; <i>unsigned int</i> <b>id</b>;<br>
+&nbsp; &nbsp; <i>void *</i> <b>user</b>;<br>
+&nbsp; &nbsp; <i>struct lws_context *</i> <b>owning_server</b>;<br>
 &nbsp; &nbsp; <i>int</i> <b>protocol_index</b>;<br>
 };<br>
 <h3>Members</h3>
 <dl>
 <dt><b>name</b>
 <dd>Protocol name that must match the one given in the client
-Javascript new WebSocket(url, 'protocol') name
+Javascript new WebSocket(url, 'protocol') name.
 <dt><b>callback</b>
 <dd>The service callback used for this protocol.  It allows the
 service action for an entire protocol to be encapsulated in
@@ -952,9 +1206,21 @@ should set this to the size of the biggest legal frame that
 you support.  If the frame size is exceeded, there is no
 error, but the buffer will spill to the user callback when
 full, which you can detect by using
-<b>libwebsockets_remaining_packet_payload</b>.  Notice that you
+<b>lws_remaining_packet_payload</b>.  Notice that you
 just talk about frame size here, the LWS_SEND_BUFFER_PRE_PADDING
 and post-padding are automatically also allocated on top.
+<dt><b>id</b>
+<dd>ignored by lws, but useful to contain user information bound
+to the selected protocol.  For example if this protocol was
+called "myprotocol-v2", you might set id to 2, and the user
+code that acts differently according to the version can do so by
+switch (wsi-&gt;protocol-&gt;id), user code might use some bits as
+capability flags based on selected protocol version, etc.
+<dt><b>user</b>
+<dd>User provided context data at the protocol level.
+Accessible via lws_get_protocol(wsi)-&gt;user
+This should not be confused with wsi-&gt;user, it is not the same.
+The library completely ignores any value in here.
 <dt><b>owning_server</b>
 <dd>the server init call fills in this opaque pointer when
 registering this protocol with the server.
@@ -964,12 +1230,19 @@ registering this protocol with the server.
 <h3>Description</h3>
 <blockquote>
 This structure represents one protocol supported by the server.  An
-array of these structures is passed to <b>libwebsocket_create_server</b>
+array of these structures is passed to <b>lws_create_server</b>
 allows as many protocols as you like to be handled by one server.
+<p>
+The first protocol given has its callback used for user callbacks when
+there is no agreed protocol name, that's true during HTTP part of the
+</blockquote>
+<h3>connection and true if the client did not send a Protocol</h3>
+<blockquote>
+header.
 </blockquote>
 <hr>
-<h2>struct libwebsocket_extension - An extension we know how to cope with</h2>
-<b>struct libwebsocket_extension</b> {<br>
+<h2>struct lws_extension - An extension we know how to cope with</h2>
+<b>struct lws_extension</b> {<br>
 &nbsp; &nbsp; <i>const char *</i> <b>name</b>;<br>
 &nbsp; &nbsp; <i>extension_callback_function *</i> <b>callback</b>;<br>
 &nbsp; &nbsp; <i>size_t</i> <b>per_session_data_size</b>;<br>
@@ -995,12 +1268,15 @@ all sessions, etc, if it wants
 <b>struct lws_context_creation_info</b> {<br>
 &nbsp; &nbsp; <i>int</i> <b>port</b>;<br>
 &nbsp; &nbsp; <i>const char *</i> <b>iface</b>;<br>
-&nbsp; &nbsp; <i>struct libwebsocket_protocols *</i> <b>protocols</b>;<br>
-&nbsp; &nbsp; <i>struct libwebsocket_extension *</i> <b>extensions</b>;<br>
+&nbsp; &nbsp; <i>struct lws_protocols *</i> <b>protocols</b>;<br>
+&nbsp; &nbsp; <i>struct lws_extension *</i> <b>extensions</b>;<br>
+&nbsp; &nbsp; <i>struct lws_token_limits *</i> <b>token_limits</b>;<br>
 &nbsp; &nbsp; <i>const char *</i> <b>ssl_cert_filepath</b>;<br>
 &nbsp; &nbsp; <i>const char *</i> <b>ssl_private_key_filepath</b>;<br>
 &nbsp; &nbsp; <i>const char *</i> <b>ssl_ca_filepath</b>;<br>
 &nbsp; &nbsp; <i>const char *</i> <b>ssl_cipher_list</b>;<br>
+&nbsp; &nbsp; <i>const char *</i> <b>http_proxy_address</b>;<br>
+&nbsp; &nbsp; <i>unsigned int</i> <b>http_proxy_port</b>;<br>
 &nbsp; &nbsp; <i>int</i> <b>gid</b>;<br>
 &nbsp; &nbsp; <i>int</i> <b>uid</b>;<br>
 &nbsp; &nbsp; <i>unsigned int</i> <b>options</b>;<br>
@@ -1008,13 +1284,19 @@ all sessions, etc, if it wants
 &nbsp; &nbsp; <i>int</i> <b>ka_time</b>;<br>
 &nbsp; &nbsp; <i>int</i> <b>ka_probes</b>;<br>
 &nbsp; &nbsp; <i>int</i> <b>ka_interval</b>;<br>
+#ifdef LWS_OPENSSL_SUPPORT<br>
+&nbsp; &nbsp; <i>void *</i> <b>provided_client_ssl_ctx</b>;<br>
+#else<br>
+&nbsp; &nbsp; <i>void *</i> <b>provided_client_ssl_ctx</b>;<br>
+#endif<br>
 };<br>
 <h3>Members</h3>
 <dl>
 <dt><b>port</b>
-<dd>Port to listen on... you can use 0 to suppress listening on
-any port, that's what you want if you are not running a
-websocket server at all but just using it as a client
+<dd>Port to listen on... you can use CONTEXT_PORT_NO_LISTEN to
+suppress listening on any port, that's what you want if you are
+not running a websocket server at all but just using it as a
+client
 <dt><b>iface</b>
 <dd>NULL to bind the listen socket to all interfaces, or the
 interface name, eg, "eth2"
@@ -1024,22 +1306,33 @@ 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
 <dt><b>extensions</b>
-<dd>NULL or array of libwebsocket_extension structs listing the
+<dd>NULL or array of lws_extension structs listing the
 extensions this context supports.  If you configured with
 --without-extensions, you should give NULL here.
+<dt><b>token_limits</b>
+<dd>NULL or struct lws_token_limits pointer which is initialized
+with a token length limit for each possible WSI_TOKEN_*** 
 <dt><b>ssl_cert_filepath</b>
 <dd>If libwebsockets was compiled to use ssl, and you want
 to listen using SSL, set to the filepath to fetch the
 server cert from, otherwise NULL for unencrypted
 <dt><b>ssl_private_key_filepath</b>
-<dd>filepath to private key if wanting SSL mode,
-else ignored
+<dd>filepath to private key if wanting SSL mode;
+if this is set to NULL but sll_cert_filepath is set, the
+OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY callback is called to allow
+setting of the private key directly via openSSL library calls
 <dt><b>ssl_ca_filepath</b>
 <dd>CA certificate filepath or NULL
 <dt><b>ssl_cipher_list</b>
 <dd>List of valid ciphers to use (eg,
 "RC4-MD5:RC4-SHA:AES128-SHA:AES256-SHA:HIGH:!DSS:!aNULL"
 or you can leave it as NULL to get "DEFAULT"
+<dt><b>http_proxy_address</b>
+<dd>If non-NULL, attempts to proxy via the given address.
+If proxy auth is required, use format
+"username:password<tt><b>server</b></tt>:port"
+<dt><b>http_proxy_port</b>
+<dd>If http_proxy_address was non-NULL, uses this port at the address 
 <dt><b>gid</b>
 <dd>group id to change to after setting listen socket, or -1.
 <dt><b>uid</b>
@@ -1048,7 +1341,7 @@ or you can leave it as NULL to get "DEFAULT"
 <dd>0, or LWS_SERVER_OPTION_DEFEAT_CLIENT_MASK
 <dt><b>user</b>
 <dd>optional user pointer that can be recovered via the context
-pointer using libwebsocket_context_user
+pointer using lws_context_user
 <dt><b>ka_time</b>
 <dd>0 for no keepalive, otherwise apply this keepalive timeout to
 all libwebsocket sockets, client or server
@@ -1059,5 +1352,15 @@ and killing the connection
 <dt><b>ka_interval</b>
 <dd>if ka_time was nonzero, how long to wait before each ka_probes
 attempt
+<dt><b>provided_client_ssl_ctx</b>
+<dd>If non-null, swap out libwebsockets ssl
+implementation for the one provided by provided_ssl_ctx.
+Libwebsockets no longer is responsible for freeing the context
+if this option is selected.
+<dt><b>provided_client_ssl_ctx</b>
+<dd>If non-null, swap out libwebsockets ssl
+implementation for the one provided by provided_ssl_ctx.
+Libwebsockets no longer is responsible for freeing the context
+if this option is selected.
 </dl>
 <hr>
index ec9fbac..65ab443 100644 (file)
@@ -37,7 +37,7 @@ static unsigned int opts;
 static int was_closed;
 static int deny_deflate;
 static int deny_mux;
-static struct libwebsocket *wsi_mirror;
+static struct lws *wsi_mirror;
 static int mirror_lifetime = 0;
 static volatile int force_exit = 0;
 static int longlived = 0;
@@ -68,9 +68,9 @@ enum demo_protocols {
 /* dumb_increment protocol */
 
 static int
-callback_dumb_increment(struct libwebsocket_context *this,
-                       struct libwebsocket *wsi,
-                       enum libwebsocket_callback_reasons reason,
+callback_dumb_increment(struct lws_context *this,
+                       struct lws *wsi,
+                       enum lws_callback_reasons reason,
                                               void *user, void *in, size_t len)
 {
        switch (reason) {
@@ -124,9 +124,9 @@ callback_dumb_increment(struct libwebsocket_context *this,
 
 
 static int
-callback_lws_mirror(struct libwebsocket_context *context,
-                       struct libwebsocket *wsi,
-                       enum libwebsocket_callback_reasons reason,
+callback_lws_mirror(struct lws_context *context,
+                       struct lws *wsi,
+                       enum lws_callback_reasons reason,
                                               void *user, void *in, size_t len)
 {
        unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 4096 +
@@ -215,7 +215,7 @@ callback_lws_mirror(struct libwebsocket_context *context,
 
 /* list of supported protocols and callbacks */
 
-static struct libwebsocket_protocols protocols[] = {
+static struct lws_protocols protocols[] = {
        {
                "dumb-increment-protocol,fake-nonexistant-protocol",
                callback_dumb_increment,
@@ -255,9 +255,9 @@ int main(int argc, char **argv)
        int ret = 0;
        int port = 7681;
        int use_ssl = 0;
-       struct libwebsocket_context *context;
+       struct lws_context *context;
        const char *address;
-       struct libwebsocket *wsi_dumb;
+       struct lws *wsi_dumb;
        int ietf_version = -1; /* latest */
        struct lws_context_creation_info info;
 
index 398fffb..ccdc3c5 100644 (file)
@@ -53,9 +53,9 @@ struct per_session_data__echo {
 };
 
 static int
-callback_echo(struct libwebsocket_context *context,
-               struct libwebsocket *wsi,
-               enum libwebsocket_callback_reasons reason, void *user,
+callback_echo(struct lws_context *context,
+               struct lws *wsi,
+               enum lws_callback_reasons reason, void *user,
                                                           void *in, size_t len)
 {
        struct per_session_data__echo *pss = (struct per_session_data__echo *)user;
@@ -145,7 +145,7 @@ do_rx:
 
 
 
-static struct libwebsocket_protocols protocols[] = {
+static struct lws_protocols protocols[] = {
        /* first protocol must always be HTTP handler */
 
        {
@@ -189,7 +189,7 @@ int main(int argc, char **argv)
        int n = 0;
        int port = 7681;
        int use_ssl = 0;
-       struct libwebsocket_context *context;
+       struct lws_context *context;
        int opts = 0;
        char interface_name[128] = "";
        const char *_interface = NULL;
@@ -207,7 +207,7 @@ int main(int argc, char **argv)
        char address[256], ads_port[256 + 30];
        int rate_us = 250000;
        unsigned long long oldus;
-       struct libwebsocket *wsi;
+       struct lws *wsi;
        int disallow_selfsigned = 0;
        struct timeval tv;
 #endif
index c97d109..3f8c344 100644 (file)
@@ -53,9 +53,9 @@ struct per_session_data__fraggle {
 };
 
 static int
-callback_fraggle(struct libwebsocket_context *context,
-                       struct libwebsocket *wsi,
-                       enum libwebsocket_callback_reasons reason,
+callback_fraggle(struct lws_context *context,
+                       struct lws *wsi,
+                       enum lws_callback_reasons reason,
                                               void *user, void *in, size_t len)
 {
        int n;
@@ -232,7 +232,7 @@ callback_fraggle(struct libwebsocket_context *context,
 
 /* list of supported protocols and callbacks */
 
-static struct libwebsocket_protocols protocols[] = {
+static struct lws_protocols protocols[] = {
        {
                "fraggle-protocol",
                callback_fraggle,
@@ -258,11 +258,11 @@ int main(int argc, char **argv)
        int n = 0;
        int port = 7681;
        int use_ssl = 0;
-       struct libwebsocket_context *context;
+       struct lws_context *context;
        int opts = 0;
        char interface_name[128] = "";
        const char *iface = NULL;
-       struct libwebsocket *wsi;
+       struct lws *wsi;
        const char *address;
        int server_port = port;
        struct lws_context_creation_info info;
index 6dcea97..dd07e9f 100644 (file)
@@ -48,7 +48,7 @@
 #define MAX_PING_CLIENTS 256
 #define PING_RINGBUFFER_SIZE 256
 
-static struct libwebsocket *ping_wsi[MAX_PING_CLIENTS];
+static struct lws *ping_wsi[MAX_PING_CLIENTS];
 static unsigned int interval_us = 1000000;
 static unsigned int size = 64;
 static int flood;
@@ -100,9 +100,9 @@ enum demo_protocols {
 
 
 static int
-callback_lws_mirror(struct libwebsocket_context * this,
-                       struct libwebsocket *wsi,
-                       enum libwebsocket_callback_reasons reason,
+callback_lws_mirror(struct lws_context * this,
+                       struct lws *wsi,
+                       enum lws_callback_reasons reason,
                                               void *user, void *in, size_t len)
 {
        struct timeval tv;
@@ -286,7 +286,7 @@ callback_lws_mirror(struct libwebsocket_context * this,
 
 /* list of supported protocols and callbacks */
 
-static struct libwebsocket_protocols protocols[] = {
+static struct lws_protocols protocols[] = {
 
        {
                "lws-mirror-protocol",
@@ -330,7 +330,7 @@ int main(int argc, char **argv)
        int n = 0;
        int port = 7681;
        int use_ssl = 0;
-       struct libwebsocket_context *context;
+       struct lws_context *context;
        char protocol_name[256];
        char ip[30];
 #ifndef _WIN32
index 18a8146..b8cba7a 100644 (file)
@@ -23,9 +23,9 @@
 /* dumb_increment protocol */
 
 int
-callback_dumb_increment(struct libwebsocket_context *context,
-                       struct libwebsocket *wsi,
-                       enum libwebsocket_callback_reasons reason,
+callback_dumb_increment(struct lws_context *context,
+                       struct lws *wsi,
+                       enum lws_callback_reasons reason,
                        void *user, void *in, size_t len)
 {
        unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 +
index 26aa4e0..84533d2 100644 (file)
@@ -60,7 +60,7 @@ struct serveable {
  * content
  */
 void
-dump_handshake_info(struct libwebsocket *wsi)
+dump_handshake_info(struct lws *wsi)
 {
        int n = 0;
        char buf[256];
@@ -110,10 +110,9 @@ const char * get_mimetype(const char *file)
  * here on the first protocol server.
  */
 
-int callback_http(struct libwebsocket_context *context,
-               struct libwebsocket *wsi,
-               enum libwebsocket_callback_reasons reason, void *user,
-                                                          void *in, size_t len)
+int callback_http(struct lws_context *context, struct lws *wsi,
+                 enum lws_callback_reasons reason, void *user,
+                 void *in, size_t len)
 {
        struct per_session_data__http *pss =
                        (struct per_session_data__http *)user;
@@ -130,7 +129,7 @@ int callback_http(struct libwebsocket_context *context,
        int n, m;
 
 #ifdef EXTERNAL_POLL
-       struct libwebsocket_pollargs *pa = (struct libwebsocket_pollargs *)in;
+       struct lws_pollargs *pa = (struct lws_pollargs *)in;
 #endif
 
        switch (reason) {
index e1f5e49..bfc6133 100644 (file)
@@ -33,9 +33,9 @@ static struct a_message ringbuffer[MAX_MESSAGE_QUEUE];
 static int ringbuffer_head;
 
 int
-callback_lws_mirror(struct libwebsocket_context *context,
-                   struct libwebsocket *wsi,
-                   enum libwebsocket_callback_reasons reason,
+callback_lws_mirror(struct lws_context *context,
+                   struct lws *wsi,
+                   enum lws_callback_reasons reason,
                    void *user, void *in, size_t len)
 {
        struct per_session_data__lws_mirror *pss =
index 7c60871..8894f66 100644 (file)
@@ -26,12 +26,12 @@ int close_testing;
 int max_poll_elements;
 
 #ifdef EXTERNAL_POLL
-struct libwebsocket_pollfd *pollfds;
+struct lws_pollfd *pollfds;
 int *fd_lookup;
 int count_pollfds;
 #endif
 volatile int force_exit = 0;
-struct libwebsocket_context *context;
+struct lws_context *context;
 
 /*
  * This mutex lock protects code that changes or relies on wsi list outside of
@@ -90,7 +90,7 @@ enum demo_protocols {
 
 /* list of supported protocols and callbacks */
 
-static struct libwebsocket_protocols protocols[] = {
+static struct lws_protocols protocols[] = {
        /* first protocol must always be HTTP handler */
 
        {
@@ -265,7 +265,7 @@ int main(int argc, char **argv)
        printf("Using resource path \"%s\"\n", resource_path);
 #ifdef EXTERNAL_POLL
        max_poll_elements = getdtablesize();
-       pollfds = malloc(max_poll_elements * sizeof (struct libwebsocket_pollfd));
+       pollfds = malloc(max_poll_elements * sizeof (struct lws_pollfd));
        fd_lookup = malloc(max_poll_elements * sizeof (int));
        if (pollfds == NULL || fd_lookup == NULL) {
                lwsl_err("Out of memory pollfds=%d\n", max_poll_elements);
index de05ee8..2ffe062 100644 (file)
@@ -25,12 +25,12 @@ int close_testing;
 int max_poll_elements;
 
 #ifdef EXTERNAL_POLL
-struct libwebsocket_pollfd *pollfds;
+struct lws_pollfd *pollfds;
 int *fd_lookup;
 int count_pollfds;
 #endif
 volatile int force_exit = 0;
-struct libwebsocket_context *context;
+struct lws_context *context;
 
 /* http server gets files from this path */
 #define LOCAL_RESOURCE_PATH INSTALL_DATADIR"/libwebsockets-test-server"
@@ -73,7 +73,7 @@ enum demo_protocols {
 
 /* list of supported protocols and callbacks */
 
-static struct libwebsocket_protocols protocols[] = {
+static struct lws_protocols protocols[] = {
        /* first protocol must always be HTTP handler */
 
        {
@@ -227,7 +227,7 @@ int main(int argc, char **argv)
        printf("Using resource path \"%s\"\n", resource_path);
 #ifdef EXTERNAL_POLL
        max_poll_elements = getdtablesize();
-       pollfds = malloc(max_poll_elements * sizeof (struct libwebsocket_pollfd));
+       pollfds = malloc(max_poll_elements * sizeof (struct lws_pollfd));
        fd_lookup = malloc(max_poll_elements * sizeof (int));
        if (pollfds == NULL || fd_lookup == NULL) {
                lwsl_err("Out of memory pollfds=%d\n", max_poll_elements);
index 57fc8a6..3ebf6f7 100644 (file)
@@ -27,12 +27,12 @@ extern int close_testing;
 extern int max_poll_elements;
 
 #ifdef EXTERNAL_POLL
-extern struct libwebsocket_pollfd *pollfds;
+extern struct lws_pollfd *pollfds;
 extern int *fd_lookup;
 extern int count_pollfds;
 #endif
 extern volatile int force_exit;
-extern struct libwebsocket_context *context;
+extern struct lws_context *context;
 extern char *resource_path;
 
 extern void test_server_lock(int care);
@@ -59,22 +59,22 @@ struct per_session_data__dumb_increment {
 };
 
 struct per_session_data__lws_mirror {
-       struct libwebsocket *wsi;
+       struct lws *wsi;
        int ringbuffer_tail;
 };
 
-extern int callback_http(struct libwebsocket_context *context,
-                        struct libwebsocket *wsi,
-                        enum libwebsocket_callback_reasons reason,
+extern int callback_http(struct lws_context *context,
+                        struct lws *wsi,
+                        enum lws_callback_reasons reason,
                         void *user, void *in, size_t len);
-extern int callback_lws_mirror(struct libwebsocket_context *context,
-                              struct libwebsocket *wsi,
-                              enum libwebsocket_callback_reasons reason,
+extern int callback_lws_mirror(struct lws_context *context,
+                              struct lws *wsi,
+                              enum lws_callback_reasons reason,
                               void *user, void *in, size_t len);
-extern int callback_dumb_increment(struct libwebsocket_context *context,
-                              struct libwebsocket *wsi,
-                              enum libwebsocket_callback_reasons reason,
+extern int callback_dumb_increment(struct lws_context *context,
+                              struct lws *wsi,
+                              enum lws_callback_reasons reason,
                               void *user, void *in, size_t len);
 
 extern void
-dump_handshake_info(struct libwebsocket *wsi);
+dump_handshake_info(struct lws *wsi);