libwebsockets
Lightweight C library for HTML5 websockets
lws-client.h
1 /*
2  * libwebsockets - small server side websockets and web server implementation
3  *
4  * Copyright (C) 2010 - 2019 Andy Green <andy@warmcat.com>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22  * IN THE SOFTWARE.
23  */
24 
30 
38  LCCSCF_USE_SSL = (1 << 0),
39  LCCSCF_ALLOW_SELFSIGNED = (1 << 1),
40  LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK = (1 << 2),
41  LCCSCF_ALLOW_EXPIRED = (1 << 3),
42  LCCSCF_ALLOW_INSECURE = (1 << 4),
43  LCCSCF_H2_QUIRK_NGHTTP2_END_STREAM = (1 << 5),
44  LCCSCF_H2_QUIRK_OVERFLOWS_TXCR = (1 << 6),
45  LCCSCF_H2_AUTH_BEARER = (1 << 7),
46  LCCSCF_H2_HEXIFY_AUTH_TOKEN = (1 << 8),
47  LCCSCF_H2_MANUAL_RXFLOW = (1 << 9),
48  LCCSCF_HTTP_MULTIPART_MIME = (1 << 10),
49  LCCSCF_HTTP_X_WWW_FORM_URLENCODED = (1 << 11),
50  LCCSCF_HTTP_NO_FOLLOW_REDIRECT = (1 << 12),
51 
52  LCCSCF_PIPELINE = (1 << 16),
60  LCCSCF_MUXABLE_STREAM = (1 << 17),
61 };
62 
67  struct lws_context *context;
69  const char *address;
71  int port;
75  const char *path;
77  const char *host;
79  const char *origin;
81  const char *protocol;
85  void *userdata;
87  const void *client_exts;
89  const char *method;
94  struct lws *parent_wsi;
98  const char *uri_replace_from;
101  const char *uri_replace_to;
103  struct lws_vhost *vhost;
105  struct lws **pwsi;
116  const char *iface;
119  const char *local_protocol_name;
126  const char *alpn;
133  struct lws_sequencer *seq;
160 #if defined(LWS_ROLE_MQTT)
161  const lws_mqtt_client_connect_param_t *mqtt_cp;
162 #else
163  void *mqtt_cp;
164 #endif
165 
166  /* Add new things just above here ---^
167  * This is part of the ABI, don't needlessly break compatibility
168  *
169  * The below is to ensure later library versions with new
170  * members added above will see 0 (default) even if the app
171  * was not built against the newer headers.
172  */
173 
174  void *_unused[4];
175 };
176 
184 LWS_VISIBLE LWS_EXTERN struct lws *
186 
212 LWS_VISIBLE LWS_EXTERN int
214  struct lws_vhost *vhost);
235 LWS_VISIBLE LWS_EXTERN int
236 lws_http_client_read(struct lws *wsi, char **buf, int *len);
237 
249 LWS_VISIBLE LWS_EXTERN unsigned int
251 
263 LWS_VISIBLE LWS_EXTERN int
265  const uint8_t *der, size_t der_len);
266 
286 LWS_VISIBLE LWS_EXTERN void
287 lws_client_http_body_pending(struct lws *wsi, int something_left_to_send);
288 
303 LWS_VISIBLE LWS_EXTERN int
304 lws_client_http_multipart(struct lws *wsi, const char *name,
305  const char *filename, const char *content_type,
306  char **p, char *end);
307 
320 LWS_VISIBLE LWS_EXTERN int
321 lws_http_basic_auth_gen(const char *user, const char *pw, char *buf, size_t len);
322 
lws_client_connect_info::address
const char * address
Definition: lws-client.h:69
lws_http_client_read
LWS_VISIBLE LWS_EXTERN int lws_http_client_read(struct lws *wsi, char **buf, int *len)
lws_client_connect_info::ssl_connection
int ssl_connection
Definition: lws-client.h:73
lws_client_connect_info::uri_replace_from
const char * uri_replace_from
Definition: lws-client.h:98
lws_client_connect_info::protocol
const char * protocol
Definition: lws-client.h:81
lws_http_client_http_response
LWS_VISIBLE LWS_EXTERN unsigned int lws_http_client_http_response(struct lws *wsi)
lws_client_connect_info::ietf_version_or_minus_one
int ietf_version_or_minus_one
Definition: lws-client.h:83
lws_client_connect_info
Definition: lws-client.h:66
lws_client_connect_info::iface
const char * iface
Definition: lws-client.h:116
lws_client_connect_info::parent_wsi
struct lws * parent_wsi
Definition: lws-client.h:94
lws_client_connect_info::path
const char * path
Definition: lws-client.h:75
lws_client_http_body_pending
LWS_VISIBLE LWS_EXTERN void lws_client_http_body_pending(struct lws *wsi, int something_left_to_send)
lws_client_connect_info::context
struct lws_context * context
Definition: lws-client.h:67
lws_client_connect_info::pwsi
struct lws ** pwsi
Definition: lws-client.h:105
lws_context_creation_info
Definition: lws-context-vhost.h:244
lws_client_connect_info::uri_replace_to
const char * uri_replace_to
Definition: lws-client.h:101
lws_client_connect_info::seq
struct lws_sequencer * seq
Definition: lws-client.h:133
lws_client_connect_info::manual_initial_tx_credit
int manual_initial_tx_credit
Definition: lws-client.h:150
LCCSCF_PIPELINE
@ LCCSCF_PIPELINE
Definition: lws-client.h:52
lws_http_basic_auth_gen
LWS_VISIBLE LWS_EXTERN int lws_http_basic_auth_gen(const char *user, const char *pw, char *buf, size_t len)
lws_client_connect_info::method
const char * method
Definition: lws-client.h:89
lws_client_connect_info::_unused
void * _unused[4]
Definition: lws-client.h:174
lws_client_connect_info::alpn
const char * alpn
Definition: lws-client.h:126
lws_client_connect_info::port
int port
Definition: lws-client.h:71
lws_client_connect_info::opaque_user_data
void * opaque_user_data
Definition: lws-client.h:138
lws_client_connect_info::local_protocol_name
const char * local_protocol_name
Definition: lws-client.h:119
lws_client_connect_via_info
LWS_VISIBLE LWS_EXTERN struct lws * lws_client_connect_via_info(const struct lws_client_connect_info *ccinfo)
lws_client_connect_info::origin
const char * origin
Definition: lws-client.h:79
lws_client_connect_info::host
const char * host
Definition: lws-client.h:77
lws_retry_bo
Definition: lws-retry.h:25
lws_client_connect_info::sys_tls_client_cert
uint8_t sys_tls_client_cert
Definition: lws-client.h:155
lws_client_connect_ssl_connection_flags
lws_client_connect_ssl_connection_flags
Definition: lws-client.h:37
lws_client_http_multipart
LWS_VISIBLE LWS_EXTERN int lws_client_http_multipart(struct lws *wsi, const char *name, const char *filename, const char *content_type, char **p, char *end)
lws_client_connect_info::client_exts
const void * client_exts
Definition: lws-client.h:87
lws_client_connect_info::retry_and_idle_policy
const lws_retry_bo_t * retry_and_idle_policy
Definition: lws-client.h:145
lws_tls_client_vhost_extra_cert_mem
LWS_VISIBLE LWS_EXTERN int lws_tls_client_vhost_extra_cert_mem(struct lws_vhost *vh, const uint8_t *der, size_t der_len)
lws_client_connect_info::vhost
struct lws_vhost * vhost
Definition: lws-client.h:103
lws_init_vhost_client_ssl
LWS_VISIBLE LWS_EXTERN int lws_init_vhost_client_ssl(const struct lws_context_creation_info *info, struct lws_vhost *vhost)
lws_client_connect_info::userdata
void * userdata
Definition: lws-client.h:85