ngx-fancyindex/ngx_http_fancyindex_module.h

105 lines
2.8 KiB
C

/*
* ngx_http_fancyindex_module.h
* Copyright © 2007 Adrian Perez <adrianperez@udc.es>
*
* Distributed under terms of the BSD license.
*/
#ifndef __ngx_http_fancyindex_module_h__
#define __ngx_http_fancyindex_module_h__
#include <ngx_config.h>
#include <ngx_core.h>
#define NGX_HTTP_FANCYINDEX_README_ASIS 0x01
#define NGX_HTTP_FANCYINDEX_README_TOP 0x02
#define NGX_HTTP_FANCYINDEX_README_BOTTOM 0x04
#define NGX_HTTP_FANCYINDEX_README_DIV 0x08
#define NGX_HTTP_FANCYINDEX_README_IFRAME 0x10
#define NGX_HTTP_FANCYINDEX_README_PRE 0x20
/*
* NGX_HTTP_FANCYINDEX_INCLUDE_STATIC
* Cache file contents on first request
* NGX_HTTP_FANCYINDEX_INCLUDE_CACHED
* Cache file contents on first request,
* and re-read if needed afterwards
*/
#define NGX_HTTP_FANCYINDEX_INCLUDE_STATIC 0
#define NGX_HTTP_FANCYINDEX_INCLUDE_CACHED 1
/**
* Configuration structure for the fancyindex module. The configuration
* commands defined in the module do fill in the members of this structure.
*/
typedef struct {
ngx_flag_t enable; /**< Module is enabled. */
ngx_flag_t localtime; /**< File mtime dates are sent in local time. */
ngx_flag_t exact_size; /**< Sizes are sent always in bytes. */
ngx_str_t header; /**< File name for header, or empty if none. */
ngx_str_t footer; /**< File name for footer, or empty if none. */
ngx_str_t readme; /**< File name for readme, or empty if none. */
ngx_uint_t readme_flags; /**< Options for readme file inclusion. */
} ngx_http_fancyindex_loc_conf_t;
#define nfi_sizeof_ssz(_s) (sizeof(_s) - 1)
#define NGX_HTTP_FANCYINDEX_PREALLOCATE 50
#define NGX_HTTP_FANCYINDEX_NAME_LEN 50
/**
* Copy a static zero-terminated string. Useful to output template
* string pieces into a temporary buffer.
*/
#define nfi_cpymem_ssz(_p, _t) \
(ngx_cpymem((_p), (_t), sizeof(_t) - 1))
/**
* Copy a ngx_str_t.
*/
#define nfi_cpymem_str(_p, _s) \
(ngx_cpymem((_p), (_s).data, (_s).len))
/**
* Copy a static zero-terminated string, but only if the string is
* non-empty. Using this may avoid jumping into ngx_cpymem().
*/
#define nfi_maybe_cpymem_ssz(__p, __t) \
if ((__t)[0] != '\0') nfi_cpymem_ssz((__p), (__t))
#define nfi_has_flag(_where, _what) \
(((_where) & (_what)) == (_what))
#define nfi_log_debug_buf_chain(_r, _b) \
do { \
ngx_chain_t *__chain_b = (_b); \
ngx_buf_t *__temp_b = __chain_b->buf; \
while (!__temp_b->last_buf && __chain_b->buf != NULL) { \
ngx_log_debug(NGX_LOG_DEBUG_HTTP, (_r)->connection->log, 0, \
"http fancyindex: buf %p, last_in_buf = %i\n" \
"\tmemory = %i, temporary = %i\n", \
__temp_b, __temp_b->last_in_chain, \
__temp_b->memory, __temp_b->temporary \
); \
__chain_b = __chain_b->next; \
__temp_b = __chain_b->buf; \
} \
} while (0)
#endif /* !__ngx_http_fancyindex_module_h__ */
/* vim:ft=c
*/