de-constify the url parameter for the handler, it becomes invalid after the request...
[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 (*client_error)(struct client *cl, int code, const char *summary, const char *fmt, ...);
31 void (*chunk_write)(struct client *cl, const void *data, int len);
32
33 int (*urlencode)(char *buf, int blen, const char *src, int slen);
34 int (*urldecode)(char *buf, int blen, const char *src, int slen);
35 };
36
37 struct uhttpd_plugin {
38 int (*init)(const struct uhttpd_ops *ops, struct config *conf);
39 };