libwebsockets
Lightweight C library for HTML5 websockets
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
46
enum
lws_spa_fileupload_states
{
47
LWS_UFS_CONTENT
,
49
LWS_UFS_FINAL_CONTENT
,
51
LWS_UFS_OPEN
,
53
LWS_UFS_CLOSE
55
};
56
70
typedef
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
76
struct
lws_spa;
77
99
LWS_VISIBLE
LWS_EXTERN
struct
lws_spa *
100
lws_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
104
typedef
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 */
116
}
lws_spa_create_info_t
;
117
132
LWS_VISIBLE
LWS_EXTERN
struct
lws_spa *
133
lws_spa_create_via_info
(
struct
lws *wsi,
const
lws_spa_create_info_t
*info);
134
142
LWS_VISIBLE
LWS_EXTERN
int
143
lws_spa_process
(
struct
lws_spa *spa,
const
char
*in,
int
len);
144
150
LWS_VISIBLE
LWS_EXTERN
int
151
lws_spa_finalize
(
struct
lws_spa *spa);
152
159
LWS_VISIBLE
LWS_EXTERN
int
160
lws_spa_get_length
(
struct
lws_spa *spa,
int
n);
161
167
LWS_VISIBLE
LWS_EXTERN
const
char
*
168
lws_spa_get_string
(
struct
lws_spa *spa,
int
n);
169
175
LWS_VISIBLE
LWS_EXTERN
int
176
lws_spa_destroy
(
struct
lws_spa *spa);
lws_spa_create_info::ac_chunk_size
size_t ac_chunk_size
Definition:
lws-spa.h:115
lws_spa_create_info::param_names_stride
size_t param_names_stride
Definition:
lws-spa.h:111
lws_spa_create_info::ac
struct lwsac ** ac
Definition:
lws-spa.h:113
lws_spa_create_info::max_storage
int max_storage
Definition:
lws-spa.h:108
lws_spa_create_info::count_params
int count_params
Definition:
lws-spa.h:107
lws_spa_create_info::param_names
const char *const * param_names
Definition:
lws-spa.h:105
lws_spa_create_info::opt_cb
lws_spa_fileupload_cb opt_cb
Definition:
lws-spa.h:109
lws_spa_create_info::opt_data
void * opt_data
Definition:
lws-spa.h:110
lws_spa_create
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_spa_get_string
LWS_VISIBLE LWS_EXTERN const char * lws_spa_get_string(struct lws_spa *spa, int n)
lws_spa_get_length
LWS_VISIBLE LWS_EXTERN int lws_spa_get_length(struct lws_spa *spa, int n)
lws_spa_fileupload_states
lws_spa_fileupload_states
Definition:
lws-spa.h:46
lws_spa_fileupload_cb
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
lws_spa_create_info_t
struct lws_spa_create_info lws_spa_create_info_t
lws_spa_finalize
LWS_VISIBLE LWS_EXTERN int lws_spa_finalize(struct lws_spa *spa)
lws_spa_create_via_info
LWS_VISIBLE LWS_EXTERN struct lws_spa * lws_spa_create_via_info(struct lws *wsi, const lws_spa_create_info_t *info)
lws_spa_process
LWS_VISIBLE LWS_EXTERN int lws_spa_process(struct lws_spa *spa, const char *in, int len)
lws_spa_destroy
LWS_VISIBLE LWS_EXTERN int lws_spa_destroy(struct lws_spa *spa)
LWS_UFS_CLOSE
@ LWS_UFS_CLOSE
Definition:
lws-spa.h:53
LWS_UFS_OPEN
@ LWS_UFS_OPEN
Definition:
lws-spa.h:51
LWS_UFS_FINAL_CONTENT
@ LWS_UFS_FINAL_CONTENT
Definition:
lws-spa.h:49
LWS_UFS_CONTENT
@ LWS_UFS_CONTENT
Definition:
lws-spa.h:47
lws_spa_create_info
Definition:
lws-spa.h:104
LWS_EXTERN
#define LWS_EXTERN
Definition:
libwebsockets.h:225
LWS_VISIBLE
#define LWS_VISIBLE
Definition:
libwebsockets.h:220
include
libwebsockets
lws-spa.h
Generated on Fri Nov 8 2024 07:57:58 for libwebsockets by
1.9.1