libwebsockets
Lightweight C library for HTML5 websockets
lws-ws-ext.h
1 /*
2  * libwebsockets - small server side websockets and web server implementation
3  *
4  * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation:
9  * version 2.1 of the License.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  *
21  * included from libwebsockets.h
22  */
23 
32 
34 /*
35  * NOTE: These public enums are part of the abi. If you want to add one,
36  * add it at where specified so existing users are unaffected.
37  */
38 enum lws_extension_callback_reasons {
39  LWS_EXT_CB_CONSTRUCT = 4,
40  LWS_EXT_CB_CLIENT_CONSTRUCT = 5,
41  LWS_EXT_CB_DESTROY = 8,
42  LWS_EXT_CB_PACKET_TX_PRESEND = 12,
43  LWS_EXT_CB_PAYLOAD_TX = 21,
44  LWS_EXT_CB_PAYLOAD_RX = 22,
45  LWS_EXT_CB_OPTION_DEFAULT = 23,
46  LWS_EXT_CB_OPTION_SET = 24,
47  LWS_EXT_CB_OPTION_CONFIRM = 25,
48  LWS_EXT_CB_NAMED_OPTION_SET = 26,
49 
50  /****** add new things just above ---^ ******/
51 };
52 
59  /* Add new things just above here ---^
60  * This is part of the ABI, don't needlessly break compatibility */
61 };
62 
68  const char *name;
71  /* Add new things just above here ---^
72  * This is part of the ABI, don't needlessly break compatibility */
73 };
74 
77  const char *option_name;
79  const char *start;
80  int len;
81 };
82 
131 typedef int
132 lws_extension_callback_function(struct lws_context *context,
133  const struct lws_extension *ext, struct lws *wsi,
134  enum lws_extension_callback_reasons reason,
135  void *user, void *in, size_t len);
136 
139  const char *name;
141  const char *client_offer;
143  /* Add new things just above here ---^
144  * This is part of the ABI, don't needlessly break compatibility */
145 };
146 
155 LWS_VISIBLE LWS_EXTERN int
156 lws_set_extension_option(struct lws *wsi, const char *ext_name,
157  const char *opt_name, const char *opt_val);
158 
169 LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
170 lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi,
171  void *ext_user, const struct lws_ext_options *opts,
172  const char *o, int len);
173 
186 LWS_EXTERN int
187 lws_extension_callback_pm_deflate(struct lws_context *context,
188  const struct lws_extension *ext,
189  struct lws *wsi,
190  enum lws_extension_callback_reasons reason,
191  void *user, void *in, size_t len);
192 
193 /*
194  * The internal exts are part of the public abi
195  * If we add more extensions, publish the callback here ------v
196  */
Definition: lws-ws-ext.h:57
Definition: lws-ws-ext.h:55
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:132
int len
Definition: lws-ws-ext.h:80
const char * option_name
Definition: lws-ws-ext.h:77
Definition: lws-ws-ext.h:56
Definition: lws-ws-ext.h:138
int option_index
Definition: lws-ws-ext.h:78
lws_ext_options_types
Definition: lws-ws-ext.h:54
const char * start
Definition: lws-ws-ext.h:79
LWS_VISIBLE LWS_EXTERN int lws_set_extension_option(struct lws *wsi, const char *ext_name, const char *opt_name, const char *opt_val)
Definition: lws-ws-ext.h:67
Definition: lws-ws-ext.h:76
const char * client_offer
Definition: lws-ws-ext.h:141
const char * name
Definition: lws-ws-ext.h:68
const char * name
Definition: lws-ws-ext.h:139
lws_extension_callback_function * callback
Definition: lws-ws-ext.h:140
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)
enum lws_ext_options_types type
Definition: lws-ws-ext.h:69