17 #ifndef MOD_MUSICINDEX_H
18 #define MOD_MUSICINDEX_H
21 #include <http_config.h>
22 #include <http_request.h>
23 #include <http_protocol.h>
27 #ifdef APLOG_USE_MODULE
28 APLOG_USE_MODULE(musicindex);
32 #undef PACKAGE_BUGREPORT
41 #undef PACKAGE_TARNAME
44 #undef PACKAGE_VERSION
46 #include "mod_musicindex_config.h"
51 #define MUSIC_VERSION_STRING PACKAGE_VERSION
52 #define MUSIC_AUTHORS_STRING "R. Boudin & T. Varene"
53 #define MUSIC_HEADER_STRING "mod_musicindex/" MUSIC_VERSION_STRING
71 #ifndef C_HAS_ATTRIBUTE
72 #define __attribute__(x)
75 #ifdef C_HAS_BUILTIN_EXPECT
76 #define likely(x) __builtin_expect(!!(x), 1)
77 #define unlikely(x) __builtin_expect(!!(x), 0)
80 #define unlikely(x) (x)
83 #ifdef HAVE_SYS_TIME_H
84 #define STRUCTTV struct timeval
85 #if (!defined(HAVE_TIMERSUB) && !defined(timersub))
86 #define timersub(tvp, uvp, vvp) \
88 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
89 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
90 if ((vvp)->tv_usec < 0) { \
92 (vvp)->tv_usec += 1000000; \
101 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
131 #define SB_DEFAULT SB_URI
139 #define MI_ACTIVE (1 << 0)
141 #define MI_ALLOWSTREAM (1 << 1)
142 #define MI_ALLOWDWNLD (1 << 2)
143 #define MI_ALLOWSEARCH (1 << 3)
144 #define MI_ALLOWTARBALL (1 << 4)
147 #define MI_ALLOWFETCH (MI_ALLOWSTREAM | MI_ALLOWDWNLD | MI_ALLOWTARBALL)
151 #define MI_STREAM (1 << 5)
152 #define MI_ALL (1 << 6)
153 #define MI_RECURSIVE (1 << 7)
154 #define MI_RSS (1 << 8)
155 #define MI_PODCAST (1 << 9)
156 #define MI_RANDOMDIR (1 << 10)
157 #define MI_TARBALL (1 << 11)
159 #define MI_STREAMLST (MI_STREAM)
160 #define MI_STREAMALL (MI_STREAM | MI_ALL)
161 #define MI_STREAMCOOKIE (MI_STREAM | MI_COOKIEOP)
162 #define MI_STREAMRQ (MI_STREAMLST | MI_STREAMALL | MI_STREAMCOOKIE)
164 #define MI_DWNLDLST (MI_TARBALL)
165 #define MI_DWNLDALL (MI_TARBALL | MI_ALL)
166 #define MI_DWNLDCOOKIE (MI_TARBALL | MI_COOKIEOP)
167 #define MI_DWNLDRQ (MI_DWNLDLST | MI_DWNLDALL | MI_DWNLDCOOKIE)
170 #define MI_COOKIEOP (1 << 12)
171 #define MI_COOKIEADD (1 << 13)
172 #define MI_COOKIEDEL (1 << 14)
174 #define MI_COOKIEADDLST (MI_COOKIEOP | MI_COOKIEADD)
175 #define MI_COOKIEDELLST (MI_COOKIEOP | MI_COOKIEDEL)
176 #define MI_COOKIEADDALL (MI_COOKIEOP | MI_COOKIEADD | MI_ALL)
177 #define MI_COOKIEPURGE (MI_COOKIEOP | MI_COOKIEDEL | MI_ALL)
178 #define MI_COOKIESTREAM (MI_COOKIEOP | MI_STREAM)
179 #define MI_COOKIEDWNLD (MI_COOKIEOP | MI_TARBALL)
181 #define MI_ALLOPS (MI_COOKIEOP | \
189 #define MI_QUICKPL (1 << 15)
193 #define MI_CUSTOM (1 << 16)
194 #define MI_ALLOWRSS (1 << 17)
205 #define EF_VBR (1 << 0)
207 #define EF_INCACHE (1 << 1)
208 #define EF_ALLOWSTREAM (1 << 2)
209 #define EF_ALLOWDWNLD (1 << 3)
210 #define EF_ALLOWTARBALL (1 << 4)
211 #define EF_ALLOWRSS (1 << 5)
214 #define EF_FLAGSTOSAVE (EF_VBR)
218 #define MAX_STRING 1024
220 #define MAX_FNAME 255
221 #define MAX_PATHNAME 4096
223 #define MI_LOG_PREFIX "[mod_musicindex] "
225 #ifndef BUILD_FOR_APACHE2
229 #define apr_pool_t pool
231 #define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
232 { directive, func, mconfig, where, NO_ARGS, help }
233 #define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
234 { directive, func, mconfig, where, RAW_ARGS, help }
235 #define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
236 { directive, func, mconfig, where, TAKE1, help }
237 #define AP_INIT_FLAG(directive, func, mconfig, where, help) \
238 { directive, func, mconfig, where, FLAG, help }
240 #define ap_is_directory(pool, name) ap_is_directory(name)
241 #define ap_set_content_type(r, string) (r->content_type = string)
242 #define apr_pool_create(child, parent) ((*(child)) = ap_make_sub_pool(parent))
243 #define ap_sub_req_lookup_uri(p, r, ptr) ap_sub_req_lookup_uri(p, r)
244 #define REQUEST_USER(rec) (rec->connection->user)
246 #define apr_pool_destroy ap_destroy_pool
248 #define apr_table_get ap_table_get
249 #define apr_table_set ap_table_set
250 #define apr_table_setn ap_table_setn
251 #define apr_palloc ap_palloc
252 #define apr_pcalloc ap_pcalloc
253 #define apr_pstrdup ap_pstrdup
254 #define apr_pstrndup ap_pstrndup
255 #define apr_pstrcat ap_pstrcat
256 #define apr_psprintf ap_psprintf
257 #define apr_base64_encode_len ap_base64encode_len
258 #define apr_base64_encode ap_base64encode
259 #define apr_base64_decode_len ap_base64decode_len
260 #define apr_base64_decode ap_base64decode
268 #define ap_http_method ap_http_scheme
270 #define ap_http_method ap_http_scheme
271 #define ap_get_server_name(r) ap_get_server_name_for_url(r)
273 #error "unknown apache API"
276 #include <apr_strings.h>
277 #include <apr_base64.h>
278 #include <ap_compat.h>
282 #define APLOG_ERR LOG_ERR, 0
286 #define APLOG_WARNING LOG_WARNING, 0
290 #define APLOG_NOTICE LOG_NOTICE, 0
294 #define APLOG_DEBUG LOG_DEBUG, 0
297 #define REQUEST_USER(rec) (rec->user)
352 void* (*opendir)(request_rec *r,
mu_pack *
const pack,
353 const char *
const filename,
const char *
const uri,
unsigned long soptions);
363 const char* (*readdir)(
void *dir);
367 void (*closedir)(
void *dir);
371 const char *
const filename);
374 void (*write)(request_rec *r,
const mu_ent *
const entry,
375 const char *
const name);
379 void (*prologue)(request_rec *r);
383 void (*epilogue)(request_rec *r);
396 const char * restrict
css;
419 #define _(String) gettext(String)
421 #define _(String) String
424 #define mi_rerror(format, ...) \
425 ap_log_rerror(APLOG_MARK, APLOG_ERR, r, MI_LOG_PREFIX "(%s) " format, __func__, ## __VA_ARGS__)
426 #define mi_serror(format, ...) \
427 ap_log_error(APLOG_MARK, APLOG_ERR, s, MI_LOG_PREFIX "(%s) " format, __func__, ## __VA_ARGS__)
431 #define mi_rdebug(format, ...) \
432 ap_log_rerror(APLOG_MARK, APLOG_NOTICE, r, MI_LOG_PREFIX "(%s) " format, __func__, ## __VA_ARGS__)
434 #define mi_rdebug(format, ...)