diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-07-20 23:47:33 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-07-21 01:28:38 +0200 |
| commit | 8c3ba33ced08b211db0cd5f81675bdf62f55acc7 (patch) | |
| tree | 928ccf6a025db57c3a038a56a920735dccd286ff /include/slweb/handler.h | |
| parent | 4dd531b9ed1923837da32d69fa1933ec9083f8db (diff) | |
Move header files to subdirectory
Since slweb is meant as a library, it is advisable to keep public header
files under their own directory in order to avoid name clashing i.e.,
#include "something.h"
Now becomes:
#include "slweb/something.h"
Diffstat (limited to 'include/slweb/handler.h')
| -rw-r--r-- | include/slweb/handler.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/slweb/handler.h b/include/slweb/handler.h new file mode 100644 index 0000000..4ac7f76 --- /dev/null +++ b/include/slweb/handler.h @@ -0,0 +1,24 @@ +#ifndef HANDLER_H +#define HANDLER_H + +#include "slweb/http.h" +#include <stddef.h> + +typedef int (*handler_fn)(const struct http_payload *p, + struct http_response *r, void *user); + +struct handler_cfg +{ + const char *tmpdir; + int (*length)(unsigned long long len, const struct http_cookie *c, + struct http_response *r, void *user); + void *user; +}; + +struct handler *handler_alloc(const struct handler_cfg *cfg); +void handler_free(struct handler *h); +int handler_add(struct handler *h, const char *url, enum http_op op, + handler_fn f, void *user); +int handler_listen(struct handler *h, short port); + +#endif /* HANDLER_H */ |
