-
Notifications
You must be signed in to change notification settings - Fork 104
/
handler_dirlist.h
132 lines (106 loc) · 3.7 KB
/
handler_dirlist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Cherokee
*
* Authors:
* Alvaro Lopez Ortega <alvaro@alobbs.com>
*
* Copyright (C) 2001-2011 Alvaro Lopez Ortega
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef CHEROKEE_DIRLIST_HANDLER_H
#define CHEROKEE_DIRLIST_HANDLER_H
#include "common-internal.h"
#include <dirent.h>
#include <unistd.h>
#include "list.h"
#include "buffer.h"
#include "handler.h"
#include "plugin_loader.h"
typedef enum {
Name_Down,
Name_Up,
Size_Down,
Size_Up,
Date_Down,
Date_Up
} cherokee_dirlist_sort_t;
typedef enum {
dirlist_phase_add_header,
dirlist_phase_add_parent_dir,
dirlist_phase_add_entries,
dirlist_phase_add_footer,
dirlist_phase_finished
} cherokee_dirlist_phase_t;
typedef struct {
cherokee_handler_props_t props;
cherokee_list_t notice_files;
cherokee_list_t hidden_files;
/* Visible properties
*/
cherokee_boolean_t show_size;
cherokee_boolean_t show_date;
cherokee_boolean_t show_user;
cherokee_boolean_t show_group;
cherokee_boolean_t show_icons;
cherokee_boolean_t show_symlinks;
cherokee_boolean_t show_hidden;
cherokee_boolean_t show_backup;
/* Theme
*/
cherokee_buffer_t header;
cherokee_buffer_t footer;
cherokee_buffer_t entry;
cherokee_buffer_t css;
/* Paths
*/
cherokee_boolean_t redir_symlinks;
cherokee_buffer_t icon_web_dir;
} cherokee_handler_dirlist_props_t;
typedef struct {
cherokee_handler_t handler;
/* File list
*/
cherokee_list_t dirs;
cherokee_list_t files;
/* State
*/
cherokee_dirlist_sort_t sort;
cherokee_dirlist_phase_t phase;
/* State
*/
cuint_t longest_filename;
cherokee_list_t *dir_ptr;
cherokee_list_t *file_ptr;
cherokee_buffer_t header;
cherokee_buffer_t public_dir;
} cherokee_handler_dirlist_t;
#define PROP_DIRLIST(x) ((cherokee_handler_dirlist_props_t *)(x))
#define HDL_DIRLIST(x) ((cherokee_handler_dirlist_t *)(x))
#define HDL_DIRLIST_PROP(x) (PROP_DIRLIST(MODULE(x)->props))
/* Library init function
*/
void PLUGIN_INIT_NAME(dirlist) (cherokee_plugin_loader_t *loader);
ret_t cherokee_handler_dirlist_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_props_t *properties);
ret_t cherokee_handler_dirlist_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props);
ret_t cherokee_handler_dirlist_props_free (cherokee_handler_dirlist_props_t *props);
/* virtual methods implementation
*/
ret_t cherokee_handler_dirlist_init (cherokee_handler_dirlist_t *dhdl);
ret_t cherokee_handler_dirlist_free (cherokee_handler_dirlist_t *dhdl);
void cherokee_handler_dirlist_get_name (cherokee_handler_dirlist_t *dhdl, char **name);
ret_t cherokee_handler_dirlist_step (cherokee_handler_dirlist_t *dhdl, cherokee_buffer_t *buffer);
ret_t cherokee_handler_dirlist_add_headers (cherokee_handler_dirlist_t *dhdl, cherokee_buffer_t *buffer);
#endif /* CHEROKEE_DIRLIST_HANDLER_H */