libwebsockets
Lightweight C library for HTML5 websockets
lws-spa.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 
43 
54 };
55 
69 typedef int (*lws_spa_fileupload_cb)(void *data, const char *name,
70  const char *filename, char *buf, int len,
71  enum lws_spa_fileupload_states state);
72 
75 struct lws_spa;
76 
98 LWS_VISIBLE LWS_EXTERN struct lws_spa *
99 lws_spa_create(struct lws *wsi, const char * const *param_names,
100  int count_params, int max_storage, lws_spa_fileupload_cb opt_cb,
101  void *opt_data);
102 
103 typedef struct lws_spa_create_info {
104  const char * const *param_names; /* array of form parameter names, like "username" */
105  int count_params; /* count of param_names */
106  int max_storage; /* total amount of form parameter values we can store */
107  lws_spa_fileupload_cb opt_cb; /* NULL, or callback to receive file upload data. */
108  void *opt_data; /* NULL, or user pointer provided to opt_cb. */
109  size_t param_names_stride; /* 0 if param_names is an array of char *.
110  Else stride to next char * */
111  struct lwsac **ac; /* NULL, or pointer to lwsac * to contain all
112  related heap allocations */
113  size_t ac_chunk_size; /* 0 for default, or ac chunk size */
115 
130 LWS_VISIBLE LWS_EXTERN struct lws_spa *
131 lws_spa_create_via_info(struct lws *wsi, const lws_spa_create_info_t *info);
132 
140 LWS_VISIBLE LWS_EXTERN int
141 lws_spa_process(struct lws_spa *spa, const char *in, int len);
142 
148 LWS_VISIBLE LWS_EXTERN int
149 lws_spa_finalize(struct lws_spa *spa);
150 
157 LWS_VISIBLE LWS_EXTERN int
158 lws_spa_get_length(struct lws_spa *spa, int n);
159 
165 LWS_VISIBLE LWS_EXTERN const char *
166 lws_spa_get_string(struct lws_spa *spa, int n);
167 
173 LWS_VISIBLE LWS_EXTERN int
174 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 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:45
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:69
LWS_VISIBLE LWS_EXTERN int lws_spa_finalize(struct lws_spa *spa)
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 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_UFS_CLOSE
Definition: lws-spa.h:52
@ LWS_UFS_OPEN
Definition: lws-spa.h:50
@ LWS_UFS_FINAL_CONTENT
Definition: lws-spa.h:48
@ LWS_UFS_CONTENT
Definition: lws-spa.h:46
Definition: lws-spa.h:103