libwebsockets
Lightweight C library for HTML5 websockets
lws-ws-ext.h
Go to the documentation of this file.
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 
34 
35 /*
36  * NOTE: These public enums are part of the abi. If you want to add one,
37  * add it at where specified so existing users are unaffected.
38  */
50 
51  /****** add new things just above ---^ ******/
52 };
53 
60  /* Add new things just above here ---^
61  * This is part of the ABI, don't needlessly break compatibility */
62 };
63 
69  const char *name;
72  /* Add new things just above here ---^
73  * This is part of the ABI, don't needlessly break compatibility */
74 };
75 
78  const char *option_name;
80  const char *start;
81  int len;
82 };
83 
132 typedef int
133 lws_extension_callback_function(struct lws_context *context,
134  const struct lws_extension *ext, struct lws *wsi,
135  enum lws_extension_callback_reasons reason,
136  void *user, void *in, size_t len);
137 
140  const char *name;
142  const char *client_offer;
144  /* Add new things just above here ---^
145  * This is part of the ABI, don't needlessly break compatibility */
146 };
147 
157 lws_set_extension_option(struct lws *wsi, const char *ext_name,
158  const char *opt_name, const char *opt_val);
159 
171 lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi,
172  void *ext_user, const struct lws_ext_options *opts,
173  const char *o, int len);
174 
187 LWS_EXTERN int
188 lws_extension_callback_pm_deflate(struct lws_context *context,
189  const struct lws_extension *ext,
190  struct lws *wsi,
191  enum lws_extension_callback_reasons reason,
192  void *user, void *in, size_t len);
193 
194 /*
195  * The internal exts are part of the public abi
196  * If we add more extensions, publish the callback here ------v
197  */
const char * option_name
Definition: lws-ws-ext.h:78
const char * start
Definition: lws-ws-ext.h:80
const char * name
Definition: lws-ws-ext.h:69
const char * name
Definition: lws-ws-ext.h:140
const char * client_offer
Definition: lws-ws-ext.h:142
enum lws_ext_options_types type
Definition: lws-ws-ext.h:70
lws_extension_callback_function * callback
Definition: lws-ws-ext.h:141
LWS_EXTERN int lws_extension_callback_pm_deflate(struct lws_context *context, const struct lws_extension *ext, struct lws *wsi, enum lws_extension_callback_reasons reason, void *user, void *in, size_t len)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi, void *ext_user, const struct lws_ext_options *opts, const char *o, int len)
int lws_extension_callback_function(struct lws_context *context, const struct lws_extension *ext, struct lws *wsi, enum lws_extension_callback_reasons reason, void *user, void *in, size_t len)
Definition: lws-ws-ext.h:133
lws_ext_options_types
Definition: lws-ws-ext.h:55
LWS_VISIBLE LWS_EXTERN int lws_set_extension_option(struct lws *wsi, const char *ext_name, const char *opt_name, const char *opt_val)
lws_extension_callback_reasons
Definition: lws-ws-ext.h:39
@ EXTARG_DEC
Definition: lws-ws-ext.h:57
@ EXTARG_OPT_DEC
Definition: lws-ws-ext.h:58
@ EXTARG_NONE
Definition: lws-ws-ext.h:56
@ LWS_EXT_CB_PAYLOAD_RX
Definition: lws-ws-ext.h:45
@ LWS_EXT_CB_NAMED_OPTION_SET
Definition: lws-ws-ext.h:49
@ LWS_EXT_CB_OPTION_DEFAULT
Definition: lws-ws-ext.h:46
@ LWS_EXT_CB_PACKET_TX_PRESEND
Definition: lws-ws-ext.h:43
@ LWS_EXT_CB_DESTROY
Definition: lws-ws-ext.h:42
@ LWS_EXT_CB_CLIENT_CONSTRUCT
Definition: lws-ws-ext.h:41
@ LWS_EXT_CB_CONSTRUCT
Definition: lws-ws-ext.h:40
@ LWS_EXT_CB_OPTION_SET
Definition: lws-ws-ext.h:47
@ LWS_EXT_CB_PAYLOAD_TX
Definition: lws-ws-ext.h:44
@ LWS_EXT_CB_OPTION_CONFIRM
Definition: lws-ws-ext.h:48
#define LWS_EXTERN
#define LWS_WARN_UNUSED_RESULT
#define LWS_VISIBLE