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
100LWS_VISIBLE LWS_EXTERN struct lws_spa *
101lws_spa_create(struct lws *wsi, const char * const *param_names,
102 int count_params, int max_storage, lws_spa_fileupload_cb opt_cb,
103 void *opt_data);
104
105typedef struct lws_spa_create_info {
106 const char * const *param_names;
108 int count_params; /* count of param_names */
109 int max_storage; /* total amount of form parameter values we can store */
110 lws_spa_fileupload_cb opt_cb; /* NULL, or callback to receive file upload data. */
111 void *opt_data; /* NULL, or user pointer provided to opt_cb. */
112 size_t param_names_stride; /* 0 if param_names is an array of char *.
113 Else stride to next char * */
114 struct lwsac **ac; /* NULL, or pointer to lwsac * to contain all
115 related heap allocations */
116 size_t ac_chunk_size; /* 0 for default, or ac chunk size */
118
133LWS_VISIBLE LWS_EXTERN struct lws_spa *
134lws_spa_create_via_info(struct lws *wsi, const lws_spa_create_info_t *info);
135
144lws_spa_process(struct lws_spa *spa, const char *in, int len);
145
152lws_spa_finalize(struct lws_spa *spa);
153
161lws_spa_get_length(struct lws_spa *spa, int n);
162
172LWS_VISIBLE LWS_EXTERN const char *
173lws_spa_get_string(struct lws_spa *spa, int n);
174
181lws_spa_destroy(struct lws_spa *spa);
size_t param_names_stride
Definition lws-spa.h:112
struct lwsac ** ac
Definition lws-spa.h:114
const char *const * param_names
Definition lws-spa.h:106
lws_spa_fileupload_cb opt_cb
Definition lws-spa.h:110
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_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