libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-spa.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
44
57
71typedef int (*lws_spa_fileupload_cb)(void *data, const char *name,
72 const char *filename, char *buf, int len,
73 enum lws_spa_fileupload_states state);
74
77struct lws_spa;
78
105LWS_VISIBLE LWS_EXTERN struct lws_spa *
106lws_spa_create(struct lws *wsi, const char * const *param_names,
107 int count_params, int max_storage, lws_spa_fileupload_cb opt_cb,
108 void *opt_data);
109
110typedef struct lws_spa_create_info {
111 const char * const *param_names;
119 int count_params; /* count of param_names */
120 int max_storage; /* total amount of form parameter values we can store */
121 lws_spa_fileupload_cb opt_cb; /* NULL, or callback to receive file upload data. */
122 void *opt_data; /* NULL, or user pointer provided to opt_cb. */
123 size_t param_names_stride; /* 0 if param_names is an array of char *.
124 Else stride to next char * */
125 struct lwsac **ac; /* NULL, or pointer to lwsac * to contain all
126 related heap allocations */
127 size_t ac_chunk_size; /* 0 for default, or ac chunk size */
129
144LWS_VISIBLE LWS_EXTERN struct lws_spa *
145lws_spa_create_via_info(struct lws *wsi, const lws_spa_create_info_t *info);
146
155lws_spa_process(struct lws_spa *spa, const char *in, int len);
156
163lws_spa_finalize(struct lws_spa *spa);
164
172lws_spa_get_length(struct lws_spa *spa, int n);
173
183LWS_VISIBLE LWS_EXTERN const char *
184lws_spa_get_string(struct lws_spa *spa, int n);
185
197LWS_VISIBLE LWS_EXTERN const char *
198lws_spa_get_name(struct lws_spa *spa, int n);
199
206lws_spa_destroy(struct lws_spa *spa);
size_t param_names_stride
Definition lws-spa.h:123
struct lwsac ** ac
Definition lws-spa.h:125
const char *const * param_names
Definition lws-spa.h:111
lws_spa_fileupload_cb opt_cb
Definition lws-spa.h:121
LWS_VISIBLE LWS_EXTERN const char * lws_spa_get_string(struct lws_spa *spa, int n)
LWS_VISIBLE LWS_EXTERN int lws_spa_get_length(struct lws_spa *spa, int n)
lws_spa_fileupload_states
Definition lws-spa.h:46
int(* lws_spa_fileupload_cb)(void *data, const char *name, const char *filename, char *buf, int len, enum lws_spa_fileupload_states state)
Definition lws-spa.h:71
struct lws_spa_create_info lws_spa_create_info_t
LWS_VISIBLE LWS_EXTERN int lws_spa_finalize(struct lws_spa *spa)
LWS_VISIBLE LWS_EXTERN int lws_spa_process(struct lws_spa *spa, const char *in, int len)
LWS_VISIBLE LWS_EXTERN int lws_spa_destroy(struct lws_spa *spa)
LWS_VISIBLE LWS_EXTERN struct lws_spa * lws_spa_create(struct lws *wsi, const char *const *param_names, int count_params, int max_storage, lws_spa_fileupload_cb opt_cb, void *opt_data)
LWS_VISIBLE LWS_EXTERN struct lws_spa * lws_spa_create_via_info(struct lws *wsi, const lws_spa_create_info_t *info)
LWS_VISIBLE LWS_EXTERN const char * lws_spa_get_name(struct lws_spa *spa, int n)
@ LWS_UFS_CLOSE
Definition lws-spa.h:54
@ LWS_UFS_OPEN
Definition lws-spa.h:51
@ LWS_UFS_FINAL_CONTENT
Definition lws-spa.h:49
@ LWS_UFS_CONTENT
Definition lws-spa.h:47
#define LWS_EXTERN
#define LWS_VISIBLE