mod_include.h revision f653f18d041eee9b4f4d5cbfff9bb51d46390f60
18343797fadabacf01280b38ea7688690d12aec0rbb/* ====================================================================
18343797fadabacf01280b38ea7688690d12aec0rbb * The Apache Software License, Version 1.1
18343797fadabacf01280b38ea7688690d12aec0rbb *
33bdcae1f7a1a65e351dda2a766a0cf28b1e695dnd * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
18343797fadabacf01280b38ea7688690d12aec0rbb * reserved.
18343797fadabacf01280b38ea7688690d12aec0rbb *
18343797fadabacf01280b38ea7688690d12aec0rbb * Redistribution and use in source and binary forms, with or without
18343797fadabacf01280b38ea7688690d12aec0rbb * modification, are permitted provided that the following conditions
18343797fadabacf01280b38ea7688690d12aec0rbb * are met:
18343797fadabacf01280b38ea7688690d12aec0rbb *
18343797fadabacf01280b38ea7688690d12aec0rbb * 1. Redistributions of source code must retain the above copyright
18343797fadabacf01280b38ea7688690d12aec0rbb * notice, this list of conditions and the following disclaimer.
18343797fadabacf01280b38ea7688690d12aec0rbb *
18343797fadabacf01280b38ea7688690d12aec0rbb * 2. Redistributions in binary form must reproduce the above copyright
18343797fadabacf01280b38ea7688690d12aec0rbb * notice, this list of conditions and the following disclaimer in
18343797fadabacf01280b38ea7688690d12aec0rbb * the documentation and/or other materials provided with the
18343797fadabacf01280b38ea7688690d12aec0rbb * distribution.
18343797fadabacf01280b38ea7688690d12aec0rbb *
18343797fadabacf01280b38ea7688690d12aec0rbb * 3. The end-user documentation included with the redistribution,
18343797fadabacf01280b38ea7688690d12aec0rbb * if any, must include the following acknowledgment:
18343797fadabacf01280b38ea7688690d12aec0rbb * "This product includes software developed by the
18343797fadabacf01280b38ea7688690d12aec0rbb * Apache Software Foundation (http://www.apache.org/)."
18343797fadabacf01280b38ea7688690d12aec0rbb * Alternately, this acknowledgment may appear in the software itself,
18343797fadabacf01280b38ea7688690d12aec0rbb * if and wherever such third-party acknowledgments normally appear.
18343797fadabacf01280b38ea7688690d12aec0rbb *
18343797fadabacf01280b38ea7688690d12aec0rbb * 4. The names "Apache" and "Apache Software Foundation" must
18343797fadabacf01280b38ea7688690d12aec0rbb * not be used to endorse or promote products derived from this
18343797fadabacf01280b38ea7688690d12aec0rbb * software without prior written permission. For written
18343797fadabacf01280b38ea7688690d12aec0rbb * permission, please contact apache@apache.org.
18343797fadabacf01280b38ea7688690d12aec0rbb *
18343797fadabacf01280b38ea7688690d12aec0rbb * 5. Products derived from this software may not be called "Apache",
18343797fadabacf01280b38ea7688690d12aec0rbb * nor may "Apache" appear in their name, without prior written
18343797fadabacf01280b38ea7688690d12aec0rbb * permission of the Apache Software Foundation.
18343797fadabacf01280b38ea7688690d12aec0rbb *
18343797fadabacf01280b38ea7688690d12aec0rbb * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
18343797fadabacf01280b38ea7688690d12aec0rbb * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18343797fadabacf01280b38ea7688690d12aec0rbb * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18343797fadabacf01280b38ea7688690d12aec0rbb * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
18343797fadabacf01280b38ea7688690d12aec0rbb * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18343797fadabacf01280b38ea7688690d12aec0rbb * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18343797fadabacf01280b38ea7688690d12aec0rbb * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18343797fadabacf01280b38ea7688690d12aec0rbb * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18343797fadabacf01280b38ea7688690d12aec0rbb * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
18343797fadabacf01280b38ea7688690d12aec0rbb * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
18343797fadabacf01280b38ea7688690d12aec0rbb * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
18343797fadabacf01280b38ea7688690d12aec0rbb * SUCH DAMAGE.
18343797fadabacf01280b38ea7688690d12aec0rbb * ====================================================================
18343797fadabacf01280b38ea7688690d12aec0rbb *
18343797fadabacf01280b38ea7688690d12aec0rbb * This software consists of voluntary contributions made by many
18343797fadabacf01280b38ea7688690d12aec0rbb * individuals on behalf of the Apache Software Foundation. For more
18343797fadabacf01280b38ea7688690d12aec0rbb * information on the Apache Software Foundation, please see
18343797fadabacf01280b38ea7688690d12aec0rbb * <http://www.apache.org/>.
18343797fadabacf01280b38ea7688690d12aec0rbb *
18343797fadabacf01280b38ea7688690d12aec0rbb * Portions of this software are based upon public domain software
18343797fadabacf01280b38ea7688690d12aec0rbb * originally written at the National Center for Supercomputing Applications,
18343797fadabacf01280b38ea7688690d12aec0rbb * University of Illinois, Urbana-Champaign.
18343797fadabacf01280b38ea7688690d12aec0rbb */
18343797fadabacf01280b38ea7688690d12aec0rbb
18343797fadabacf01280b38ea7688690d12aec0rbb#ifndef _MOD_INCLUDE_H
18343797fadabacf01280b38ea7688690d12aec0rbb#define _MOD_INCLUDE_H 1
18343797fadabacf01280b38ea7688690d12aec0rbb
7f1533cc21a93c0744bd40e697ba610a5b1cb68fianh#include "apr_pools.h"
9879245661cccfaece04770166d76312431446f7wrowe#include "apr_optional.h"
7f1533cc21a93c0744bd40e697ba610a5b1cb68fianh
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd/*
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd * Constants used for ap_ssi_get_tag_and_value's decode parameter
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_VALUE_DECODED 1
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_VALUE_RAW 0
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd/*
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd * Constants used for ap_ssi_parse_string's leave_name parameter
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_EXPAND_LEAVE_NAME 1
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_EXPAND_DROP_NAME 0
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd/*
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd * This macro creates a bucket which contains an error message and appends it
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd * to the current pass brigade
18343797fadabacf01280b38ea7688690d12aec0rbb */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_CREATE_ERROR_BUCKET(ctx, f, bb) APR_BRIGADE_INSERT_TAIL((bb), \
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd apr_bucket_pool_create(apr_pstrdup((ctx)->pool, (ctx)->error_str), \
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd strlen((ctx)->error_str), (ctx)->pool, \
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd (f)->c->bucket_alloc))
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd/*
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd * These constants are used to set or clear flag bits.
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_FLAG_PRINTING (1<<0) /* Printing conditional lines. */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_FLAG_COND_TRUE (1<<1) /* Conditional eval'd to true. */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_FLAG_SIZE_IN_BYTES (1<<2) /* Sizes displayed in bytes. */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_FLAG_NO_EXEC (1<<3) /* No Exec in current context. */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_FLAG_SIZE_ABBREV (~(SSI_FLAG_SIZE_IN_BYTES))
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_FLAG_CLEAR_PRINT_COND (~((SSI_FLAG_PRINTING) | \
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd (SSI_FLAG_COND_TRUE)))
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd#define SSI_FLAG_CLEAR_PRINTING (~(SSI_FLAG_PRINTING))
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd/*
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd * The public SSI context structure
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fndtypedef struct {
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd /* permanent pool, use this for creating bucket data */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd apr_pool_t *pool;
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd /* temp pool; will be cleared after the execution of every directive */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd apr_pool_t *dpool;
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd /* See the SSI_FLAG_XXXXX definitions. */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd int flags;
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd /* nesting of *invisible* ifs */
18343797fadabacf01280b38ea7688690d12aec0rbb int if_nesting_level;
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd /* if true, the current buffer will be passed down the filter chain before
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd * continuing with next input bucket and the variable will be reset to
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd * false.
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd int flush_now;
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd /* argument counter (of the current directive) */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd unsigned argc;
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd /* currently configured error string */
f653f18d041eee9b4f4d5cbfff9bb51d46390f60nd const char *error_str;
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd /* currently configured time format */
f653f18d041eee9b4f4d5cbfff9bb51d46390f60nd const char *time_str;
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd /* pointer to internal (non-public) data, don't touch */
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd struct ssi_internal_ctx *intern;
18343797fadabacf01280b38ea7688690d12aec0rbb} include_ctx_t;
18343797fadabacf01280b38ea7688690d12aec0rbb
31cd7345e3f8257a89ef1f5ab344fb037c0d941fndtypedef apr_status_t (include_handler_fn_t)(include_ctx_t *, ap_filter_t *,
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd apr_bucket_brigade *);
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fndAPR_DECLARE_OPTIONAL_FN(void, ap_ssi_get_tag_and_value,
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd (include_ctx_t *ctx, char **tag, char **tag_val,
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd int dodecode));
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
31cd7345e3f8257a89ef1f5ab344fb037c0d941fndAPR_DECLARE_OPTIONAL_FN(char*, ap_ssi_parse_string,
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd (request_rec *r, include_ctx_t *ctx, const char *in,
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd char *out, apr_size_t length, int leave_name));
31cd7345e3f8257a89ef1f5ab344fb037c0d941fnd
e08a1745d191d666759873a50edcc520ca273e12wroweAPR_DECLARE_OPTIONAL_FN(void, ap_register_include_handler,
e08a1745d191d666759873a50edcc520ca273e12wrowe (char *tag, include_handler_fn_t *func));
f6e9f5600e77b78fb013bb543d364135961639d1rbb
18343797fadabacf01280b38ea7688690d12aec0rbb#endif /* MOD_INCLUDE */