If URI is not found, before to send 404, check if a plugins on stage 40 would like...
[MonkeyD.git] / src / plugins / dirlisting / dirlisting.h
blob425b6757ddef3374ab8a0d8e7bbb9b6858fc3595
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
3 /* Monkey HTTP Daemon
4 * ------------------
5 * Copyright (C) 2001-2009, Eduardo Silva P.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Library General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 /* dir_html.c */
23 #ifndef MK_DIRHTML_H
24 #define MK_DIRHTML_H
26 #define MK_DIRHTML_URL "/_mktheme"
27 #define MK_DIRHTML_DEFAULT_MIME "text/html"
29 /* For every directory requested, don't send more than
30 * this limit of entries.
32 #define MK_DIRHTML_BUFFER_LIMIT 30
33 #define MK_DIRHTML_BUFFER_GROW 5
35 #define MK_HEADER_CHUNKED "Transfer-Encoding: Chunked\r\n\r\n"
37 /* Theme files */
38 #define MK_DIRHTML_FILE_HEADER "header.theme"
39 #define MK_DIRHTML_FILE_ENTRY "entry.theme"
40 #define MK_DIRHTML_FILE_FOOTER "footer.theme"
42 #define MK_DIRHTML_TAG_INIT "%_"
43 #define MK_DIRHTML_TAG_END "_%"
44 #define MK_DIRHTML_SIZE_DIR "-"
46 struct mk_f_list
48 char *name;
49 char *size;
50 char *ft_modif;
51 unsigned char type;
52 struct file_info *info;
53 struct mk_f_list *next;
56 /* Main configuration of dirhtml module */
57 struct dirhtml_config
59 char *theme;
60 char *theme_path;
64 mk_pointer mk_dirhtml_default_mime;
66 /* Global config */
67 struct dirhtml_config *dirhtml_conf;
69 /* Used to keep splitted content of every template */
70 struct dirhtml_template
72 char *buf;
73 int tag_id;
74 int len;
75 struct dirhtml_template *next;
76 char **tags; /* array of theme tags: [%_xaa__%, %_xyz_%] */
79 /* Templates for header, entries and footer */
80 struct dirhtml_template *mk_dirhtml_tpl_header;
81 struct dirhtml_template *mk_dirhtml_tpl_entry;
82 struct dirhtml_template *mk_dirhtml_tpl_footer;
84 struct dirhtml_value
86 int tag_id;
87 mk_pointer sep; /* separator code after value */
89 /* string data */
90 int len;
91 char *value;
93 /* next node */
94 struct dirhtml_value *next;
96 char **tags; /* array of tags which values correspond */
99 struct dirhtml_value *mk_dirhtml_value_global;
101 char *check_string(char *str);
102 char *read_header_footer_file(char *file_path);
104 int mk_dirhtml_conf();
105 char *mk_dirhtml_load_file(char *filename);
107 struct dirhtml_template
108 *mk_dirhtml_template_create(char *content);
110 struct dirhtml_template
111 *mk_dirhtml_template_list_add(struct dirhtml_template **header,
112 char *buf, int len,
113 char **tpl, int tag);
115 int mk_dirhtml_init(struct client_request *cr, struct request *sr);
116 int mk_dirhtml_read_config(char *path);
117 int mk_dirhtml_theme_load();
118 int mk_dirhtml_theme_debug(struct dirhtml_template **st_tpl);
120 struct dirhtml_value *mk_dirhtml_tag_assign(struct dirhtml_value **values,
121 int tag_id, mk_pointer sep,
122 char *value, char **tags);
124 struct f_list *get_dir_content(struct request *sr, char *path);
127 #endif