libwebsockets
Lightweight C library for HTML5 websockets
lws-protocols-plugins.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 
39 
43 struct lws_protocols {
44  const char *name;
65  unsigned int id;
72  void *user;
84  /* Add new things just above here ---^
85  * This is part of the ABI, don't needlessly break compatibility */
86 };
87 
96 LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
97 lws_vhost_name_to_protocol(struct lws_vhost *vh, const char *name);
98 
108 LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
109 lws_get_protocol(struct lws *wsi);
110 
112 LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
113 lws_protocol_get(struct lws *wsi) LWS_WARN_DEPRECATED;
114 
125 LWS_VISIBLE LWS_EXTERN void *
126 lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost,
127  const struct lws_protocols *prot, int size);
128 
138 LWS_VISIBLE LWS_EXTERN void *
139 lws_protocol_vh_priv_get(struct lws_vhost *vhost,
140  const struct lws_protocols *prot);
141 
156 LWS_VISIBLE LWS_EXTERN void *
157 lws_adjust_protocol_psds(struct lws *wsi, size_t new_size);
158 
167 LWS_VISIBLE LWS_EXTERN int
168 lws_finalize_startup(struct lws_context *context);
169 
178 LWS_VISIBLE LWS_EXTERN const struct lws_protocol_vhost_options *
179 lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name);
180 
190 LWS_VISIBLE LWS_EXTERN int
191 lws_pvo_get_str(void *in, const char *name, const char **result);
192 
193 LWS_VISIBLE LWS_EXTERN int
194 lws_protocol_init(struct lws_context *context);
195 
196 #ifdef LWS_WITH_PLUGINS
197 
198 /* PLUGINS implies LIBUV */
199 
200 #define LWS_PLUGIN_API_MAGIC 180
201 
203 struct lws_plugin_capability {
204  unsigned int api_magic;
205  const struct lws_protocols *protocols;
206  int count_protocols;
207  const struct lws_extension *extensions;
208  int count_extensions;
209 };
210 
211 typedef int (*lws_plugin_init_func)(struct lws_context *,
212  struct lws_plugin_capability *);
213 typedef int (*lws_plugin_destroy_func)(struct lws_context *);
214 
216 struct lws_plugin {
217  struct lws_plugin *list;
218 #if (UV_VERSION_MAJOR > 0)
219  uv_lib_t lib;
220 #else
221  void *l;
222 #endif
223  char name[64];
224  struct lws_plugin_capability caps;
225 };
226 
227 #endif
228 
lws_protocol_vhost_options
Definition: lws-context-vhost.h:852
lws_callback_function
int lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len)
Definition: lws-callbacks.h:798
lws_protocol_get
LWS_VISIBLE LWS_EXTERN const struct lws_protocols * lws_protocol_get(struct lws *wsi) LWS_WARN_DEPRECATED
lws_protocol_vhost_options::name
const char * name
Definition: lws-context-vhost.h:855
lws_pvo_get_str
LWS_VISIBLE LWS_EXTERN int lws_pvo_get_str(void *in, const char *name, const char **result)
lws_protocols::user
void * user
Definition: lws-protocols-plugins.h:72
lws_protocol_vh_priv_get
LWS_VISIBLE LWS_EXTERN void * lws_protocol_vh_priv_get(struct lws_vhost *vhost, const struct lws_protocols *prot)
lws_extension
Definition: lws-ws-ext.h:138
lws_get_protocol
LWS_VISIBLE LWS_EXTERN const struct lws_protocols * lws_get_protocol(struct lws *wsi)
lws_finalize_startup
LWS_VISIBLE LWS_EXTERN int lws_finalize_startup(struct lws_context *context)
lws_protocols::rx_buffer_size
size_t rx_buffer_size
Definition: lws-protocols-plugins.h:56
lws_protocol_vh_priv_zalloc
LWS_VISIBLE LWS_EXTERN void * lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost, const struct lws_protocols *prot, int size)
lws_adjust_protocol_psds
LWS_VISIBLE LWS_EXTERN void * lws_adjust_protocol_psds(struct lws *wsi, size_t new_size)
lws_protocols::tx_packet_size
size_t tx_packet_size
Definition: lws-protocols-plugins.h:74
lws_protocols::id
unsigned int id
Definition: lws-protocols-plugins.h:65
lws_protocols
Definition: lws-protocols-plugins.h:43
lws_vhost_name_to_protocol
LWS_VISIBLE LWS_EXTERN const struct lws_protocols * lws_vhost_name_to_protocol(struct lws_vhost *vh, const char *name)
lws_protocols::callback
lws_callback_function * callback
Definition: lws-protocols-plugins.h:47
lws_protocols::name
const char * name
Definition: lws-protocols-plugins.h:44
lws_protocols::per_session_data_size
size_t per_session_data_size
Definition: lws-protocols-plugins.h:51
lws_pvo_search
LWS_VISIBLE LWS_EXTERN const struct lws_protocol_vhost_options * lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name)