From a93c561921b79e5f27b986292fe70dce1879f91e Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Fri, 21 Feb 2020 18:09:22 +0300 Subject: [magi] --- include/magi/loadfile.h | 31 +++++++++++++++++++++++++++++++ include/magi/request.h | 27 --------------------------- 2 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 include/magi/loadfile.h (limited to 'include') diff --git a/include/magi/loadfile.h b/include/magi/loadfile.h new file mode 100644 index 0000000..942c298 --- /dev/null +++ b/include/magi/loadfile.h @@ -0,0 +1,31 @@ +#ifndef MAGI_INCLUDED_LOADFILE +#define MAGI_INCLUDED_LOADFILE + +#include "request.h" + + +typedef struct magi_loadfile { + const char *param_name; /* Form field name, in which file is expected. */ + const char *location; /* Location to load file in. */ + int maximum; /* Limit in bytes. Null <=> unlimited. */ +} magi_loadfile; + +typedef struct magi_loadfiles { + int count; + magi_loadfile *files; +} magi_loadfiles; + +void magi_loadfiles_add(magi_loadfiles *table, + const char *name, + const char *path, + int max); + +void magi_loadfiles_destroy(magi_loadfiles *table); + +/* Setup request callback with files loaded into corresponding to their + * parameter names locations; paths are in magi_loadfiles struct. */ +void magi_request_setup_loadfiles(magi_request *request, + magi_loadfiles *table); + + +#endif diff --git a/include/magi/request.h b/include/magi/request.h index b15f085..47acb27 100644 --- a/include/magi/request.h +++ b/include/magi/request.h @@ -89,31 +89,4 @@ void magi_request_setup(magi_request *request); void magi_request_destroy(magi_request *request); -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Tempfiles Callback - */ -typedef struct magi_tempfile { - const char *param_name; /* Form field name, in which file is expected. */ - const char *location; /* Location to load file in. */ - int maximum; /* Null <=> unlimited. */ -} magi_tempfile; - -typedef struct magi_tempfiles { - int count; - magi_tempfile *tmps; -} magi_tempfiles; - -void magi_tempfiles_add(magi_tempfiles *tmps, - const char *name, - const char *path, - int max); - -void magi_tempfiles_destroy(magi_tempfiles *tmps); - -/* Setup request callback with files loaded into corresponding to their - * parameter names locations; paths are in magi_tempfiles struct. */ -void magi_request_setup_tempfiles(magi_request *request, - magi_tempfiles *table); - - #endif -- cgit v1.2.3