aboutsummaryrefslogtreecommitdiff
path: root/page.h
blob: 8b1e9a0352383480dce1d988b69d40bfb2df4589 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef PAGE_H
#define PAGE_H

#include <libweb/http.h>
#include <stdbool.h>
#include <stddef.h>

struct page_quota
{
    unsigned long long cur, max;
};

struct page_resource
{
    struct http_response *r;
    const char *adir, *username, *dir, *root, *res;
    const struct page_quota *q;
    const struct http_arg *args;
    size_t n_args;
};

struct page_search
{
    struct page_search_result
    {
        char *name;
    } *results;

    const char *root, *adir, *username;
    size_t n;
    bool limit_exceeded;
};

struct page_rm
{
    const char *dir, **items;
    size_t n;
};

int page_login(struct http_response *r);
int page_style(struct http_response *r, const char *path);
int page_failed_login(struct http_response *r);
int page_forbidden(struct http_response *r);
int page_bad_request(struct http_response *r);
int page_not_found(struct http_response *r);
int page_resource(const struct page_resource *r);
int page_head_resource(struct http_response *r, const char *res);
int page_public(struct http_response *r, const char *res);
int page_share(struct http_response *r, const char *path);
int page_quota_exceeded(struct http_response *r, unsigned long long len,
    unsigned long long quota);
int page_search(struct http_response *r, const struct page_search *s);
int page_rm(struct http_response *r, const struct page_rm *rm);
int page_thumbnail(struct http_response *r, const char *res);

#endif /* PAGE_H */