src/server/plugins/postgresql/config.h

Sat, 24 Sep 2022 16:19:24 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 24 Sep 2022 16:19:24 +0200
branch
webdav
changeset 384
f9e9f2b3e299
parent 374
77506ec632a4
child 415
d938228c382e
permissions
-rw-r--r--

remove debug code

366
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2022 Olaf Wintermann. All rights reserved.
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
47bc686fafe4 add new dav config element
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
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #ifndef WS_PG_CONFIG_H
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 #define WS_PG_CONFIG_H
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 #include "../../public/nsapi.h"
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 #include "../../public/webdav.h"
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #include "../../daemon/config.h"
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 #include "../../config/serverconfig.h"
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 #include <inttypes.h>
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 #include <libpq-fe.h>
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 #include <ucx/string.h>
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 #ifdef __cplusplus
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 extern "C" {
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 #endif
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48
373
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
49 typedef struct {
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
50 char *table;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
51 WSBool isused;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
52 } PgExtTable;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
53
366
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 typedef struct PgRepository {
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 int64_t root_resource_id;
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 sstr_t resourcepool;
373
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
57 PgExtTable *tables;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
58 size_t ntables;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
59 UcxMap *prop_ext;
366
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 } PgRepository;
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61
373
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
62 typedef struct {
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
63 char *column;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
64 char *ns;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
65 char *name;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
66 int tableindex;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
67 } PgPropertyStoreExt;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
68
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
69 typedef struct {
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
70 UcxMap *table_lookup;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
71 UcxList *tables;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
72 } PgExtParser;
f78a585e1a2f add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 372
diff changeset
73
374
77506ec632a4 use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
74 int pg_lookup_root(ResourceData *res, const char *rootnode, int64_t *rootid);
77506ec632a4 use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 373
diff changeset
75
372
1d2538a1ba8f add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 366
diff changeset
76 PgRepository* pg_init_repo(ServerConfiguration *cfg, pool_handle_t *pool, WSConfigNode *config);
366
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 #ifdef __cplusplus
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 }
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 #endif
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 #endif /* WS_PG_CONFIG_H */
47bc686fafe4 add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83

mercurial