libwebsockets
Lightweight C library for HTML5 websockets
lws-client.h
Go to the documentation of this file.
1 /*
2  * libwebsockets - small server side websockets and web server implementation
3  *
4  * Copyright (C) 2010 - 2021 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 
31 
38  LCCSCF_USE_SSL = (1 << 0),
52 
53  LCCSCF_ALLOW_REUSE_ADDR = (1 << 14),
59  LCCSCF_PIPELINE = (1 << 16),
67  LCCSCF_MUXABLE_STREAM = (1 << 17),
70  /* our validity checks are important enough to wake from suspend */
71  LCCSCF_PRIORITIZE_READS = (1 << 20),
82  LCCSCF_SECSTREAM_CLIENT = (1 << 21),
84  LCCSCF_SECSTREAM_PROXY_LINK = (1 << 22),
89  LCCSCF_IP_LOW_LATENCY = (1 << 24),
91  LCCSCF_IP_HIGH_THROUGHPUT = (1 << 25),
94  LCCSCF_IP_HIGH_RELIABILITY = (1 << 26),
97  LCCSCF_IP_LOW_COST = (1 << 27),
100  LCCSCF_CONMON = (1 << 28),
106  LCCSCF_CACHE_COOKIES = (1 << 30),
109 };
110 
115  struct lws_context *context;
117  const char *address;
119  int port;
123  const char *path;
126  const char *host;
128  const char *origin;
130  const char *protocol;
134  void *userdata;
136  const void *client_exts;
138  const char *method;
143  struct lws *parent_wsi;
147  const char *uri_replace_from;
150  const char *uri_replace_to;
152  struct lws_vhost *vhost;
154  struct lws **pwsi;
165  const char *iface;
171  const char *local_protocol_name;
178  const char *alpn;
214 #if defined(LWS_ROLE_MQTT)
216 #else
217  void *mqtt_cp;
218 #endif
219 
220 #if defined(LWS_WITH_SYS_FAULT_INJECTION)
221  lws_fi_ctx_t fic;
224 #endif
225  /* for convenience, available when FI disabled in build */
226  const char *fi_wsi_name;
243  /* Add new things just above here ---^
244  * This is part of the ABI, don't needlessly break compatibility
245  *
246  * The below is to ensure later library versions with new
247  * members added above will see 0 (default) even if the app
248  * was not built against the newer headers.
249  */
250 
251  void *_unused[4];
252 };
253 
261 LWS_VISIBLE LWS_EXTERN struct lws *
263 
291  struct lws_vhost *vhost);
313 lws_http_client_read(struct lws *wsi, char **buf, int *len);
314 
327 LWS_VISIBLE LWS_EXTERN unsigned int
329 
343  const uint8_t *der, size_t der_len);
344 
365 lws_client_http_body_pending(struct lws *wsi, int something_left_to_send);
366 
382 lws_client_http_multipart(struct lws *wsi, const char *name,
383  const char *filename, const char *content_type,
384  char **p, char *end);
385 
399 lws_http_basic_auth_gen(const char *user, const char *pw, char *buf, size_t len);
400 
416 lws_tls_session_is_reused(struct lws *wsi);
417 
const char * uri_replace_from
Definition: lws-client.h:147
struct lws ** pwsi
Definition: lws-client.h:154
const lws_retry_bo_t * retry_and_idle_policy
Definition: lws-client.h:192
lws_log_cx_t * log_cx
Definition: lws-client.h:237
const char * fi_wsi_name
Definition: lws-client.h:226
struct lws_vhost * vhost
Definition: lws-client.h:152
struct lws * parent_wsi
Definition: lws-client.h:143
const char * uri_replace_to
Definition: lws-client.h:150
const char * address
Definition: lws-client.h:117
const void * client_exts
Definition: lws-client.h:136
const char * protocol
Definition: lws-client.h:130
const char * local_protocol_name
Definition: lws-client.h:171
struct lws_context * context
Definition: lws-client.h:115
LWS_VISIBLE LWS_EXTERN void lws_client_http_body_pending(struct lws *wsi, int something_left_to_send)
LWS_VISIBLE LWS_EXTERN int lws_tls_session_is_reused(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_http_basic_auth_gen(const char *user, const char *pw, char *buf, size_t len)
LWS_VISIBLE LWS_EXTERN int lws_http_client_read(struct lws *wsi, char **buf, int *len)
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_VISIBLE LWS_EXTERN int lws_init_vhost_client_ssl(const struct lws_context_creation_info *info, struct lws_vhost *vhost)
LWS_VISIBLE LWS_EXTERN struct lws * lws_client_connect_via_info(const struct lws_client_connect_info *ccinfo)
LWS_VISIBLE LWS_EXTERN unsigned int lws_http_client_http_response(struct lws *wsi)
lws_client_connect_ssl_connection_flags
Definition: lws-client.h:37
LWS_VISIBLE LWS_EXTERN int lws_tls_client_vhost_extra_cert_mem(struct lws_vhost *vh, const uint8_t *der, size_t der_len)
@ LCCSCF_SECSTREAM_CLIENT
Definition: lws-client.h:82
@ LCCSCF_CACHE_COOKIES
Definition: lws-client.h:106
@ LCCSCF_HTTP_MULTIPART_MIME
Definition: lws-client.h:48
@ LCCSCF_HTTP_X_WWW_FORM_URLENCODED
Definition: lws-client.h:49
@ LCCSCF_IP_HIGH_RELIABILITY
Definition: lws-client.h:94
@ LCCSCF_CONMON
Definition: lws-client.h:100
@ LCCSCF_IP_LOW_LATENCY
Definition: lws-client.h:89
@ LCCSCF_IP_HIGH_THROUGHPUT
Definition: lws-client.h:91
@ LCCSCF_ALLOW_EXPIRED
Definition: lws-client.h:41
@ LCCSCF_ALLOW_REUSE_ADDR
Definition: lws-client.h:53
@ LCCSCF_H2_QUIRK_OVERFLOWS_TXCR
Definition: lws-client.h:44
@ LCCSCF_H2_MANUAL_RXFLOW
Definition: lws-client.h:47
@ LCCSCF_H2_QUIRK_NGHTTP2_END_STREAM
Definition: lws-client.h:43
@ LCCSCF_SECSTREAM_PROXY_LINK
Definition: lws-client.h:84
@ LCCSCF_USE_SSL
Definition: lws-client.h:38
@ LCCSCF_H2_PRIOR_KNOWLEDGE
Definition: lws-client.h:68
@ LCCSCF_PIPELINE
Definition: lws-client.h:59
@ LCCSCF_ALLOW_INSECURE
Definition: lws-client.h:42
@ LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK
Definition: lws-client.h:40
@ LCCSCF_H2_AUTH_BEARER
Definition: lws-client.h:45
@ LCCSCF_WAKE_SUSPEND__VALIDITY
Definition: lws-client.h:69
@ LCCSCF_ACCEPT_TLS_DOWNGRADE_REDIRECTS
Definition: lws-client.h:103
@ LCCSCF_HTTP_NO_FOLLOW_REDIRECT
Definition: lws-client.h:50
@ LCCSCF_SECSTREAM_PROXY_ONWARD
Definition: lws-client.h:86
@ LCCSCF_PRIORITIZE_READS
Definition: lws-client.h:71
@ LCCSCF_IP_LOW_COST
Definition: lws-client.h:97
@ LCCSCF_HTTP_NO_CACHE_CONTROL
Definition: lws-client.h:51
@ LCCSCF_H2_HEXIFY_AUTH_TOKEN
Definition: lws-client.h:46
@ LCCSCF_MUXABLE_STREAM
Definition: lws-client.h:67
@ LCCSCF_ALLOW_SELFSIGNED
Definition: lws-client.h:39
unsigned short uint16_t
#define LWS_EXTERN
unsigned char uint8_t
#define LWS_VISIBLE