Tue, 19 Apr 2022 19:14:49 +0200
add function for registering webdav backends
299
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2022 Olaf Wintermann. All rights reserved. |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #ifndef WS_PG_WEBDAV_H |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #define WS_PG_WEBDAV_H |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | #include "../../public/nsapi.h" |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "../../public/webdav.h" |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | #include <libpq-fe.h> |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | #ifdef __cplusplus |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | extern "C" { |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | #endif |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | |
300
0e3f275b2492
add instance field to webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
299
diff
changeset
|
41 | |
0e3f275b2492
add instance field to webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
299
diff
changeset
|
42 | typedef struct PgPropfind { |
0e3f275b2492
add instance field to webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
299
diff
changeset
|
43 | ResourceData *pg_resource; |
0e3f275b2492
add instance field to webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
299
diff
changeset
|
44 | PGconn *connection; |
0e3f275b2492
add instance field to webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
299
diff
changeset
|
45 | } PgPropfind; |
0e3f275b2492
add instance field to webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
299
diff
changeset
|
46 | |
0e3f275b2492
add instance field to webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
299
diff
changeset
|
47 | |
0e3f275b2492
add instance field to webdav backend struct
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
299
diff
changeset
|
48 | /* ----------------- webdav backend functions ----------------- */ |
299
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | int pg_dav_propfind_init( |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | WebdavPropfindRequest *rq, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | const char *path, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | WebdavPList **outplist); |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | int pg_dav_propfind_do( |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | WebdavPropfindRequest *rq, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | WebdavResponse *response, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | VFS_DIR parent, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | WebdavResource *resource, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | struct stat *s); |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | int pg_dav_propfind_finish(WebdavPropfindRequest *rq); |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | int pg_dav_proppatch_do( |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | WebdavProppatchRequest *request, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | WebdavResource *response, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | VFSFile *file, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | WebdavPList **out_set, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | WebdavPList **out_remove); |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | int pg_dav_proppatch_finish( |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | WebdavProppatchRequest *request, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | WebdavResource *response, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | VFSFile *file, |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | WSBool commit); |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | #ifdef __cplusplus |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | } |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | #endif |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | #endif /* PG_WEBDAV_H */ |
f927ef81a12b
add empty pg webdav funcs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 |