diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2020-07-29 07:51:41 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2020-07-29 07:51:41 +0300 |
commit | 0ac3b187dff09b67bd4551e0124e6fad8884adda (patch) | |
tree | 5ef93190b12ec1e778ccc56f1b511c8ae3632739 /include | |
parent | c5aa29ffc0a82864f5155427634a9ed7c40b3d06 (diff) | |
download | magi-0ac3b187dff09b67bd4551e0124e6fad8884adda.tar magi-0ac3b187dff09b67bd4551e0124e6fad8884adda.tar.xz magi-0ac3b187dff09b67bd4551e0124e6fad8884adda.zip |
Docs completed.
Diffstat (limited to 'include')
-rw-r--r-- | include/magi/file.h | 4 | ||||
-rw-r--r-- | include/magi/loadfiles.h | 29 | ||||
-rw-r--r-- | include/magi/response.h | 10 |
3 files changed, 24 insertions, 19 deletions
diff --git a/include/magi/file.h b/include/magi/file.h index a655855..0623644 100644 --- a/include/magi/file.h +++ b/include/magi/file.h @@ -30,6 +30,10 @@ const struct magi_file *magi_files_get(const struct magi_files *files, const char *name); +/* Get value of parameter with name from file->params. */ +char *magi_file_param(struct magi_file *file, const char *name); + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Callback to load files while analysing request. * addon_len is not null if something to add is in addon diff --git a/include/magi/loadfiles.h b/include/magi/loadfiles.h index 9d7978f..85aeefc 100644 --- a/include/magi/loadfiles.h +++ b/include/magi/loadfiles.h @@ -18,30 +18,31 @@ struct magi_loadfile { int max; /* Limit in bytes. Null means unlimited. */ }; -/* Table of rules for loading files. - * Set count and files as null to initialize. */ +/* Table of rules for loading files as linked list. */ struct magi_loadfiles { - int count; /* Size of files array.*/ - struct magi_loadfile *files; /* Dynamic array of rules to load files. */ + struct magi_loadfile *item; + struct magi_loadfiles *next; }; -/* Free memory used by table. Request using table will become invalid. */ -void magi_loadfiles_free(struct magi_loadfiles *table); +/* Initialise loadfiles. */ +void magi_loadfiles_init(struct magi_loadfiles **loadfiles); +/* Free memory used by loadfiles. Request using table will become invalid. */ +void magi_loadfiles_free(struct magi_loadfiles **loadfiles); -/* Add entity into table. +/* Add entity into loadfiles. * Specify form field to load file from with name, * wnated loaction to load file with path, * and file size limit in bytes with max (pass null to unlimit). */ -void magi_loadfiles_add(struct magi_loadfiles *table, - const char *name, - const char *path, - int max); +void magi_loadfiles_add(struct magi_loadfiles **loadfiles, + const char *name, + const char *path, + int max); -/* Setup request to use loadfiles callback with table. */ -void magi_loadfiles_set(struct magi_request *request, - struct magi_loadfiles *table); +/* Setup request to use loadfiles callback. */ +void magi_loadfiles_set(struct magi_request *request, + struct magi_loadfiles **loadfiles); #endif diff --git a/include/magi/response.h b/include/magi/response.h index 6a49a0c..10c5c1c 100644 --- a/include/magi/response.h +++ b/include/magi/response.h @@ -37,19 +37,19 @@ void magi_response_status(struct magi_response *r, /* Add cookie to response. */ void magi_response_cookie(struct magi_response *r, - const char *n, - const char *d); + const char *name, + const char *data); /* Add cookie with additional information to response. */ void magi_response_cookie_complex(struct magi_response *r, const struct magi_cookie *c); /* Add request to discard cookie to response. */ void magi_response_cookie_discard(struct magi_response *r, - const char *name); + const char *name); /* Just add some general custom header. */ void magi_response_header(struct magi_response *r, - const char *n, - const char *d); + const char *name, + const char *data); /* Change Content-Length header. */ void magi_response_content_length(struct magi_response *r, int length); |