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 #ifndef WS_PG_WEBDAV_H
30 #define WS_PG_WEBDAV_H
31
32 #include "../../public/nsapi.h"
33 #include "../../public/webdav.h"
34
35 #include "config.h"
36
37 #include <libpq-fe.h>
38 #include <cx/buffer.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 #define PG_MAX_PATH_LEN 0x8000
45
46 typedef struct PgWebdavBackend {
47 ResourceData *pg_resource;
48 PGconn *connection;
49 PgRepository *repository;
50 char root_resource_id_str[
32];
51 } PgWebdavBackend;
52
53 typedef struct PgPropfindExtCol {
54
55
56
57 PgPropertyStoreExt *ext;
58
59
60
61 int field_num;
62 } PgPropfindExtCol;
63
64 typedef struct PgPropfind {
65 const char *path;
66 int64_t resource_id;
67 WebdavVFSProperties vfsproperties;
68 PGresult *result;
69 PgPropfindExtCol *ext;
70 size_t numext;
71 int nrows;
72 } PgPropfind;
73
74 typedef struct PgProppatchExtProp PgProppatchExtProp;
75 struct PgProppatchExtProp {
76 PgPropertyStoreExt *column;
77 WebdavProperty *property;
78 PgProppatchExtProp *next;
79 };
80
81 typedef struct {
82 PgProppatchExtProp *set_begin;
83 PgProppatchExtProp *set_end;
84 PgProppatchExtProp *remove_begin;
85 PgProppatchExtProp *remove_end;
86 WSBool isused;
87 } PgProppatchExt;
88
89 typedef struct {
90 int64_t resource_id;
91 PgProppatchExt *ext;
92 size_t numext;
93 WSBool extensions_used;
94 } PgProppatch;
95
96 void* pg_webdav_init(ServerConfiguration *cfg,
pool_handle_t *pool, WSConfigNode *config);
97 WebdavBackend* pg_webdav_create(Session *sn, Request *rq, pblock *pb,
void *initData);
98 WebdavBackend* pg_webdav_create_from_resdata(Session *sn, Request *rq, PgRepository *repo, ResourceData *resdata);
99
100 WebdavBackend* pg_webdav_prop_create(Session *sn, Request *rq, pblock *pb);
101
102 int pg_create_property_param_arrays(WebdavPList *plist, CxBuffer *xmlns, CxBuffer *pname);
103
104
105 int pg_dav_propfind_init(
106 WebdavPropfindRequest *rq,
107 const char *path,
108 const char *href,
109 WebdavPList **outplist);
110
111 int pg_dav_propfind_do(
112 WebdavPropfindRequest *rq,
113 WebdavResponse *response,
114 VFS_DIR parent,
115 WebdavResource *resource,
116 struct stat *s);
117
118 int pg_dav_propfind_finish(WebdavPropfindRequest *rq);
119
120 int pg_dav_proppatch_do(
121 WebdavProppatchRequest *request,
122 WebdavResource *response,
123 VFSFile *file,
124 WebdavPList **out_set,
125 WebdavPList **out_remove);
126
127 int pg_dav_proppatch_finish(
128 WebdavProppatchRequest *request,
129 WebdavResource *response,
130 VFSFile *file,
131 WSBool commit);
132
133 #ifdef __cplusplus
134 }
135 #endif
136
137 #endif
138
139