blob: cd3d675c20f98b157605f5a2c6434c1b6d67e5f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#ifndef MAGI_INCLUDED_FILE
#define MAGI_INCLUDED_FILE
/* Form field of file with its parameters.
*/
#include "param.h"
typedef struct magi_file {
char *field; /* Name of form field. */
char *filename; /* File name on user's computer. */
magi_params *params; /* Multipart params (e.g. type). */
} magi_file;
/* Form files collection, implemented as a linked list. */
typedef struct magi_files {
struct magi_files *next; /* Pointer to next files. */
magi_file item; /* File on top. */
} magi_files;
/* Free memory used by files. */
void magi_files_free(magi_files *files);
/* Add newitem onto top of files. */
void magi_files_add(magi_files **files, magi_file *newitem);
/* Get first from top of files file with name, null if no such file. */
const magi_file *magi_files_get(const magi_files *files, const char *name);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Callback to load files while analysing request.
* addon_len is not null if something to add is in addon
* and null if file_to_add_into is ended.
* Files are passed sequentialy, one by one. */
typedef void (*magi_file_callback_act)(void *userdata,
magi_file *file_to_add_into,
char *addon,
int addon_len);
typedef struct magi_file_callback {
magi_file_callback_act act;
void *userdata;
int addon_max;
} magi_file_callback;
#endif
|