add check for shadow support, turn -Os back on
[project/uhttpd.git] / plugin.h
1 /*
2  * uhttpd - Tiny single-threaded httpd - Main header
3  *
4  *   Copyright (C) 2010-2012 Jo-Philipp Wich <xm@subsignal.org>
5  *   Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
6  *
7  *  Licensed under the Apache License, Version 2.0 (the "License");
8  *  you may not use this file except in compliance with the License.
9  *  You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  *  Unless required by applicable law or agreed to in writing, software
14  *  distributed under the License is distributed on an "AS IS" BASIS,
15  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  *  See the License for the specific language governing permissions and
17  *  limitations under the License.
18  */
19
20 #include "uhttpd.h"
21
22 struct uhttpd_ops {
23         void (*dispatch_add)(struct dispatch_handler *d);
24         bool (*path_match)(const char *prefix, const char *url);
25
26         bool (*create_process)(struct client *cl, struct path_info *pi, char *url,
27                                void (*cb)(struct client *cl, struct path_info *pi, char *url));
28         struct env_var *(*get_process_vars)(struct client *cl, struct path_info *pi);
29
30         void (*http_header)(struct client *cl, int code, const char *summary);
31         void (*client_error)(struct client *cl, int code, const char *summary, const char *fmt, ...);
32         void (*request_done)(struct client *cl);
33         void (*chunk_write)(struct client *cl, const void *data, int len);
34         void (*chunk_printf)(struct client *cl, const char *format, ...);
35
36         int (*urlencode)(char *buf, int blen, const char *src, int slen);
37         int (*urldecode)(char *buf, int blen, const char *src, int slen);
38 };
39
40 struct uhttpd_plugin {
41         struct list_head list;
42
43         int (*init)(const struct uhttpd_ops *ops, struct config *conf);
44         void (*post_init)(void);
45 };