From 0ac3b187dff09b67bd4551e0124e6fad8884adda Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Wed, 29 Jul 2020 07:51:41 +0300 Subject: Docs completed. --- include/magi/file.h | 4 ++++ include/magi/loadfiles.h | 29 +++++++++++++++-------------- include/magi/response.h | 10 +++++----- 3 files changed, 24 insertions(+), 19 deletions(-) (limited to 'include') 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); -- cgit v1.2.3