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
56
70typedef int (*lws_spa_fileupload_cb)(void *data, const char *name,
71 const char *filename, char *buf, int len,
72 enum lws_spa_fileupload_states state);
73
76struct lws_spa;
77
99LWS_VISIBLE LWS_EXTERN struct lws_spa *
100lws_spa_create(struct lws *wsi, const char * const *param_names,
101 int count_params, int max_storage, lws_spa_fileupload_cb opt_cb,
102 void *opt_data);
103
104typedef struct lws_spa_create_info {
105 const char * const *param_names;
107 int count_params; /* count of param_names */
108 int max_storage; /* total amount of form parameter values we can store */
109 lws_spa_fileupload_cb opt_cb; /* NULL, or callback to receive file upload data. */
110 void *opt_data; /* NULL, or user pointer provided to opt_cb. */
111 size_t param_names_stride; /* 0 if param_names is an array of char *.
112 Else stride to next char * */
113 struct lwsac **ac; /* NULL, or pointer to lwsac * to contain all
114 related heap allocations */
115 size_t ac_chunk_size; /* 0 for default, or ac chunk size */
117
132LWS_VISIBLE LWS_EXTERN struct lws_spa *
133lws_spa_create_via_info(struct lws *wsi, const lws_spa_create_info_t *info);
134
143lws_spa_process(struct lws_spa *spa, const char *in, int len);
144
151lws_spa_finalize(struct lws_spa *spa);
152
160lws_spa_get_length(struct lws_spa *spa, int n);
161
167LWS_VISIBLE LWS_EXTERN const char *
168lws_spa_get_string(struct lws_spa *spa, int n);
169
176lws_spa_destroy(struct lws_spa *spa);
size_t param_names_stride
Definition lws-spa.h:111
struct lwsac ** ac
Definition lws-spa.h:113
const char *const * param_names
Definition lws-spa.h:105
lws_spa_fileupload_cb opt_cb
Definition lws-spa.h:109
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:70
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:53
@ 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