UniMRCP
1.3.0
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
libs
apr-toolkit
include
apt_dir_layout.h
Go to the documentation of this file.
1
/*
2
* Copyright 2008-2014 Arsen Chaloyan
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
* $Id: apt_dir_layout.h 2268 2015-02-03 02:47:11Z achaloyan@gmail.com $
17
*/
18
19
#ifndef APT_DIR_LAYOUT_H
20
#define APT_DIR_LAYOUT_H
21
22
/**
23
* @file apt_dir_layout.h
24
* @brief Directories Layout
25
*/
26
27
#include "
apt.h
"
28
29
APT_BEGIN_EXTERN_C
30
31
/*
32
* This define allows user applications to support both the old interface,
33
* where members of apt_dir_layout_t structure were accessable to the
34
* application, and the new opaque interface, where OPAQUE_DIR_LAYOUT
35
* is defined.
36
*/
37
#define OPAQUE_DIR_LAYOUT
38
39
/** Directories layout declaration */
40
typedef
struct
apt_dir_layout_t
apt_dir_layout_t
;
41
42
/** Enumeration of directories the layout is composed of */
43
typedef
enum
{
44
APT_LAYOUT_CONF_DIR
,
/**< configuration directory */
45
APT_LAYOUT_PLUGIN_DIR
,
/**< plugin directory */
46
APT_LAYOUT_LOG_DIR
,
/**< log directory */
47
APT_LAYOUT_DATA_DIR
,
/**< data directory */
48
APT_LAYOUT_VAR_DIR
,
/**< var directory */
49
50
APT_LAYOUT_DIR_COUNT
,
/**< number of directories in the default layout */
51
52
APT_LAYOUT_EXT_DIR =
APT_LAYOUT_DIR_COUNT
53
}
apt_dir_entry_id
;
54
55
/**
56
* Create the default directories layout based on the specified root directory.
57
* @param root_dir_path the path to the root directory
58
* @param pool the memory pool to use
59
*/
60
APT_DECLARE
(
apt_dir_layout_t
*)
apt_default_dir_layout_create
(const
char
*root_dir_path, apr_pool_t *pool);
61
62
/**
63
* Create a custom directories layout based on the specified individual directories.
64
* @param conf_dir_path the path to the config dir
65
* @param plugin_dir_path the path to the plugin dir
66
* @param log_dir_path the path to the log dir
67
* @param data_dir_path the path to the data dir
68
* @param var_dir_path the path to the var dir
69
* @param pool the memory pool to use
70
*/
71
APT_DECLARE
(
apt_dir_layout_t
*)
apt_custom_dir_layout_create
(
72
const
char
*conf_dir_path,
73
const
char
*plugin_dir_path,
74
const
char
*log_dir_path,
75
const
char
*data_dir_path,
76
const
char
*var_dir_path,
77
apr_pool_t *pool);
78
79
/**
80
* Create a bare directories layout.
81
* @param pool the memory pool to use
82
*/
83
APT_DECLARE
(
apt_dir_layout_t
*)
apt_dir_layout_create
(apr_pool_t *pool);
84
85
/**
86
* Create am extended bare directories layout.
87
* @param count the number of directories in the layout
88
* @param pool the memory pool to use
89
*/
90
APT_DECLARE
(
apt_dir_layout_t
*)
apt_dir_layout_create_ext
(apr_size_t count, apr_pool_t *pool);
91
92
/**
93
* Load directories layout from the specified configuration file.
94
* @param dir_layout the directory layout
95
* @param config_file the path to the configuration file
96
* @param pool the memory pool to use
97
*/
98
APT_DECLARE
(
apt_bool_t
)
apt_dir_layout_load
(
apt_dir_layout_t
*dir_layout, const
char
*config_file, apr_pool_t *pool);
99
100
/**
101
* Load directories layout from the specified configuration file using the provided labels.
102
* @param dir_layout the directory layout
103
* @param config_file the path to the configuration file
104
* @param labels the array of directory labels (configuration entries)
105
* @param count the number of labels (normally equals the number of directories in the layout)
106
* @param pool the memory pool to use
107
*/
108
APT_DECLARE
(
apt_bool_t
)
apt_dir_layout_load_ext
(
apt_dir_layout_t
*dir_layout, const
char
*config_file, const
char
**labels, apr_size_t count, apr_pool_t *pool);
109
110
/**
111
* Set the path to the individual directory in the layout.
112
* @param dir_layout the directory layout
113
* @param dir_entry_id the directory id (apt_dir_entry_id)
114
* @param path the directory path
115
* @param pool the memory pool to use
116
*/
117
APT_DECLARE
(
apt_bool_t
)
apt_dir_layout_path_set
(
apt_dir_layout_t
*dir_layout, apr_size_t dir_entry_id, const
char
*path, apr_pool_t *pool);
118
119
/**
120
* Get the path to the individual directory in the layout.
121
* @param dir_layout the directory layout
122
* @param dir_entry_id the directory id (apt_dir_entry_id)
123
*/
124
APT_DECLARE
(const
char
*)
apt_dir_layout_path_get
(const
apt_dir_layout_t
*dir_layout, apr_size_t dir_entry_id);
125
126
/**
127
* Compose a file path relative to the specified directory in the layout.
128
* @param dir_layout the directory layout
129
* @param dir_entry_id the directory id (apt_dir_entry_id)
130
* @param file_name the file name to append to the directory path
131
* @param pool the memory pool to use
132
*/
133
APT_DECLARE
(
char
*)
apt_dir_layout_path_compose
(const
apt_dir_layout_t
*dir_layout, apr_size_t dir_entry_id, const
char
*file_name, apr_pool_t *pool);
134
135
136
/**
137
* Compose a file path relative to config dir.
138
* @param dir_layout the directory layout
139
* @param file_name the file name
140
* @param pool the memory pool to use
141
*/
142
APT_DECLARE
(
char
*)
apt_confdir_filepath_get
(const
apt_dir_layout_t
*dir_layout, const
char
*file_name, apr_pool_t *pool);
143
144
/**
145
* Compose a file path relative to data dir.
146
* @param dir_layout the directory layout
147
* @param file_name the file name
148
* @param pool the memory pool to use
149
*/
150
APT_DECLARE
(
char
*)
apt_datadir_filepath_get
(const
apt_dir_layout_t
*dir_layout, const
char
*file_name, apr_pool_t *pool);
151
152
/**
153
* Compose a file path relative to var dir.
154
* @param dir_layout the directory layout
155
* @param file_name the file name
156
* @param pool the memory pool to use
157
*/
158
APT_DECLARE
(
char
*)
apt_vardir_filepath_get
(const
apt_dir_layout_t
*dir_layout, const
char
*file_name, apr_pool_t *pool);
159
160
161
APT_END_EXTERN_C
162
163
#endif
/* APT_DIR_LAYOUT_H */
Generated on Mon Feb 2 2015 19:41:38 for UniMRCP by
1.8.3.1