<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>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>context</b>
-<dd>libwebsockets context
<dt><b>wsi</b>
<dd>Websocket instance (available from user callback)
<dt><b>file</b>
<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
+<dd>NULL or pointer to header string
+<dt><b>other_headers_len</b>
+<dd>length of the other headers if non-NULL
</dl>
<h3>Description</h3>
<blockquote>
<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>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
<dt><b>wsi</b>
<dd>Websocket instance (available from user callback)
<dt><b>code</b>
<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>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>int</i> <b>rip_len</b>)
<h3>Arguments</h3>
<dl>
-<dt><b>context</b>
-<dd>Libwebsockets context
<dt><b>wsi</b>
<dd>Local struct lws associated with
<dt><b>fd</b>
<h2>lws_callback_all_protocol - Callback all connections using the given protocol with the given reason</h2>
<i>int</i>
<b>lws_callback_all_protocol</b>
-(<i>const struct lws_protocols *</i> <b>protocol</b>,
+(<i>struct lws_context *</i> <b>context</b>,
+<i>const struct lws_protocols *</i> <b>protocol</b>,
<i>int</i> <b>reason</b>)
<h3>Arguments</h3>
<dl>
<h2>lws_rx_flow_allow_all_protocol - Allow all connections with this protocol to receive</h2>
<i>void</i>
<b>lws_rx_flow_allow_all_protocol</b>
-(<i>const struct lws_protocols *</i> <b>protocol</b>)
+(<i>const struct lws_context *</i> <b>context</b>,
+<i>const struct lws_protocols *</i> <b>protocol</b>)
<h3>Arguments</h3>
<dl>
<dt><b>protocol</b>
</dl>
<h3>Description</h3>
<blockquote>
-Returns 0 if proxy string was parsed and proxy was setup.
+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>
This is only required if your OS does not provide the http_proxy
<i>void</i>
<b>lws_set_log_level</b>
(<i>int</i> <b>level</b>,
-<i>void (*</i><b>log_emit_function</b>) <i>(int level, const char *line)</i>)
+<i>void (*</i><b>func</b>) <i>(int level, const char *line)</i>)
<h3>Arguments</h3>
<dl>
<dt><b>level</b>
<dd>OR together the LLL_ debug contexts you want output from
-<dt><b>log_emit_function</b>
-<dd>NULL to leave it as it is, or a user-supplied
-function to perform log string emission instead of
-the default stderr one.
</dl>
<h3>Description</h3>
<blockquote>
<h2>lws_callback_on_writable - Request a callback when this socket becomes able to be written to without blocking</h2>
<i>int</i>
<b>lws_callback_on_writable</b>
-(<i>struct lws_context *</i> <b>context</b>,
-<i>struct lws *</i> <b>wsi</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 connection instance to get callback for
</dl>
<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>)
+(<i>const struct lws_context *</i> <b>context</b>,
+<i>const struct lws_protocols *</i> <b>protocol</b>)
<h3>Arguments</h3>
<dl>
+<dt><b>context</b>
+<dd>lws_context
<dt><b>protocol</b>
<dd>Protocol whose connections will get callbacks
</dl>
it.
</blockquote>
<hr>
+<h2>struct lws_plat_file_ops - Platform-specific file operations</h2>
+<b>struct lws_plat_file_ops</b> {<br>
+ <i>lws_filefd_type (*</i><b>open</b>) <i>(struct lws *wsi, const char *filename,unsigned long *filelen, int flags)</i>;<br>
+ <i>int (*</i><b>close</b>) <i>(struct lws *wsi, lws_filefd_type fd)</i>;<br>
+ <i>unsigned long (*</i><b>seek_cur</b>) <i>(struct lws *wsi, lws_filefd_type fd,long offset_from_cur_pos)</i>;<br>
+ <i>int (*</i><b>read</b>) <i>(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,unsigned char *buf, unsigned long len)</i>;<br>
+ <i>int (*</i><b>write</b>) <i>(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,unsigned char *buf, unsigned long len)</i>;<br>
+};<br>
+<h3>Members</h3>
+<dl>
+<dt><b>open</b>
+<dd>Open file (always binary access if plat supports it)
+filelen is filled on exit to be the length of the file
+flags should be set to O_RDONLY or O_RDWR
+<dt><b>close</b>
+<dd>Close file
+<dt><b>seek_cur</b>
+<dd>Seek from current position
+<dt><b>read</b>
+<dd>Read fron file *amount is set on exit to amount read
+<dt><b>write</b>
+<dd>Write to file *amount is set on exit as amount written
+</dl>
+<h3>Description</h3>
+<blockquote>
+<p>
+These provide platform-agnostic ways to deal with filesystem access in the
+library and in the user code.
+</blockquote>
+<hr>
<h2>callback - User server actions</h2>
<i>LWS_EXTERN int</i>
<b>callback</b>
-(<i>struct lws_context *</i> <b>context</b>,
-<i>struct lws *</i> <b>wsi</b>,
+(<i>const 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>)
<h3>Arguments</h3>
<dl>
-<dt><b>context</b>
-<dd>Websockets context
<dt><b>wsi</b>
<dd>Opaque websocket instance pointer
<dt><b>reason</b>
<h3>LWS_CALLBACK_ESTABLISHED</h3>
<blockquote>
after the server completes a handshake with
-an incoming client
+an incoming client. If you built the library
+with ssl support, <tt><b>in</b></tt> is a pointer to the
+ssl struct associated with the connection or
+NULL.
</blockquote>
<h3>LWS_CALLBACK_CLIENT_CONNECTION_ERROR</h3>
<blockquote>
<i>LWS_EXTERN int</i>
<b>extension_callback</b>
(<i>struct lws_context *</i> <b>context</b>,
-<i>struct lws_extension *</i> <b>ext</b>,
+<i>const 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>size_t</i> <b>rx_buffer_size</b>;<br>
<i>unsigned int</i> <b>id</b>;<br>
<i>void *</i> <b>user</b>;<br>
- <i>struct lws_context *</i> <b>owning_server</b>;<br>
- <i>int</i> <b>protocol_index</b>;<br>
};<br>
<h3>Members</h3>
<dl>
Accessible via lws_get_protocol(wsi)->user
This should not be confused with wsi->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.
-<dt><b>protocol_index</b>
-<dd>which protocol we are starting from zero
</dl>
<h3>Description</h3>
<blockquote>
<b>struct lws_context_creation_info</b> {<br>
<i>int</i> <b>port</b>;<br>
<i>const char *</i> <b>iface</b>;<br>
- <i>struct lws_protocols *</i> <b>protocols</b>;<br>
- <i>struct lws_extension *</i> <b>extensions</b>;<br>
- <i>struct lws_token_limits *</i> <b>token_limits</b>;<br>
+ <i>const struct lws_protocols *</i> <b>protocols</b>;<br>
+ <i>const struct lws_extension *</i> <b>extensions</b>;<br>
+ <i>const struct lws_token_limits *</i> <b>token_limits</b>;<br>
<i>const char *</i> <b>ssl_cert_filepath</b>;<br>
<i>const char *</i> <b>ssl_private_key_filepath</b>;<br>
<i>const char *</i> <b>ssl_ca_filepath</b>;<br>
--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_***
+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
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
+<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>