src/server/admin/admin.h

Fri, 01 Nov 2024 12:25:52 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 01 Nov 2024 12:25:52 +0100
changeset 562
69fc4ecc5f60
parent 81
d25825f37967
permissions
-rw-r--r--

fix pgext uses a wrong field number, if the column has the same name as a resource or property column

81
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2013 Olaf Wintermann. All rights reserved.
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
d25825f37967 preparation for admin interface
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
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #ifndef ADMIN_H
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #define ADMIN_H
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #include "../public/nsapi.h"
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 #include "webui.h"
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 #ifdef __cplusplus
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 extern "C" {
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 #endif
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 typedef struct admin_page Page;
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 typedef struct admin_request AdminRequest;
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 typedef int (*admin_service_f)(Page *, AdminRequest *);
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 struct admin_page {
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 /*
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 * The name of the page is an element of the admin page path. The path is
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 * used to map urls to admin pages. If the name is NULL, every name is
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 * mapped to this page.
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 */
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 char *name;
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 /*
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 * Parent page
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 */
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 Page *parent;
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 /*
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 *
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 */
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 Page *next;
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 /*
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 * Pointer to the first child
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 */
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 Page *children;
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 /*
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 * int service(Page *page, AdminRequest *rq)
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 *
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 * Service handler function for the page
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 */
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 int (*service)(Page *page, AdminRequest *rq);
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 /*
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 * custom user data
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 */
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 void *data;
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 };
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 struct admin_request {
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 Session *sn;
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 Request *rq;
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 char *name;
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 };
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 int admin_init(pblock *pb, Session *sn, Request *rq);
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 int admin_service(pblock *pb, Session *sn, Request *rq);
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 int admin_root(Page *page, AdminRequest *rq);
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 int adm_listener(Page *page, AdminRequest *rq);
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 int adm_cfglistener(Page *page, AdminRequest *rq);
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 int adm_auth(Page *page, AdminRequest *rq);
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93 Page* admin_page_create(pool_handle_t *pool, char *name, admin_service_f f);
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94 void admin_add_page(Page *parent, Page *child);
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 #ifdef __cplusplus
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 }
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 #endif
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 #endif /* ADMIN_H */
d25825f37967 preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102

mercurial