diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/magi.hpp | 7 | ||||
-rw-r--r-- | include/magi/cookie.h | 6 | ||||
-rw-r--r-- | include/magi/file.h | 14 | ||||
-rw-r--r-- | include/magi/param.h | 11 | ||||
-rw-r--r-- | include/magi/response.h | 6 |
5 files changed, 26 insertions, 18 deletions
diff --git a/include/magi.hpp b/include/magi.hpp new file mode 100644 index 0000000..b3547b3 --- /dev/null +++ b/include/magi.hpp @@ -0,0 +1,7 @@ +#ifndef MAGI_INCLUDED_EVERYTHING +/* Shortcut to use magi in C++, eliminates manual use of 'extern "C"'. + */ +extern "C" { +#include "magi.h" +} +#endif diff --git a/include/magi/cookie.h b/include/magi/cookie.h index 68cbe3f..40b9175 100644 --- a/include/magi/cookie.h +++ b/include/magi/cookie.h @@ -8,7 +8,7 @@ struct magi_cookie { char *name; /* Cookie name. */ char *data; /* Cookie value. */ - char *path; /* Path on which cookie is set. Without '/' at the end. */ + char *path; /* Path on which cookie is set, without '/' at the end. */ char *domain; /* Domain in wich cookie is set. * With dot at the begining. */ char *max_age; /* In seconds until discard (response only). */ @@ -25,8 +25,8 @@ struct magi_cookies { void magi_cookies_free(struct magi_cookies *cookies); /* Add newitem onto top of cookies. */ -void magi_cookies_add(struct magi_cookies **cookies, - struct magi_cookie *newitem); +void magi_cookies_add(struct magi_cookies **cookies, + const struct magi_cookie *newitem); /* Get first cookie with given name, null if no such cookie. * First cookie is the most accurate in terms of domain and path. */ diff --git a/include/magi/file.h b/include/magi/file.h index 615d8b7..a655855 100644 --- a/include/magi/file.h +++ b/include/magi/file.h @@ -22,8 +22,8 @@ struct magi_files { void magi_files_free(struct magi_files *files); /* Add newitem onto top of files. */ -void magi_files_add(struct magi_files **files, - struct magi_file *newitem); +void magi_files_add(struct magi_files **files, + const struct magi_file *newitem); /* Get first from top of files file with name, null if no such file. */ const struct magi_file *magi_files_get(const struct magi_files *files, @@ -36,11 +36,11 @@ const struct magi_file *magi_files_get(const struct magi_files *files, * and null if file is ended. * newfile flag is setted up in the beginning of new file. * Files are passed sequentialy, one by one. */ -typedef void (*magi_file_callback_act)(void *userdata, - int newfile, - struct magi_file *file, - char *addon, - int addon_len); +typedef void (*magi_file_callback_act)(void *userdata, + int newfile, + const struct magi_file *file, + const char *addon, + int addon_len); struct magi_file_callback { magi_file_callback_act act; diff --git a/include/magi/param.h b/include/magi/param.h index 44ea384..b5bb27e 100644 --- a/include/magi/param.h +++ b/include/magi/param.h @@ -20,14 +20,15 @@ struct magi_params { void magi_params_free(struct magi_params *params); /* Add newitem onto top of params. */ -void magi_params_add(struct magi_params **params, - struct magi_param *newitem); +void magi_params_add(struct magi_params **params, + const struct magi_param *newitem); /* Set newitem in params. - * If param with name of newitem is in params it will be replaced with newitem, + * If param with name of newitem is in params + * it will be replaced with newitem, * otherwise newitem will be added into the end of params. */ -void magi_params_set(struct magi_params **params, - struct magi_param *newitem); +void magi_params_set(struct magi_params **params, + const struct magi_param *newitem); /* Get data of the first from top of params parameter with name, * null if no such parameter. */ diff --git a/include/magi/response.h b/include/magi/response.h index 3ef053a..6a49a0c 100644 --- a/include/magi/response.h +++ b/include/magi/response.h @@ -22,7 +22,7 @@ struct magi_response { /* Response initialiser, setup defaults. */ void magi_response_init(struct magi_response *r); /* Send response headers. */ -void magi_response_send(struct magi_response *r); +void magi_response_send(const struct magi_response *r); /* Free memory used by response headers. */ void magi_response_free(struct magi_response *r); @@ -40,8 +40,8 @@ void magi_response_cookie(struct magi_response *r, const char *n, const char *d); /* Add cookie with additional information to response. */ -void magi_response_cookie_complex(struct magi_response *r, - struct magi_cookie *c); +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); |